Skip to content

API Errors ​

SandBase uses standard HTTP status codes, but it does not expose one universal error body. Branch on the HTTP status first, then parse the response schema documented for the endpoint you called. Do not require every error to contain code, param, message, or request_id.

Response shapes ​

Core middleware and several /v1/* endpoints return a flat error:

json
{"error":"organization rate limit exceeded"}

Agents platform resources (/v1/agents*, /v1/mcp-connections*, /v1/secrets*, /v1/skills*) return an OpenAI-style object with a stable code. See Agents platform errors:

json
{"error":{"type":"invalid_request_error","code":"invalid_request","param":null,"message":"invalid request"}}

The webhook Events API (/events/webhooks*) returns {"code":<http status>,"message":"..."}. See Webhooks.

OpenAI-compatible endpoints retain an OpenAI-compatible envelope. POST /v1/messages retains an Anthropic-compatible envelope:

json
{
  "type": "error",
  "error": {
    "type": "invalid_request_error",
    "message": "max_tokens is required"
  }
}

Use the OpenAPI specification for the exact status codes and schemas of a public operation.

HTTP status handling ​

StatusTypical meaningClient action
400Invalid input or unsupported parameterFix the request using the endpoint and selected model schema.
401Missing, invalid, revoked, or expired credentialReplace or rotate the credential; do not retry unchanged.
402The request cannot be funded or a spending limit was reachedResolve the balance or key limit before retrying.
403The credential lacks permission, or a compatibility endpoint maps a spending failure to 403Inspect the endpoint-specific envelope and use an authorized key.
404Model or resource is unavailable to the callerVerify the current model ID or resource ID.
409Resource state conflictRead the latest state before deciding whether a retry is safe.
422Semantically invalid resource inputCorrect the documented field values.
429Organization request limit or video concurrency limitRetry with bounded backoff and jitter when the operation is safe to repeat.
500, 502, 503, 504SandBase or upstream failureRetry only when the operation is safe to repeat.

Not every endpoint documents every status in this table. The operation's OpenAPI response map is authoritative.

Authentication errors ​

Documented authentication messages include:

  • missing API key in Authorization header
  • invalid API key
  • API key has been revoked
  • API key has expired

A scoped key used outside its scope returns 403 with a nested body instead: {"error":{"code":"insufficient_scope","message":"API key is not authorized for this endpoint","request_id":"..."}}. Agents platform resources return the same code in their own envelope.

Use Authorization: Bearer $SANDBASE_API_KEY for standard endpoints. POST /v1/messages also accepts x-api-key; protocol-compatible Google endpoints document their own supported key headers.

A revoked key cannot be re-enabled. Create a replacement, update the consuming application, verify it, and then remove any remaining references to the old key.

Rate limits ​

organization rate limit exceeded (429) means your organization reached its assigned requests-per-minute limit, which all of its API keys share. Protocol-compatible endpoints return it in their own envelope. SandBase does not publish one universal numeric limit because the limit is assigned per organization.

If a response includes Retry-After, respect it. Otherwise use bounded exponential backoff with jitter. See Rate limits for request-smoothing patterns.

Task submissions have two additional checks. organization concurrency limit exceeded (429) means your organization already has as many tasks in progress as its account level allows; it clears when a running task finishes. It applies to every model type on POST /v1/run and /v1/api/*, and to video submissions on other endpoints. insufficient credit for estimated video cost (402) means the estimated cost is more than your balance plus credit line; top up before retrying. See Concurrency limits.

Retry safety ​

Use this decision order:

  1. Determine whether the operation has already produced an externally visible effect.
  2. Do not retry an unchanged 400, 401, 402, 403, 404, or 422 request.
  3. For 409, read the current resource state before retrying.
  4. Retry 429 and transient 5xx responses only a small, bounded number of times.
  5. Before repeating a create, trigger, upload, or external-action request, confirm that the operation is idempotent or that your application can reconcile duplicates.

A suitable delay is:

text
delay = min(base_delay * 2^attempt, max_delay) + random_jitter

Agents platform errors ​

Agents, Sessions, Skills, MCP connections, and Secrets return one envelope. For most codes, message is a fixed, safe sentence; invalid_request may carry a short explanation, such as which input shape or option is not supported. Branch on code, not on message.

json
{"error":{"type":"invalid_request_error","code":"conflict","param":null,"message":"conflicting request"}}

type is authentication_error for 401, server_error for 5xx, and invalid_request_error otherwise.

HTTPcodeMeaningWhat to do
400invalid_requestMalformed or unknown fields, failed validation, or an unsupported optionFix the request; do not retry unchanged
400skill_not_foundA referenced Skill or version is not availableFix the Agent's skills
401unauthorizedMissing, invalid, or conflicting API key headersCheck Authorization / X-API-Key
402spending_limit_exceededKey spending limit or organization balance exhaustedAdd credits or raise the limit
403insufficient_scopeThe key is scoped and cannot use Agents resourcesUse a standard Console-created key
403org_disabledThe organization is not permitted to run AgentsContact support
404not_foundThe resource does not exist in your organizationCheck the ID
409conflictStale row_version, a state that does not allow the change, or an Idempotency-Key reused with a different bodyRead the resource again, then decide
409session_input_pendingEarlier input is still being deliveredWait; do not resend with a new key
409session_input_expiredInput admission expiredInspect history before sending again
409session_environment_unavailableThe execution environment is unavailableWait or create a new Session
413request_too_largeThe request body, or the Session configuration frozen from it, exceeds the size limitSend a smaller body; do not retry unchanged
429quota_exceededAgents quota exceededRetry later
502executor_rejected, executor_contract_errorThe execution layer rejected the request or answered unexpectedlyCheck the Agent configuration, then retry
503executor_unavailable, storage_unavailable, skill_unavailable, tenant_unavailable, tenant_provisioning_failed, authorization_unavailable, admission_unavailable, internal_errorA dependency is temporarily unavailableRetry with backoff and the same Idempotency-Key

skill_runtime_incompatible can also appear; it is returned as 503 with the message internal error.

Streaming failures ​

After a stream starts, an error may arrive in that protocol's stream format instead of as a new HTTP response. Treat the stream as incomplete, retain any partial output your application needs, and retry only when regenerating the request is safe. Do not assume every provider emits the same terminal event or finish reason.

Operational debugging ​

Record the endpoint, HTTP status, selected model or resource ID, timestamp, and any safe request identifier returned by the server. Never log authorization headers, API keys, credential values, or sensitive prompt content.

Use Developer → Activities to inspect organization request history. When reporting a persistent failure, include sanitized request metadata and the smallest reproducible request.

See also ​