Skip to content

Management API

The plane exposes a JSON HTTP API under /api/v1. The console and the of CLI both use it. This guide covers the conventions and the routes you are most likely to script.

The examples assume:

Terminal window
export PLANE=http://127.0.0.1:8787 # plane address (loopback by default)
export TOKEN=... # PLANE_ADMIN_TOKEN
export CELL=default TEAM=acme
AUTH="Authorization: Bearer $TOKEN"
Caller Credential
Administrator Authorization: Bearer <PLANE_ADMIN_TOKEN>
Team member A member credential (ofm_...) as a bearer token; roles are viewer and deployer
Worker automation A worker API token (ofw_...) with scopes logs:read, metrics:read, code:deploy

Worker tokens can call only a few routes for their own worker: logs, metrics and usage series reads, deployment-state, and deploy-source. Anything else returns 403; an invalid token returns 401.

The console serves the API behind HTTP Basic auth and a proxy; mutating requests from the console need the header X-OpenFlare-Console-Request: 1. Scripts should talk to the plane directly with a bearer token, and the plane should be reachable only from trusted networks (Security).

  • Responses are Cache-Control: no-store.
  • Success: {"data": ...}.
  • Error: {"data": null, "error": {"code": "...", "message": "..."}}.
  • JSON request bodies are limited to 1 MiB (code-source requests have a larger limit); bundle uploads to PLANE_MAX_BUNDLE_BYTES (default 128 MiB).
  • A worker is identified by team:name. Worker routes live under /api/v1/cells/{cell}/teams/{team}/workers/{name}/....
Status Meaning
400 Malformed request
401 Missing or invalid credential
403 Authenticated but not allowed
404 Not found
409 Conflict (for example the active version changed, or a resource is referenced)
413 Body too large
422 Validation failed
500 Server error
501 Not available (for example publishing without a signing key)

All paths are under /api/v1. {w} stands for /cells/{cell}/teams/{team}/workers/{name}.

Area Routes
Cells GET/POST /cells, GET /cells/{id}, POST /cells/{id}/token, GET /cells/{id}/render-inputs, DELETE /cells/{id}
Identity GET /identity, GET /identity/workers
Teams and members GET/POST /members, POST /members/{login}/rotate, DELETE /members/{login}, PUT/DELETE /teams/{teamId}/members/{login}
Workers POST /cells/{cell}/workers, {w}, {w}/dependencies
Versions {w}/deploy, {w}/deploy-source, {w}/versions/{id}/activate, {w}/versions/{id}/source, {w}/deployment-state
Config {w}/vars/{key}, {w}/secrets/{key}, {w}/json-vars, {w}/environment, GET /worker-compatibility
Hostnames {w}/hostnames, {w}/hostnames/{hostname}/verify, {w}/default-hostname
API tokens {w}/api-tokens
Static assets Upload routes for objects and manifests, per worker
Publishing POST /cells/{cell}/publish, GET /cells/{cell}/publications
Operations GET /cells/{cell}/ops/{opId}?waitMs=, d1-ops, cell-ops
Usage and limits {w}/usage/series, {w}/metrics, {w}/limits, GET /teams/{teamId}/usage?month=YYYY-MM
Cache POST /cells/{cell}/teams/{team}/cache/purge, GET .../cache/purges
Secrets Store PUT/GET/DELETE /cells/{cell}/teams/{team}/secrets-store/{storeId}/{secretName}, .../references
R2 GET/POST /cells/{cell}/r2/buckets, POST /cells/{cell}/r2/backend-tests, POST .../r2/buckets/{name}/probe, DELETE .../r2/buckets/{name}, .../r2/buckets/{name}/ops

Resources such as KV, D1, queues and Hyperdrive have their own team-scoped routes; the CLI (of kv, of d1, and others) is the most convenient client for them. KV and R2 data operations, and D1 queries, are asynchronous: the plane returns 202 with an opId (D1 query returns {opId, channel: "d1"}), and you read the result with the ops route.

Some routes need the cell to advertise a capability and otherwise return 409 with VRT_CELL_CAPABILITY_MISSING (cache purge returns 409 when cachePurge is missing). The capabilities are cachePurge, secretsStore, workflows, workflowsCrossWorker, quotas, quotasOutboundConnections, storagePurge, vectorizePurge and jsonBindings.

POST /cells/{cell}/publish takes an optional {cause, workerId, versionId} and returns 201 {revision}. It returns 501 when the plane has no signing key. Publications have a one-hour expiry and are renewed automatically; GET /cells/{cell}/publications lists them (limit 1 to 200, workerId, before, includeSystem=true to include SYSTEM_RENEWAL rows). Acknowledgement statuses are PENDING, PARTIAL, APPLIED and SUPERSEDED.

deploy and deploy-source accept version fields such as bundleSha256, bundleBytes, mainModule, modules, compatibilityDate, compatibilityFlags, crons, quotas, vars, bindings, queueConsumers, tailConsumers, streamingTailConsumers, versionMetadata, observability, cache, exportedClassNames, durableObjectClasses, assetsRouting and assetsRunWorkerFirst. Errors you may see include VRT_BUNDLE_NOT_UPLOADED and VRT_BUNDLE_SIZE_MISMATCH (409), VRT_COMPATIBILITY_DATE_INVALID, VRT_COMPATIBILITY_FLAGS_LIMIT, VRT_COMPATIBILITY_FLAG_UNSUPPORTED and COMPAT_FLAG_CONFLICT. GET /worker-compatibility returns the pinned runtime’s workerdVersion, maxDate, maxFlags, flags and conflicts.

