Skip to content

Auth and Error Model

User bearer auth (Authorization: Bearer <user_access_or_privy_token>)

Section titled “User bearer auth (Authorization: Bearer <user_access_or_privy_token>)”

Required for protected user routes:

  • /api/agents/*
  • /api/users/*
  • /api/billing/summary
  • /api/billing/usage-summary
  • /api/billing/checkout
  • /api/billing/credits/checkout
  • /api/billing/portal
  • /api/billing/sync
  • /api/billing/runtime-requests
  • /api/billing/runtime-requests/:id
  • /api/billing/runtime-requests/:id/approve
  • /api/billing/runtime-requests/:id/deny
  • /api/billing/runtime-spend-policies/:controllerAgentId
  • /api/runtime/identities
  • /api/runtime/delegations
  • /api/runtime/delegations/:id
  • /api/auth/device/approve

Runtime bearer auth (Authorization: Bearer <runtime_access_token>)

Section titled “Runtime bearer auth (Authorization: Bearer <runtime_access_token>)”

Required for runtime-principal routes:

  • /api/runtime/auth/status
  • /api/runtime/updates/manifest
  • /api/runtime/updates/scripts
  • /api/runtime/updates/check
  • /api/runtime/updates/apply
  • /api/runtime/updates/report
  • /api/runtime/agents/:id/start
  • /api/runtime/agents/:id/stop
  • /api/runtime/agents/:id/status
  • /api/runtime/billing/requests
  • /api/runtime/billing/requests/:id
  • /api/runtime/self/spend-policy

Required for managed gateway routes. Credential may be passed as:

  • Authorization: Bearer <gateway_token>
  • x-api-key: <gateway_token>

Applies to:

  • /api/gateway/llm/v1/chat/completions
  • /api/gateway/llm/v1/responses
  • /api/gateway/search/v1/web/search
  • /api/gateway/search/v1/news/search

For /api/webhooks/usage, signature may be required depending on deployment config:

  • Header: x-roberto-signature
  • Optional prefix accepted: sha256=<hex>

User token lifecycle:

  • POST /api/auth/device/start
  • POST /api/auth/device/poll
  • POST /api/auth/refresh
  • POST /api/auth/logout

Runtime token lifecycle:

  • POST /api/runtime/bootstrap/exchange
  • POST /api/runtime/auth/refresh
  • POST /api/runtime/auth/revoke
  • GET /api/runtime/auth/status (runtime bearer token required)

Most non-success responses use:

{ "error": "message" }

Some endpoints add fields, for example device poll rate limiting:

{
"error": "slow_down",
"retryAfterSeconds": 12
}
StatusMeaningTypical causes
400Invalid request payload/paramsMissing required fields, invalid JSON, invalid query parameters
401Auth failedMissing or invalid bearer token, invalid gateway token, missing webhook signature
402Billing restrictionGateway access blocked by entitlement/billing state
404Resource or token not foundUnknown agent/runtime/user code/session
429Rate limitedDevice poll flow or webhook ingest limits
500Server config/runtime faultMissing DB/auth secrets, unhandled server-side error
503Dependency unavailableManaged provider/config not available
  • Authenticated CLI/MCP user calls typically retry once after refreshing tokens on 401.
  • POST /api/auth/logout is effectively idempotent for refresh-token revocation.
  • /api/webhooks/usage supports idempotency with x-idempotency-key.
  • /api/runtime/updates/apply requires both approved=true and a valid one-time grant token.
  • Runtime bearer endpoints enforce live runtime identity state; revoked identities are rejected immediately.