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
{
"error": "insufficient_scope",
"detail": "This API key does not have the 'run' scope required for POST /api/run."
}erroris a short machine-readable code, usually in snake_case. Branch on the HTTP status and this code.detailis optional text for a developer. Its wording can change, so do not parse it.- Some errors add fields, for example
retryAfterSecon a rate limit orinvokedandbudgeton a budget refusal. - The MCP endpoint reports errors as JSON-RPC error objects instead. See MCP.
Errors any operation can return
| Status | Code | Cause | What to do |
|---|---|---|---|
| 401 | unauthenticated | No 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. |
| 403 | no_active_organization | A browser session with no workspace selected. API keys always carry their workspace. | Select a workspace in the web workspace. |
| 403 | capability_denied | The 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. |
| 403 | external_credential_not_supported | An external agent's key was used on a route other than the external agent operations. | Use a workspace API key. |
| 403 | insufficient_scope | The 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. |
| 403 | admin_required, full_session_required | Returned by individual operations that only a signed-in workspace admin or member may perform. | Perform the action in the web workspace. |
| 404 | not_found | No 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. |
| 405 | method_not_allowed | The path exists but does not support the HTTP method. The Allow header lists the methods it does support. | Fix the method. |
| 409 | revision_conflict | A protected change was decided against authorization state that has since changed. | Read the current state and decide again. Do not replay the request automatically. |
| 429 | rate_limited | Too many requests of one kind in the current window. The response carries Retry-After. | Wait, then retry. See Rate limits. |
| 500 | server_error | An unexpected failure. detail may carry a message. | Retry reads with backoff. For writes and runs, check the outcome first. |
| 503 | database_unavailable | Storage is temporarily unreachable or over its quota. detail gives a short description. | Retry with backoff. |
| 503 | server_error | A 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:
| Status | Code | Meaning |
|---|---|---|
| 200 | decision: "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. |
| 402 | over_budget | The workspace is over its monthly budget. Returned by model-calling operations other than agent runs, such as model comparisons. |
| 402 | spend_reservation_refused | The estimated cost of the request does not fit under a configured budget. |
| 409 | spend_reservation_refused | The budget state changed, conflicted or expired while the request was being admitted. |
| 503 | spend_reservation_refused | The budget state cannot be verified right now. |
| 503 | spend_state_unavailable | This month's spend cannot be verified. The platform refuses instead of assuming zero. |
| 503 | model_usage_request_identity_required | The 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. |
| 503 | model_usage_accounting_unavailable, model_usage_reconciliation_required | Usage accounting is unavailable, or an earlier attempt has an unknown outcome. invoked says whether the model provider may have been called. |
{
"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. 401and403are not retryable. Stop, fix the credential or the scope, and alert someone rather than loop.409means the state moved. Read it again before deciding what to send.429 rate_limitedtells you how long to wait inRetry-After. For other429codes see Rate limits.- On
5xx, retryGETrequests 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
errorcode and, when present, the receiptidanddecisionId. Keepdetailin logs; do not show it to end users.
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
fiNext steps
Something missing or unclear? Tell us and we will improve this page.