PUT/DELETE {w}/vars/{key} and {w}/secrets/{key} take {value} and publish. POST {w}/json-vars takes baseVersionId, jsonVars and activate; each key is at most 16 KiB and the cell needs jsonBindings. PUT {w}/default-hostname takes {hostname, enabled}.

  • GET {w}/usage/series?metric=latency&windowMs= returns points with count, sampledAtMs, meanMs, p50Ms, p99Ms and largestBoundMs, at intervals of 1 minute, 1 hour or 1 day for the 1 hour, 24 hour and 7 day windows.
  • GET {w}/limits covers CPU, memory, subrequests and outbound connections (the last needs quotasOutboundConnections).
  • GET /teams/{teamId}/usage?month=YYYY-MM reports requestsMonth, cpuMsMonth and workersMax with a status of below, near (80 percent or more), at_limit or over.
  • Resource stats routes (D1, queues, Durable Objects, workflows, R2) accept ?history=1h|24h|7d.

POST /cells/{cell}/r2/buckets takes {teamId, bucketName, backend?}; omit backend for local storage. See R2 storage backends.

PUT .../secrets-store/{storeId}/{secretName} creates or rotates a secret. A stale If-Match or a conflicting If-None-Match returns 412. The cell needs the secretsStore capability.

Terminal window
curl -sS -H "$AUTH" $PLANE/api/v1/cells
Terminal window
curl -sS -H "$AUTH" $PLANE/api/v1/identity
# {"data":{"login":"admin"}}
Terminal window
curl -sS -X POST -H "$AUTH" -H 'Content-Type: application/json' \
$PLANE/api/v1/cells/$CELL/workers \
-d '{"teamId":"'$TEAM'","name":"hello","compatibilityDate":"2025-01-01"}'

The body is strict (unknown fields are rejected). Optional fields include entrypoint, template (hello, json-api, redirect, kv-d1, which requires a creationKey UUID) and git. A worker id that already exists in another cell returns 409.

Terminal window
curl -sS -X POST -H "$AUTH" -H 'Content-Type: application/json' \
$PLANE/api/v1/cells/$CELL/teams/$TEAM/workers/hello/deploy-source \
-d '{"mainModule":"index.js","modules":[{"name":"index.js","type":"esModule","text":"export default { fetch: () => new Response(\"hi\") }"}],"activate":true,"publish":true}'

Returns {version, created, activated, revision, bundleDigest} with status 201 if a version was created.

Terminal window
curl -sS -X POST -H "$AUTH" \
$PLANE/api/v1/cells/$CELL/teams/$TEAM/workers/hello/versions/$VERSION/activate
# {"data":{"workerId":"acme:hello","versionId":"...","activated":true,"revision":13}}
Terminal window
curl -sS -X POST -H "$AUTH" -H 'Content-Type: application/json' \
$PLANE/api/v1/cells/$CELL/teams/$TEAM/workers/hello/hostnames \
-d '{"hostname":"hello.example.com"}'

Returns 201 with the pending claim and a verification object (name: _openflare.<hostname>, value, expiresAt 24 hours out). After publishing the DNS record:

Terminal window
curl -sS -X POST -H "$AUTH" \
$PLANE/api/v1/cells/$CELL/teams/$TEAM/workers/hello/hostnames/hello.example.com/verify
Terminal window
curl -sS -X POST -H "$AUTH" -H 'Content-Type: application/json' \
$PLANE/api/v1/cells/$CELL/teams/$TEAM/workers/hello/api-tokens \
-d '{"label":"ci","scopes":["code:deploy","logs:read"],"expiresAt":"2027-01-01T00:00:00Z"}'

Returns 201 {token, record}. The token value is shown only once. Revoke with DELETE .../api-tokens/{tokenId}.

Terminal window
curl -sS -X POST -H "Authorization: Bearer $OFW_TOKEN" -H 'Content-Type: application/json' \
$PLANE/api/v1/cells/$CELL/teams/$TEAM/workers/hello/deploy-source \
-d '{"baseVersionId":"'$ACTIVE'","modules":[{"name":"index.js","type":"esModule","text":"..."}],"activate":true}'

Only baseVersionId, mainModule, modules, changeNote, activate and publish are accepted from a token or member; other fields return 403. A stale baseVersionId returns 409.

Terminal window
curl -sS -X POST -H "$AUTH" -H 'Content-Type: application/json' \
$PLANE/api/v1/cells/$CELL/teams/$TEAM/cache/purge -d '{"workerName":"hello"}'

Send exactly one of workerName, tags, pathPrefix, all.

Terminal window
curl -sS -X POST -H "$AUTH" -H 'Content-Type: application/json' \
$PLANE/api/v1/members -d '{"login":"alice","teamId":"'$TEAM'","role":"deployer"}'

The body is {login, teamId, role} with role of viewer or deployer. The member credential (ofm_...) is returned once; rotate with POST /members/alice/rotate. To change a role on a team, use PUT /teams/$TEAM/members/alice with {"role":"viewer"}; remove with DELETE.

Terminal window
curl -sS -X POST -H "$AUTH" -H 'Content-Type: application/json' \
$PLANE/api/v1/cells/$CELL/r2/buckets \
-d '{"teamId":"'$TEAM'","bucketName":"uploads","backend":{"type":"s3","bucket":"my-aws-bucket","region":"us-east-1","credentials":{"accessKeyId":"...","secretAccessKey":"..."}}}'
Terminal window
curl -sS -H "$AUTH" "$PLANE/api/v1/cells/$CELL/ops/$OPID?waitMs=10000"

Deploy a worker, CLI reference, Limits.