Skip to content

Errors

All errors follow a consistent JSON shape:

{
"error": {
"code": "snake_case_error_code",
"message": "Human-readable description.",
"details": {}
}
}

The details object is present only on validation errors and contains field-level information.


HTTP Status Codes

HTTPMeaningRetry?
400Validation error or bad request bodyFix the request — do not retry
401Missing or invalid API key / JWTRe-authenticate, then retry
402Insufficient creditsShow buy-credits prompt
403Valid credentials, missing permission or scopeCheck key scopes or agent api_enabled
404Resource not foundDo not retry
409Conflict — duplicate idempotency key or wrong execution stateUse a new idempotency key
422Semantic validation failure (agent config invalid, schema mismatch)Fix the request
429Rate limit exceededBack off using Retry-After header
500Internal server errorRetry with exponential backoff. Credits auto-refunded.

Common Error Codes

CodeHTTPCause
unauthorized401JWT expired or invalid API key
forbidden403Agent api_enabled is off, or key lacks the required scope
payment_required402Credit balance depleted
rate_limit_requests_exceeded429Request rate limit hit
rate_limit_tokens_exceeded429Token rate limit hit
agent_not_found404Agent ID does not exist or is not published
workspace_not_found404Workspace ID invalid or not found
message_required400Agent requires a message but none was sent
external_auth_not_enabled403Token exchange disabled for this workspace
execution_not_resumable409Execution is not in a paused state
idempotency_conflict409Idempotency key already used
token_limit_exceeded402Execution hit the token budget cap
cost_limit_exceeded402Execution hit the cost budget cap
external_service_error500LLM provider returned an error

Handling 429 Responses

Always check the Retry-After header before retrying:

HTTP/1.1 429 Too Many Requests
Retry-After: 12
{
"error": {
"code": "rate_limit_requests_exceeded",
"message": "Rate limit exceeded. Retry after 12 seconds."
}
}

See Rate Limits for per-agent and per-workspace limit values.


Handling 401 Responses

A 401 on an eak_ key means the key has expired. Re-authenticate:

  1. Call POST /auth/external/{workspace_id} with a fresh provider JWT.
  2. Store the new eak_ key and expires_at.
  3. Retry the failed request.

Execution Failures and Credits

When an execution fails after credits are pre-deducted:

  • Pre-deducted credits are automatically refunded.
  • The error SSE event carries the failure reason.
  • The execution record’s status is set to Failed.

There is no need to request a manual refund for execution errors.