Skip to content
Documentation menu

Errors

The error body, the status and error codes shared by all operations, budget refusals, and how a client should react to each.

Errors use conventional HTTP status codes and a small JSON body with a machine-readable code, so a client can handle the common cases once. This page lists the codes that any operation can return. Codes that belong to a single operation are listed with that operation in the reference.

The error body

JSON
{
  "error": "insufficient_scope",
  "detail": "This API key does not have the 'run' scope required for POST /api/run."
}
  • error is a short machine-readable code, usually in snake_case. Branch on the HTTP status and this code.
  • detail is optional text for a developer. Its wording can change, so do not parse it.
  • Some errors add fields, for example retryAfterSec on a rate limit or invoked and budget on a budget refusal.
  • The MCP endpoint reports errors as JSON-RPC error objects instead. See MCP.

Errors any operation can return

StatusCodeCauseWhat to do
401unauthenticatedNo Authorization header, an unknown, revoked or expired key, or a key whose creating admin could not be confirmed as an active member of the workspace.Do not retry in a loop. Check the header, and check in Settings that the key is still listed, before you create a new one.
403no_active_organizationA browser session with no workspace selected. API keys always carry their workspace.Select a workspace in the web workspace.
403capability_deniedThe operation is reserved for a signed-in person, or the person behind the credential (for a key, the admin who created it) has the Business Owner access profile, which does not include the operation.Perform the action in the web workspace, or have a workspace admin create a new key. See Availability.
403external_credential_not_supportedAn external agent's key was used on a route other than the external agent operations.Use a workspace API key.
403insufficient_scopeThe key lacks the scope the operation needs. detail names the scope, the method and the path.Use a key that has the scope. See Authentication.
403admin_required, full_session_requiredReturned by individual operations that only a signed-in workspace admin or member may perform.Perform the action in the web workspace.
404not_foundNo such resource in this workspace. A resource in another workspace looks the same as a missing one.Check the id and that the key belongs to the right workspace.
405method_not_allowedThe path exists but does not support the HTTP method. The Allow header lists the methods it does support.Fix the method.
409revision_conflictA protected change was decided against authorization state that has since changed.Read the current state and decide again. Do not replay the request automatically.
429rate_limitedToo many requests of one kind in the current window. The response carries Retry-After.Wait, then retry. See Rate limits.
500server_errorAn unexpected failure. detail may carry a message.Retry reads with backoff. For writes and runs, check the outcome first.
503database_unavailableStorage is temporarily unreachable or over its quota. detail gives a short description.Retry with backoff.
503server_errorA service the operation depends on is not configured or not available.Retry later.

Operations that start a run add their own launch errors. The ones a new integration meets first are 426 agent_protocol_required, when an agent under managed activation is run without the X-CoA-Agent-Protocol header, 428 agent_launch_required, when the X-CoA-Agent-Ticket header is missing, and 409 agent_admission_unavailable, when the agent has no active version or the ticket has expired or does not match the request. Runs lists them all.

Budget and accounting refusals

Operations that call a model check the workspace's budgets before the model is called. A workspace admin sets budgets under Settings → Budgets. Budget checks work from cost estimates and the spend the platform has recorded, and complete model-spend accounting is still in progress, so treat a budget as a control on new work and not as a guarantee about your model provider's invoice. A refusal takes one of these forms, and most of them carry invoked to say whether the model provider was reached:

StatusCodeMeaning
200decision: "deny" with reasonCode: "SPEND_OVER_BUDGET"An agent run would exceed the workspace's monthly budget or the budget for its authority level, or a configured budget could not be verified. A receipt records the refusal.
402over_budgetThe workspace is over its monthly budget. Returned by model-calling operations other than agent runs, such as model comparisons.
402spend_reservation_refusedThe estimated cost of the request does not fit under a configured budget.
409spend_reservation_refusedThe budget state changed, conflicted or expired while the request was being admitted.
503spend_reservation_refusedThe budget state cannot be verified right now.
503spend_state_unavailableThis month's spend cannot be verified. The platform refuses instead of assuming zero.
503model_usage_request_identity_requiredThe request has no X-CoA-Model-Request header and usage accounting requires one; a conversation turn answers the same for a malformed value. The model was not called. Send the header and repeat the request. For an activated agent, request a new launch ticket first: the refused request used its own.
503model_usage_accounting_unavailable, model_usage_reconciliation_requiredUsage accounting is unavailable, or an earlier attempt has an unknown outcome. invoked says whether the model provider may have been called.
402 Payment Required
{
  "error": "spend_reservation_refused",
  "invoked": false,
  "decisionId": "c5d8e2f1-6a47-4b39-9e10-2d4f6a8b0c13",
  "budget": {
    "allowed": false,
    "reason": "cap_exceeded",
    "scope": "tenant",
    "estimate": 0.3,
    "spendEnforced": false,
    "actualDollarBound": false
  },
  "detail": "Budget estimate admission refused. Reconcile the existing operation; never automatically repeat paid work."
}

budget carries the evidence that could be verified. Its fields vary: the example shows a subset, some can be missing and others, such as the budget amount and the spend counted against it, can be present. Branch on the status, error and invoked, and keep budget for diagnosis. decisionId can be null. On a streaming operation the same body arrives as an error event when the refusal happens after the stream has opened.

Handling errors in a client

  • Branch on the HTTP status first, then on error. Handle a code you do not know by its status class.
  • 401 and 403 are not retryable. Stop, fix the credential or the scope, and alert someone rather than loop.
  • 409 means the state moved. Read it again before deciding what to send.
  • 429 rate_limited tells you how long to wait in Retry-After. For other 429 codes see Rate limits.
  • On 5xx, retry GET requests with exponential backoff and jitter. For writes and runs, confirm what happened before repeating: the receipt list is the durable record of runs.
  • Log the status, the error code and, when present, the receipt id and decisionId. Keep detail in logs; do not show it to end users.
Capture the status and the error code
http_status=$(curl -s -o response.json -w "%{http_code}" \
  https://centerofagentic.com/api/agents \
  -H "Authorization: Bearer $COA_API_KEY")

if [ "$http_status" != "200" ]; then
  echo "Request failed with $http_status: $(jq -r .error response.json)" >&2
fi

Next steps

Something missing or unclear? Tell us and we will improve this page.