Skip to main content

Admin API reference

The Admin API exists only when runtime administration is enabled. Every request requires Authorization: Bearer <admin-token>; use X-Straw-Actor on mutations for audit attribution. Keep this surface on a separate protected network. Errors use {"error":"stable_or_diagnostic_value"}.

Method and pathPurposeConcurrency and result
GET /api/v1/admin/configCurrent snapshotReturns snapshot, revision, and ETag
PUT /api/v1/admin/configValidate and activate a complete snapshotRequires quoted/numeric If-Match; returns ConfigRecord and new ETag
GET /api/v1/admin/config/historyBounded newest-first audit historyRead-only
POST /api/v1/admin/config/rollbackReapply a historical config_version as a new versionRequires If-Match and {"config_version":N}; creates a new audited version
GET /api/v1/admin/rolloutsWorker acknowledgement stateRead-only snapshot
GET /api/v1/admin/workersWorkers ordered by worker IDRead-only
POST /api/v1/admin/workers/{worker_id}/{action}drain, undrain, disable, or enableRequires If-Match; validates worker/action and returns new record/ETag
GET /api/v1/admin/requestsActive owned requestsRead-only; HA data depends on shared runtime state
DELETE /api/v1/admin/requests/{request_id}Request cancellationSafe to repeat; ownership is resolved through shared state in HA

ConfigRecord contains snapshot, actor, action, created_at, and revision. History is {"items":[ConfigRecord...]} in newest-first bounded order. Rollout is config_version, Control status, and ordered worker entries containing worker_id/status (pending or applied). Workers return ordered items with identity/session/state, enabled, draining, executor type, active/available/max capacity, last seen, and pools. Active requests contain only request_id and deployment ID.

Mutation bodies are limited to 4 MiB and must be one strict JSON value without unknown fields or trailing data. Missing If-Match returns 428 if_match_required; malformed values return 400 invalid_if_match; stale revisions return 409 revision_conflict; invalid snapshots return 422; missing cancellation targets return 404 request_not_found; bad/missing auth returns 401 admin_auth_required. Successful cancellation returns 204 without a body. Store/backend failures are non-2xx and do not activate partial configuration. The dashboard at /admin/ is an API client, not an additional security boundary.

Examples​

Read the current record and preserve its quoted revision before making a mutation:

export ADMIN_URL=http://127.0.0.1:8080
export ADMIN_TOKEN=replace-me
curl -fsS -D /tmp/straw-admin-headers -o /tmp/straw-config.json \
-H "Authorization: Bearer $ADMIN_TOKEN" \
"$ADMIN_URL/api/v1/admin/config"
etag=$(awk 'tolower($1)=="etag:" {gsub("\r", "", $2); print $2}' /tmp/straw-admin-headers)
cat /tmp/straw-config.json

The saved response has the shape {"snapshot":{...},"revision":N,"actor":"...","action":"...","created_at":"..."}. Send the complete snapshot object—not the outer record—when updating it:

curl -fsS -X PUT \
-H "Authorization: Bearer $ADMIN_TOKEN" \
-H "X-Straw-Actor: operator@example.com" \
-H "If-Match: $etag" \
-H 'Content-Type: application/json' \
--data-binary @snapshot.json \
"$ADMIN_URL/api/v1/admin/config"

Inspect audit history, rollout acknowledgements, worker state, and active requests with the same admin bearer token:

curl -fsS -H "Authorization: Bearer $ADMIN_TOKEN" "$ADMIN_URL/api/v1/admin/config/history"
curl -fsS -H "Authorization: Bearer $ADMIN_TOKEN" "$ADMIN_URL/api/v1/admin/rollouts"
curl -fsS -H "Authorization: Bearer $ADMIN_TOKEN" "$ADMIN_URL/api/v1/admin/workers"
curl -fsS -H "Authorization: Bearer $ADMIN_TOKEN" "$ADMIN_URL/api/v1/admin/requests"

Rollback and worker lifecycle actions are also compare-and-swap mutations. Refresh ETag after every successful mutation and use a new request if another operator changed the revision:

curl -fsS -X POST \
-H "Authorization: Bearer $ADMIN_TOKEN" \
-H "X-Straw-Actor: operator@example.com" \
-H "If-Match: $etag" \
-H 'Content-Type: application/json' \
-d '{"config_version":3}' \
"$ADMIN_URL/api/v1/admin/config/rollback"

curl -fsS -X POST \
-H "Authorization: Bearer $ADMIN_TOKEN" \
-H "X-Straw-Actor: operator@example.com" \
-H "If-Match: $etag" \
"$ADMIN_URL/api/v1/admin/workers/egress-1/drain"

Status and error mapping​

HTTP statusError or resultMeaning and next action
200record/list/rolloutThe read or mutation succeeded; mutation responses include a new quoted ETag.
204cancellationThe active request was cancelled; there is no response body.
401admin_auth_requiredThe admin token is missing or invalid.
400invalid_if_match, JSON decode error, unknown action, or store diagnosticFix the request or inspect the server diagnostic; no snapshot is activated.
404request_not_foundThe cancellation target is not active in the owned runtime state.
409revision_conflictRe-read the current config, merge deliberately, and retry with its ETag.
422invalid runtime snapshotFix the complete snapshot against Configuration; durable and published state is unchanged.
428if_match_requiredAdd the current ETag value as If-Match.
500backend/configuration diagnosticRepair the enabled JetStream/runtime-state dependency and retry only after checking whether the request committed.

If-Match accepts either the quoted ETag value or its numeric contents. A successful worker action can create a durable setting for a worker ID that is not currently registered; it still does not make that worker eligible until it registers and passes admission checks. GET /api/v1/admin/requests lists only request ID and deployment ID, so use the request client or logs for detailed request context.

See Configuration for the complete snapshot schema and Runtime administration for tested workflows.