Skip to main content
Version: 0.7.x

HTTP API reference

The control plane exposes three API surfaces from one binary role-dependent service:

SurfaceBase pathAudience
Node API/A single ArkFlow node: local stream lifecycle, configuration, events, metrics.
Hub operator API/api/v1Fleet operators and the web console: jobs, nodes, rollouts, audit.
Hub agent API/api/v1/agent/*Compute nodes (Agents): registration, heartbeats, reports, command pull.

Health, readiness, and liveness probes (configurable paths) plus GET /metrics (Prometheus text format) are served on the node service. On the Hub, /metrics lives only under the versioned prefix (GET /api/v1/metrics) and requires operator authentication — the Hub's outer router serves just the health probes.

The Hub operator API is a desired-state API: a successful HTTP mutation means an Intent was durably accepted — it does not mean a node has executed the command or that a stream has converged. Poll the resource or subscribe to events to observe convergence.

Generated route inventory: 63 paths, 68 operations under the versioned prefix /api/v1, parsed from the router in crates/arkflow-server/src/api/mod.rs. The machine-readable form is docs/reference/openapi.json; pnpm docs:check fails when a route exists in one but not the other. Conditional OIDC login routes appear only when OIDC is configured.

PathMethodsPlane
/agent/commandsGEThub
/agent/commands/{id}/resultPOSThub
/agent/heartbeatPOSThub
/agent/job-observationsPOSThub
/agent/registerPOSThub
/agent/reportPOSThub
/ai/chatPOSThub
/auditGEThub
/auth/oidc/callbackGEThub
/auth/oidc/loginGEThub
/auth/oidc/logoutGEThub
/auth/oidc/statusGEThub
/componentsGETlocal + hub
/components/{kind}/{name}GETlocal + hub
/configGETlocal
/config-approvals/{id}GEThub
/config-approvals/{id}/decidePOSThub
/config/applyPOSTlocal
/config/rollback/{id}POSTlocal
/config/validatePOSTlocal
/config/versionsGETlocal
/configurationGETlocal
/configuration/applyPOSTlocal
/configuration/diffGETlocal
/configuration/rollback/{id}POSTlocal
/configuration/validatePOSTlocal
/configuration/versionsGETlocal
/eventsGETlocal + hub
/events/streamGEThub
/jobsGET POSThub
/jobs/{id}GEThub
/jobs/{id}/actions/{action}POSThub
/jobs/{id}/desired-statePUThub
/jobs/{id}/detailGEThub
/jobs/{id}/planGEThub
/jobs/{id}/statusGEThub
/jobs/{id}/upgradesPOSThub
/jobs/{id}/versionsGEThub
/jobs/validatePOSThub
/metricsGETlocal + hub
/nodeGETlocal
/nodesGETlocal + hub
/nodes/{node_id}/configurationGEThub
/nodes/{node_id}/drainPOSThub
/nodes/{node_id}/labelsPUThub
/nodes/{node_id}/streams/{id}GEThub
/operationsGETlocal + hub
/operations/{id}GET DELETElocal + hub
/operations/statusGEThub
/rolloutsGET POSThub
/rollouts/{id}GEThub
/rollouts/{id}/actionsPOSThub
/schemaGETlocal + hub
/statusGETlocal + hub
/streamsGETlocal + hub
/streams/{id}GETlocal
/streams/{id}/restartPOSTlocal
/streams/{id}/startPOSTlocal
/streams/{id}/stopPOSTlocal
/systemGETlocal + hub
/usersGET POSThub
/webhooksGET PUThub
/webhooks/{webhook_id}/testPOSThub

Conventions​

Principal echo​

GET /system on both the Hub plane and the local plane includes an optional principal object describing the principal authenticated for the current request:

{
"id": "ops",
"roles": ["operator"],
"actions": ["read", "operate", "configure", "manage_nodes", "manage_rollouts", "manage_webhooks"]
}

actions is derived from the same predicate that enforces mutations — the echo cannot claim an action the enforcing check would deny. Requests without valid credentials are rejected (401) before any identity is echoed; principal: null is a defensive shape for a response produced without a resolvable principal. The local standalone plane always echoes its single all-powerful operator as operator (admin). The field is additive: consumers that do not know it ignore it without behavior change. The manage_users action appears only for admin principals and gates the user and credential administration routes.

Resource model​

A stream has three independent views:

desired       operator target: state, generation, config_version
observed latest node report: state, generation, config_version
convergence comparison: unknown, pending, applying, in_sync, degraded, blocked

Operation records additionally expose intent_id, attempt_id, generation, retry metadata, failure classification, and the latest observed result.

Optimistic concurrency and idempotency​

Canonical lifecycle mutation:

PUT /api/v1/nodes/{node_id}/streams/{stream_id}/desired-state
Authorization: Bearer <operator-token>
Content-Type: application/json
If-Match: "generation-3"
Idempotency-Key: orders-desired-4
X-Correlation-ID: request-123

{"state":"running","config_version":"cfg-17"}

The Hub returns 202 Accepted with Location pointing to the operation and an ETag for the new generation:

{
"operation_id": "intent-4-17",
"intent_id": "intent-4-17",
"node_id": "node-a",
"stream_id": "orders",
"generation": 4,
"desired_state": "running",
"config_version": "cfg-17",
"convergence": "pending"
}
  • If-Match is a compare-and-swap guard: an old generation returns 412 with generation_conflict.
  • Idempotency-Key deduplicates retries for the same principal, resource, and request body; reusing a key with another body returns 409 with idempotency_key_reused.
  • A node being offline does not reject a desired-state write; the Intent is dispatched when the node reconnects.

Pagination​

Paginated collection endpoints (/nodes, /streams, /jobs, /rollouts, /config-approvals, /operations, /events, /audit) return:

{"items": [], "page": 1, "page_size": 50, "total": 0}

page_size is bounded to 100. The remaining collection endpoints (/users and /users/{id}/credentials) return plain arrays, and GET /webhooks wraps its list in {"subscriptions": [...]}. Operation listing supports node_id, resource_id, operation, state, and correlation_id filters. Use intent_id and generation as stable reconciliation references instead of assuming that a command ID represents final success.

Problem envelope​

Errors use a stable code, human-readable message, echoed correlation_id, and optional machine-readable details:

{
"code": "generation_conflict",
"message": "Expected generation 3, current generation 4",
"correlation_id": "request-123",
"details": {
"expected_generation": 3,
"current_generation": 4,
"resource": {"node_id": "node-a", "stream_id": "orders"}
}
}

Rate limiting​

Both control planes enforce a per-credential request rate limit over the versioned API; health probes, GET /metrics, and the OIDC login flow are exempt. Buckets are keyed on a truncated hash of the presented credential — static/structured operator credentials per credential, OIDC browser sessions per session, agent requests per node (the Authorization: Bearer header and the legacy session_token query parameter resolve to the same bucket). A request that exceeds its bucket is rejected before reaching any handler:

HTTP/1.1 429 Too Many Requests
Retry-After: 1
Content-Type: application/json

{"code":"rate_limited","message":"Control-plane request rate limit exceeded; retry after the indicated interval"}

Retry-After carries the whole-second refill estimate. Rejections create no audit events and no operation records, and are exported as the arkflow_control_plane_rate_limit_rejections_total{plane,key_kind} counter family (plane is local or hub; key_kind is principal, node, or catch_all — the shared bucket that absorbs traffic beyond the bounded bucket table). Configuration lives under health_check.rate_limit on the node plane (the control-API section is flattened into health_check) and the ARKFLOW_RATE_LIMIT_* environment variables on the Hub (see deployment). Defaults are enabled with limits far above legitimate traffic; enabled: false restores the unlimited behavior exactly.

Request timeout​

Both control planes also enforce a per-request timeout (30 seconds) on the versioned API and the health routes. A request whose handler does not respond within the bound is cut with the standard problem envelope:

HTTP/1.1 408 Request Timeout
Content-Type: application/json

{"code":"request_timeout","message":"request did not complete within 30000ms"}

The bound covers the handler phase only: a response that has started streaming (such as the SSE event stream) streams on without a server-side cut after its headers are produced. The HTTP/1 header-read phase on the listener predates request dispatch and is not bounded by the engine — deployments that require a header-read bound enforce it with a reverse proxy in front of the control plane.

Node API​

MethodRoutePurpose
GET/systemStatic system descriptor (node identity, capabilities).
GET/statusRuntime status of the node.
GET/nodesNode view (single-node deployment alias).
GET/nodeNode view (singular alias).
GET/streamsList streams with observed state.
GET/streams/{id}One stream's resource view.
POST/streams/{id}/startStart a stream.
POST/streams/{id}/stopStop a stream.
POST/streams/{id}/restartRestart a stream.
GET/operationsList operations (node_id, resource_id, operation, state, correlation_id filters).
GET/operations/{id}One operation record.
DELETE/operations/{id}Cancel a pending Intent.
GET/eventsQuery the local event log.
GET/configuration (/config)Current configuration.
POST/configuration/validate (/config/validate)Validate a configuration body.
GET/PUT/configuration/draftRead/save a working draft configuration.
GET/configuration/diffDiff draft against the live configuration.
GET/configuration/versions (/config/versions)Configuration version history.
POST/configuration/apply (/config/apply)Apply a configuration version.
POST/configuration/rollback/{id} (/config/rollback/{id})Roll back to a previous configuration version.
GET/componentsRegistered components.
GET/components/{kind}/{name}One component's schema and example.
GET/schemaEngine configuration JSON Schema.
GET/metricsPrometheus metrics.

Hub operator API (/api/v1)​

Jobs​

Jobs are managed with the same desired-state semantics as streams. A mutation returns the updated Job record: creation and pause/resume answer 202 Accepted, the other lifecycle mutations answer 200 OK. There is no separate operation record for a Job lifecycle mutation — observe the returned Job and its convergence. Mutation responses pass the record through the same credential redaction as the read endpoints, so a caller cannot read back the plaintext it just wrote. GET /jobs returns the records inside the standard pagination envelope (page/page_size/total, see Pagination).

MethodRoutePurpose
POST/jobsCreate a job: {"spec": ..., "desired_state": "stopped" | "running"}. Creation does not accept paused.
POST/jobs/validateDeep-validate a spec against the target node_ids before creating anything.
GET/jobsList jobs.
GET/jobs/{id} (/jobs/{id}/status)Observed job state.
GET/jobs/{id}/detailAssignment and convergence detail.
GET/jobs/{id}/versionsVersion history.
GET/jobs/{id}/planExplain the plan: operator boundaries, partition routes, stateful operators, checkpoint policy.
PUT/jobs/{id}/desired-stateLifecycle mutation: {"state": "running" | "stopped" | "paused"}. Applies a generation compare-and-swap internally; no If-Match / Idempotency-Key headers (see Job pause and resume).
GET/POST/jobs/{id}/checkpointsList recovery artifacts / trigger a barrier checkpoint.
GET/POST/jobs/{id}/savepointsList artifacts / trigger a savepoint.
POST/jobs/{id}/actions/pausePause a converged running Job: capture a recovery artifact, then stop it. 202 + Job record.
POST/jobs/{id}/actions/resumeResume a paused Job from the pause artifact (generation bump + recovery start). 202 + Job record.
POST/jobs/{id}/upgradesUpgrade to a new version (job must be stopped and converged).
GET/jobs/{id}/upgrades/{upgrade_id}Upgrade status: phase, savepoint, deadline, last error.
POST/jobs/{id}/upgrades/{upgrade_id}/actionsUpgrade actions: pause, resume, cancel, rollback.
POST/jobs/{id}/upgrades/{upgrade_id}/rollbackRoll back to a compatible savepoint.
POST/jobs/{id}/actions/{action}One-shot action: start, stop, restart, pause, or resume. restart is a generation bump that restores from the recovery artifact — not a stream-style restart. On a paused Job, start/restart mean resume and stop clears the pause bookkeeping.

Recommended submit flow: validate first, submit with desired_state: "stopped", inspect detail and plan, then switch to running. Recovery artifacts are bound to the job version and state format version; an incompatible artifact is rejected before restore instead of corrupting state.

Job pause and resume​

A Job pause is a durable quiesce: the Hub captures a recovery artifact at the pause generation (a checkpoint for recovery: latest_checkpoint, a savepoint for latest_savepoint; a Job whose spec has no checkpoint configuration stops directly), then stops the Job. The mutation answers 202 with the Job record, and the Job is not reported paused until every target assignment has been observed stopped.

POST /api/v1/jobs/{job_id}/actions/pause
POST /api/v1/jobs/{job_id}/actions/resume

PUT /api/v1/jobs/{job_id}/desired-state
{"state": "paused"}

desired_state has three values — running, stopped, and paused — but Job creation still accepts only running and stopped. On a paused Job, {"state": "running"} means resume and {"state": "stopped"} stops it and clears the pause bookkeeping. The desired-state route applies an internal generation compare-and-swap and returns the updated Job record (200); unlike the stream desired-state route above, it does not implement the If-Match / Idempotency-Key headers.

Job responses are additive: a Job that was never paused carries none of these fields. GET /jobs and GET /jobs/{id} return the Job record, and GET /jobs/{id}/detail nests it under job.

FieldTypeMeaning
pause_phasecapturing | stopping | paused | resumingDurable pause state-machine phase; absent when the Job is not paused.
pause_artifact_idstringRecovery artifact captured at the pause generation.
pause_prev_checkpoint_idstringRecovery pointer before the pause captured its artifact; restored if the capture aborts.
pause_retry_countintegerBounded capture re-dispatch counter (0 when none).
paused_at_msintegerWhen the pause was requested.
paused_bystringPrincipal id that requested the pause.

Convergence for a paused Job is phase-defined: it converges only when pause_phase is paused and every target assignment is observed stopped; capturing, stopping, and resuming report reconciling, and an offline node keeps the pause reconciling instead of falsely converging. Resume bumps the generation, keeps the recovery pointer on the pause artifact, and runs the ordinary recovery start; events processed between the artifact barrier and teardown completion are replayed (exactly-once for transactional sinks, at-least-once for non-transactional sinks), and a Job without checkpoint configuration resumes with a cold start. Atomic and stopped-mode upgrades are rejected while a pause phase is present, and pause/resume are rejected while an upgrade orchestration owns the Job (see Atomic job upgrades).

StatusCodeWhen
409job_not_runningPause requires desired and observed running and a converged Job.
409pause_in_progressA pause phase is already in flight, or resume arrived before the phase settled to paused.
409job_already_pausedPause requested for a Job already in the paused phase.
409pause_not_pausedResume (or a stop routed through the pause state machine) with no active pause phase.
409job_pausedUpgrade rejected because a pause phase is present.
409pause_requires_recovery_policyPause rejected because recovery: fail can never select a recovery artifact.
409pause_conflictA concurrent pause-state write won the phase compare-and-swap; retry.
409orchestration_in_progressPause or resume rejected while a non-terminal upgrade orchestration owns the Job.
503pause_requires_durable_storageThe Hub runs without durable storage and cannot persist a pause phase.

Rejections are audited (job.pause / job.resume, outcome rejected, with the failure code above) and counted in arkflow_job_pause_total{outcome="rejected"}; phase transitions emit job.pause_requested, job.paused, job.resume_requested, job.resumed, job.pause_retrying, and job.pause_failed on GET /events/stream. A capture failure or the capture deadline aborts the pause, restores the pre-pause recovery pointer, and records pause_savepoint_failed / pause_savepoint_timeout in the Job's last_error.

Nodes and streams​

MethodRoutePurpose
GET/systemHub system descriptor, including principal: {id, roles, actions} echoing the authenticated caller's identity and authorized actions (additive; see Principal echo).
GET/statusFleet-aggregated engine status: streams total/running/failed summed across registered nodes.
GET/nodesFleet node registry. Supports a label filter: ?label=env%3Dprod%2Ctier%3Dedge (comma-joined key=value terms, AND semantics).
GET/streamsStreams across the fleet.
GET/nodes/{node_id}/streams/{id}Authoritative point-in-time stream view on a node.
PUT/nodes/{node_id}/streams/{id}/desired-stateCanonical lifecycle mutation (see Conventions).
POST/nodes/{node_id}/streams/{id}/{action}Targeted one-shot command (start, stop, ...).
POST/nodes/{node_id}/streams/{id}/actions/restartRestart action; converges only after the Agent reports the matching action_id.
GET/nodes/{node_id}/configurationNode configuration view.
GET/nodes/{node_id}/configuration/versionsNode configuration history.
POST/nodes/{node_id}/configuration/validateValidate a configuration candidate against one node before applying.
GET/nodes/{node_id}/configuration/diffDiff two configuration versions on a node (from/to query parameters).
POST/nodes/{node_id}/configuration/applyApply configuration to one node.
POST/nodes/{node_id}/configuration/rollback/{version}Roll node configuration back.
POST/nodes/{node_id}/drainDrain a node (evacuate assignments before maintenance).
POST/DELETE/nodes/{node_id}/maintenanceEnter/exit maintenance mode.
PUT/nodes/{node_id}/labelsReplace the node's complete label map (see Node labels).
GET/POST/nodes/{node_id}/credentialsList metadata (arkn_ plaintexts/hashes omitted) or issue a new per-node credential ({label?, expires_at_ms?} -> 201 {credential, token}); requires ManageNodes scoped to node_id, max 8 active per node.
POST/node-credentials/{credential_id}/rotateRotate a per-node credential in place (200 {credential, token}), revoking the predecessor and immediately invalidating its active Agent session.
DELETE/node-credentials/{credential_id}Revoke a per-node credential (200 {"revoked": true|false}) and immediately invalidate any active Agent session authenticated with it.

Node labels​

PUT /nodes/{node_id}/labels takes {"labels": {"env": "prod", "tier": "edge"}} with full-replacement semantics: the submitted map becomes the node's complete label set. It requires the ManageNodes action (operator and admin roles); accepted replacements and denials are audited (node.labels).

  • Labels are Hub-managed: Agents never advertise labels, and re-registration or a Hub restart never changes them.
  • Bounds: at most 16 labels per node; keys and values are 1-63 characters, alphanumeric start and end, with -, _, . allowed inside. Violations are rejected with invalid_labels without partially applying.
  • Rollout targeting: POST /rollouts (and approval submission) accept target_selector — an equality map, mutually exclusive with node_ids. The Hub resolves it to an explicit node set once, at creation time (or submission time under the approval policy); an empty resolution is rejected with no_matching_nodes. Later label changes never re-target an existing rollout or a pending approval request. Matching reads the durable node records (cp_nodes), not the live registration map: a node that has not re-registered since a Hub restart still resolves, and unreachable nodes stay selectable — the rollout health gates handle delivery.

The legacy un-targeted stream mutation routes remain as adapters that create the same durable Intent pipeline.

Operations, events, audit​

MethodRoutePurpose
GET/operationsList operations fleet-wide.
GET/operations/{id}One operation record.
DELETE/operations/{id}Cancel a pending Intent (never an executed side effect).
GET/operations/statusOperational status summary for dashboards.
GET/eventsQuery the fleet event log.
GET/events/streamServer-Sent Events stream of live events.
GET/auditBounded audit history; requires ReadAudit. Filters: resource_id, actor, action, from_ms, to_ms, plus pagination.
GET/PUT/webhooksList / full-replace the webhook alerting subscription set (see Webhook alerting).
POST/webhooks/{id}/testOne synchronous test delivery of a synthetic webhook.test event.

Webhook alerting​

GET/PUT /webhooks manage the webhook subscription set with full-replace semantics (at most 16 entries). Both routes (and POST /webhooks/{id}/test) require the ManageWebhooks action — admin and operator roles — and every accepted replacement or denial is audited (webhook.replace). Each entry carries id, url (http/https only), event_types (prefix filters), enabled, created_by, created_at_ms, and an optional write-only secret (exposed in responses only as a boolean has_secret): responses never echo the secret itself, an omitted secret retains the stored one for the same id, and an explicitly empty string clears it.

Delivery is best-effort (leader-only forwarding, bounded drop-oldest queues, 3 attempts with backoff, auto-pause after 5 consecutive failed deliveries publishing webhook.paused/webhook.resumed lifecycle events). Signed deliveries carry X-Arkflow-Signature (hex HMAC-SHA256 of the body). See Webhook alerting for the full contract.

DELETE /operations/{intent_id} cancels an Intent, not an already executed side effect: pending work is suppressed before dispatch; after dispatch, the Attempt outcome remains visible.

Audit records carry actor, target resource, node, correlation ID, outcome (accepted/rejected), and a stable failure code (node_unavailable, capacity, incompatible_capability, expired). Messages contain scalar operation metadata only — never credentials or job configuration bodies. GET /audit requires ReadAudit (admin or viewer) and the audit scope for the requested resource_id; an unfiltered request requires collection-wide audit access. The operator role returns 403. Optional actor and action are exact matches; from_ms and to_ms are inclusive Unix-millisecond bounds. All supplied filters are combined in storage before the 1024-record response window and pagination; total counts matches within that window. from_ms > to_ms returns 400 invalid_audit_query.

Users and credentials​

The Hub serves a managed user directory in Hub mode when it has durable storage. Every route below requires the manage_users action — held by admin only — and answers 401 without a valid credential and 403 for everyone else. On a volatile Hub (no ARKFLOW_HUB_STORAGE) the whole group answers 503 identity_store_unavailable.

MethodRoutePurpose
GET/usersList users (plain array).
POST/usersCreate a user: {user_id, display_name?, role, scopes?, oidc_subject?} → 201 User.
GET/users/{id}One user (404 user_not_found when absent).
PATCH/users/{id}Partial update: display_name, role, scopes, disabled, oidc_subject (an empty string clears the OIDC binding).
DELETE/users/{id}204; cascades the user's credentials and browser sessions.
GET/users/{id}/credentialsCredential metadata only (plain array) — never the token or hash. 404 user_not_found when the user does not exist.
POST/users/{id}/credentialsIssue: {label?, expires_at_ms?} → 201 {credential, token}; the plaintext token is returned only here.
POST/credentials/{id}/rotate200 {credential, token}; the old credential is revoked in the same storage mutation.
DELETE/credentials/{id}Idempotent revoke → 200 {"revoked": true|false}.
POST/users/{id}/revoke-tokens200 {revoked_sessions}; raises the user's JWT revocation threshold and deletes their browser sessions.

A user record:

{
"user_id": "alice",
"display_name": "Alice",
"role": "admin",
"scopes": [{"resource_type": "node", "resource_id": "node-a"}],
"disabled": false,
"oidc_subject": "00u1abc",
"tokens_valid_after_ms": 0,
"created_at_ms": 1767225600000,
"updated_at_ms": 1767225600000
}

role is one of admin, operator, viewer (one role per user); scopes narrow it with the same {resource_type, resource_id?} grammar used by static credentials. User ids are 1–64 characters of [a-z0-9._-] starting with a lowercase letter or digit. The directory holds at most 1024 users and at most 16 active credentials per user, and an oidc_subject can be bound to only one user.

A credential view and an issuance response:

{"credential_id":"3f6a1c9e2b7d4a80","label":"alice-laptop","created_at_ms":1767225600000,"expires_at_ms":null,"last_used_at_ms":null,"revoked_at_ms":null}
{"credential":{"credential_id":"3f6a1c9e2b7d4a80","label":"alice-laptop","created_at_ms":1767225600000,"expires_at_ms":null,"last_used_at_ms":null,"revoked_at_ms":null},"token":"ark_3f6a1c9e2b7d4a80_<secret>"}

Use the issued token as Authorization: Bearer <token>. The Hub stores only SHA-256(credential_id ‖ 0x00 ‖ secret) and cannot display the plaintext again; last_used_at_ms is null on this release (usage timestamps are reserved in the shape but not yet recorded). Revocation takes effect on the credential's next request. tokens_valid_after_ms is the JWT revocation threshold: federated tokens for a bound subject with an older iat are rejected (60-second clock-skew tolerance).

Behavioral invariants:

  • The credentials resolve in this order: static operator credential → managed ark_ credential → browser session → OIDC JWT. A managed token that fails any check is a hard 401 and never falls back to OIDC; identity storage errors deny the request.
  • Disabling, deleting, or revoke-tokens on a user invalidates their sessions immediately. revoke-tokens does not revoke managed credentials — revoke or rotate them individually.
  • The last enabled admin cannot be disabled, deleted, or demoted (409 last_admin_required) unless a static operator credential is configured as break-glass.
  • Accepted and rejected identity mutations are audited as user.create, user.update, user.delete, user.revoke_tokens, credential.create, credential.rotate, and credential.revoke, with scalar metadata only. A rejection writes the same action with outcome=rejected, the real actor, and the stable problem code as failure_code (for example last_admin_required, user_already_exists, credential_limit, user_not_found). Standalone audit persistence failures against a configured durable store increment arkflow_audit_write_failures_total{category} on /metrics and emit a warning log rather than failing silently.
StatusCodeWhen
400invalid_userMalformed user id, unknown role, oversized name/label, unparsable scopes, or an empty PATCH.
400invalid_credentialRotating an already-revoked credential.
403forbiddenAuthenticated principal without manage_users.
404user_not_found / credential_not_foundUnknown user or credential — including a credentials listing for a user that does not exist.
409user_already_existsCreating a user whose user_id already exists.
409last_admin_requiredThe last enabled admin would be disabled, deleted, or demoted with no static break-glass credential.
409user_limit / credential_limit1024 users exist / the user has 16 active credentials.
409oidc_subject_conflictThe OIDC subject is already bound to another user.
503identity_store_unavailableThe Hub has no durable storage.

See Users and credentials for the operational lifecycle.

Rollouts​

MethodRoutePurpose
GET/POST/rolloutsList rollouts / create a rollout plan. Target selection is node_ids or target_selector (label equality map resolved once at creation; see Node labels).
GET/rollouts/{id}Rollout state and per-node progress.
POST/rollouts/{id}/actionsRollout actions: pause, resume, cancel, rollback.

When control_api.approval_required is enabled on the Hub, the creation routes (POST /rollouts and the node-level apply/rollback routes) reject direct creation with an approval_required problem and publishing goes through approval requests instead:

MethodRoutePurpose
GET/POST/config-approvalsList approval requests (?status=pending|approving|approved|rejected|expired) / submit one pinning a version, targets, and batch size. Accepts target_selector like POST /rollouts; the request pins the selector resolved to its explicit node set at submission time.
GET/config-approvals/{id}One approval request and its pinned snapshot.
POST/config-approvals/{id}/decideApprove or reject ({"decision":"approve"|"reject","note":"..."}). Requires the ApproveRollouts permission (admin role only) and a principal different from the requester.

Approval creates the rollout with the approver as actor; a rollback is exempt only when its target version was previously applied to the affected nodes. Segregation enforces two-principal four-eyes review rather than anti-collusion against a malicious admin holding ManageUsers.

See Reconciliation rollout and recovery for the state machine and threat model behind these routes.

Login sessions (OIDC)​

When the Hub is configured with an OIDC provider (see deployment), the operator API also serves a browser login flow:

MethodRoutePurpose
GET/auth/oidc/statusPublic probe reporting login_enabled, authenticated, and the current principal.
GET/auth/oidc/loginRedirect to the identity provider (PKCE S256 and nonce bound to an HttpOnly cookie).
GET/auth/oidc/callbackExchange the code for an id_token and create the server-side session.
GET/auth/oidc/logoutDelete the server-side session and clear the cookie.

With durable storage the session is persisted (cp_sessions, schema v6): it survives a Hub restart and is invalidated by logout, by disabling/deleting the user, or by POST /users/{id}/revoke-tokens. Backup and restore exclude cp_sessions deliberately, so a restored Hub never resurrects logins. On a volatile Hub the session lives in memory and a restart signs everyone out.

Discovery and metrics​

MethodRoutePurpose
GET/componentsRegistered components across the fleet image.
GET/components/{kind}/{name}One component's schema and example.
GET/schemaEngine configuration JSON Schema.
GET/metricsPrometheus text exposition by default; ?format=json (or an Accept: application/json request) returns {"items": ..., "aggregate": ...} — per-node metrics plus the fleet aggregate, optionally narrowed with ?node_id=.

Beyond readiness, reconciliation, outbox, and fleet-state gauges, command dispatch exposes arkflow_command_duration_bucket{command,le} (enqueue-to- acknowledgement latency with _count/_sum companions) and arkflow_command_total{command,outcome}. Labels come from fixed vocabularies — command types (job_start, job_stop, job_checkpoint, job_savepoint, stream actions) and outcome classes (enqueued, acknowledged, succeeded, failed, cancelled, superseded, timed_out, node_unavailable, capacity, rejected); unknown command names collapse into other, and resource IDs, correlation IDs, and error text never become labels. Counters reset on Hub restart.

AI Copilot (POST /api/v1/ai/chat)​

When ai.enabled is configured on the Hub (see CLI reference), GET /api/v1/system advertises "ai_copilot" in capabilities (without disclosing api_key or api_base) and mounts the Hub-only SSE orchestration route:

MethodRoutePurpose
POST/ai/chatStateless multi-turn chat (messages, optional context) streaming text/event-stream SSE events (tool_start, tool_result, delta, proposal, done, error).

Behavior and safety boundaries:

  • Read-only & validation-only tools: internal tools inspect component schemas, fleet nodes, redacted configurations/jobs, events, metrics, and audit logs strictly scoped by the caller's OperatorPrincipal::can_scope. Authoring and validation proposals (stream_config, job_spec) require Configure and are validated on the server (parse_and_validate / deep_validate_job) before a proposal event is emitted; audit queries require ReadAudit. No tool mutates Hub state.
  • Secret redaction & zero data-plane exposure: literal credentials and URL userinfo passwords are masked as ****** while unexpanded ${secret:...} / ${env:...} placeholders may stay visible; data-plane MessageBatch payloads are never read.
  • Rate limiting & metadata audit: enforced per principal (ai.requests_per_minute / ai.burst, returning 429 ai_rate_limit_exceeded + Retry-After). Each completed or failed call records a metadata-only entry (ai.copilot.chat with model, tool names, token usage, and outcome) in cp_audit_events without storing user prompt text or assistant replies.

Hub agent API (/api/v1/agent/*)​

The Agent contract is separate from the operator contract: agents authenticate with node session credentials (and client certificates when Hub mTLS is configured), pull commands, and push observations.

MethodRoutePurpose
POST/agent/registerRegister a node; establishes a session. Accepts a per-node arkn_<credential_id>_<secret> token (strictly bound to node_id) or, on first enrollment, the shared bootstrap node_token — returning node_credential once in RegisterResponse. Declares node capabilities (e.g. network_shuffle) and data_address.
POST/agent/heartbeatHeartbeat with lease renewal; re-asserts capabilities and data address.
POST/agent/reportObserved stream/node state; carries boot_id and monotonic report_seq.
POST/agent/job-observationsReport job-level observations from the co-located kernel runtime.
GET/agent/commandsPull pending commands.
POST/agent/commands/{id}/resultReport a command result.

Security invariants:

  • When ARKFLOW_HUB_TLS_CA is set with ARKFLOW_HUB_TLS_CLIENT_AUTH=agent_required (default) or required, every /api/v1/agent/* call requires a CA-verified client certificate. If the peer leaf carries URI:urn:arkflow:node:<node_id>, calls fail closed (401) unless <node_id> matches the request/session node.
  • Node authentication, credential lifecycle (node_credential.{create,enroll,rotate,revoke}), agent.register, agent.auth_rejected, and terminal agent.command_result deliveries emit "node" audit records attributed to node:<node_id> (or the acting operator), without ever logging tokens or hashes.

Commands carry generation, Attempt ID, configuration version, and expiry. A job_start for a split placement additionally carries the full task_nodes map, node_data_ports, and edge_secrets filtered exclusively to edges where src == node_id || dst == node_id, so every node can derive its remote edges and per-edge HMAC keys without extra lookups; the Hub only dispatches such placements to nodes that advertised the network_shuffle capability and a data address. Command acknowledgement is transport state only — convergence is always derived from reports, never from acks.