Reference · Control API
Control API
The API behind the console and the CLI manages clusters, schemas, keys, sign-in and shard placement.
- In the schema
- —
Authentication and scopes#
Authenticate requests to https:/ by passing an org token (napalm_…) in the Authorization: Bearer header. An org token acts as the manager who created it and is scoped to a single organization.
Value-blind org tokens
napalm_… tokens carry read or manage control scope for one organization and can never read or mutate application rows inside a project.
Tracked asynchronous operations
Cluster provisioning, scaling, backups and shard moves return 202 Accepted with a pollable /operations/{id} state record and audit trail.
- readscope
- Permits all GET endpoints plus read-only inspection routes (such as query compilation checks and access reach previews).
- managescope
- Permits all state-changing operations: provisioning clusters, pushing schemas, issuing or revoking keys, configuring sign-in and running backups or shard migrations.
Org tokens cannot read or mutate application rows inside your projects. See Sessions and keys for token creation and renewal.
curl https://api.napalmdata.com/projects \ -H "Authorization: Bearer $NAPALM_TOKEN"API sections#
- Projects
- Project provisioning, API settings, service keys, access policy auditing, authentication providers, webhooks, S3 file imports and query telemetry.
- Schema & branches
- Schema migrations, query typechecking, deployed query catalogs, branch creation and point-in-time restores, and GitHub pull-request automation.
- Actions, handlers & schedules
- External and hosted action handlers, ES256 caller assertion exchange, handler machine pools and secrets, cron schedules and background job queues.
- Distribution
- Root placement analysis, multi-shard bucket distribution, online bucket moves, shard splits, regional pinning, single-root point-in-time recovery and core copies.
- Clusters
- Cluster provisioning, vertical and replica scaling, maintenance holds, base backups, point-in-time restores, primary switchovers and managed storage for files, the change log and search.
- Organization & billing
- Organization profile, monthly metered usage and spend caps, org tokens, CLI login handshakes and immutable audit events.
Request and response conventions#
- Payload limits
- A request body holds up to 16 KiB. A schema change takes up to 1 MiB with up to 512 KiB of schema. A query deployment takes up to 4 MiB, and a handler bundle up to 128 MiB. A POST route without parameters expects {}.
- Strict deserialization
- Request and response fields use camelCase. Unknown fields or missing required properties are rejected with HTTP 422 rather than silently ignored.
- Tenant isolation
- Resources belonging to another organization return HTTP 404 Not Found to prevent cross-organization enumeration.
- Operations
- Long-running infrastructure changes return HTTP 202 Accepted with an operation and a Location: /operations/{id} header.
- Ending resources
- A route that ends a resource names the resource in the path and the kind of ending in the verb. remove is for resources the org made, revoke for a credential or a membership and cancel for work under way. Those routes take no body. Webhooks are named in the body, because a webhook’s URL is its only identifier.
- Caching
- All Control API responses include Cache-Control: no-store.
HTTP/1.1 202 AcceptedLocation: /operations/0192c3f4-6b1a-7d8e-9f00-1a2b3c4d5e6f { "operation": { "id": "0192c3f4-6b1a-7d8e-9f00-1a2b3c4d5e6f", "operationType": "shardBackup", "status": "pending", "clusterId": "0192c3f0-1122-7334-8445-556677889900", "insertTime": "2026-11-08T18:20:00Z" }}Operations#
| Route | Description | Scope |
|---|---|---|
GET /operations/{id} | Fetch the current status, progress metadata and result or error of an operation | Scoperead |
GET /# | List chronological step transitions and diagnostic events recorded by the operation | Scoperead |
POST /# | Retry a failed or timed-out operation after inspecting the failure cause | ScopeNapalm’s admins |
GET/operations/{id}#
Control’s work on a cluster or branch runs asynchronously as an operation. Provisioning a cluster, scaling machines, taking a backup, restoring a shard, moving buckets and importing files all answer 202 Accepted and return Location: /. Each operation moves from pending to running and ends in completed, failed or timeout. Operations differ from a project’s own jobs, which are deployed queries that the project’s app queues. See Jobs.
Operation object
- iduuid
- Operation identifier returned in
operation.idand theLocationheader. - operationTypestring
- Workflow discriminator such as
clusterProvision,clusterScale,shardBackup,shardRestore,bucketMove,shardSplitorfileImport. - statusstring
- Current lifecycle state:
pending,running,completed,failedortimeout. - stepstring | null
- Active phase on multi-step online operations, such as
copying,catchingUp,drainingandclearingon a bucket or root move. - errorstring | null
- Failure or timeout reason from the newest run, or
nullwhile running or completed. - runsobject[]
- Execution attempts ordered newest first, each recording
id,status,startTime,aliveTime,finishTimeanderror.
Poll GET /operations/{id} every 2 to 5 seconds, or run napalm operations show <id> --wait in the CLI. Read GET / for up to 100 audit events per operation, newest first, covering the request, worker claim and outcome. When an operation ends in failed or timeout, the control plane halts automatic retries and records the reason in operation.error. A Napalm admin inspects the cluster state before re-running the operation through POST /.
curl https://api.napalmdata.com/operations/$OPERATION \ -H "Authorization: Bearer $NAPALM_TOKEN"{ "operation": { "id": "0192c3f4-6b1a-7d8e-9f00-1a2b3c4d5e6f", "operationType": "bucketMove", "status": "running", "clusterId": "0192c3f0-1122-7334-8445-556677889900", "orgId": "3c8f1a2e-9b4d-4e7c-a1f6-5d2b8e0c9a47", "projectId": "8a4d2c10-5e3b-4f9a-8c12-6d7e8f9a0b1c", "branch": "main", "bucket": 12, "sourceShard": "shard-a1b2c3d4e5", "targetShard": "shard-k3m9x2p7qa", "isAutomatic": false, "step": "catchingUp", "placementVersion": null, "startTime": "2026-11-08T18:20:02Z", "finishTime": null, "error": null, "insertTime": "2026-11-08T18:20:00Z", "updateTime": "2026-11-08T18:20:09Z", "parentId": null, "runs": [ { "id": "0192c3f4-6b1a-7d8e-9f00-1a2b3c4d5e70", "status": "running", "startTime": "2026-11-08T18:20:02Z", "aliveTime": "2026-11-08T18:20:09Z", "finishTime": null, "error": null } ] }}{ "operation": { "id": "0192c3f4-6b1a-7d8e-9f00-1a2b3c4d5e6f", "operationType": "shardRestore", "status": "failed", "clusterId": "0192c3f0-1122-7334-8445-556677889900", "branch": "main", "targetTime": "2026-11-07T09:30:00Z", "startTime": "2026-11-08T18:20:02Z", "finishTime": "2026-11-08T18:21:14Z", "error": "base backup prior to targetTime was not found on shard-a1b2c3d4e5" }}Error catalog#
Structured Control API errors are JSON in the shape { "error": { "code": "…", "message"?: "…" } }. Requests that fail transport-level parsing (exceeding byte limits or invalid JSON syntax) get plain-text 413 or 422 responses.
| HTTP | Error code | Description |
|---|---|---|
| 400 | invalid_request | DescriptionMalformed parameter value or out-of-range configuration field. |
| 400 | schema_invalid | DescriptionThe engine rejected the submitted SDL migration or query (includes compiler diagnostic details). |
| 401 | unauthorized | DescriptionMissing, expired or revoked organization bearer token. |
| 402 | monthly_limit_reached | DescriptionProvisioning or scaling would push monthly projected infrastructure spend above the organization quota. |
| 402 | monthly_cap_reached | DescriptionProvisioning or scaling would exceed the self-imposed monthly spend cap configured by organization managers. |
| 402 | payment_overdue | DescriptionAn invoice payment failed. New provisioning and scaling operations are paused until the payment is resolved. |
| 403 | forbidden | DescriptionThe caller does not have permission to access the target organization. |
| 403 | manage_scope_required | DescriptionA read-scoped token attempted to call a state-changing endpoint. |
| 404 | not_found | DescriptionThe requested project, cluster, branch, key or job does not exist in the caller’s organization. |
| 409 | conflict | DescriptionState conflict, such as no unassigned cluster available for a new project or a duplicate resource name. |
| 409 | cluster_busy | DescriptionAnother operation is already running on the target cluster. |
| 409 | cluster_unavailable | DescriptionThe cluster is not yet provisioned or has been torn down. |
| 409 | backups_not_configured | DescriptionBackup or restore requested on a cluster without configured backup storage. |
| 409 | files_not_configured | DescriptionFile operations requested on a project whose cluster has no file storage. |
| 409 | change_log_not_configured | DescriptionA change log read, a change log retention setting or a rows webhook requested on a cluster that keeps no change log. |
| 409 | branch_distributed | DescriptionThe request is not possible yet for a branch spread over more than one shard. |
| 409 | key_limit_reached | DescriptionThe branch already holds 500 live service keys. Revoke an existing key on the branch first. |
| 409 | label_taken | DescriptionThe requested project or storage label is already in use. |
| 409 | host_taken | DescriptionThe custom domain is already bound to or pending verification on another bucket. |
| 409 | volume_full | DescriptionThe target shard volume exceeds the 80% utilization threshold required to create or copy a branch. |
| 409 | branch_copy_failed | DescriptionThe branch-copy operation failed while the request was waiting. message holds the operation’s error, and operationId names the failed operation. |
| 409 | github_not_configured | DescriptionGitHub repository integration is not configured on the control plane. |
| 413 | — | DescriptionThe request body is over the route’s limit: 16 KiB on most routes, 1 MiB for a schema change, 4 MiB for a query deployment and 128 MiB for a handler bundle. |
| 422 | — | DescriptionUnrecognized field or missing required JSON property. |
| 500 | internal_error | DescriptionUnexpected server error. Idempotent reads are safe to retry. |
| 503 | github_unavailable | DescriptionUpstream GitHub API request timed out or failed. Retry shortly. |