96Astro API

Documentation

Errors

The error format, every error code with its HTTP status, and what your code should do for each: retry, fix the request or stop.

Errors use standard HTTP status codes and one JSON shape:

{
  "error": {
    "code": "invalid_request",
    "message": "Input should be less than or equal to 90",
    "field": "latitude",
    "request_id": "req_6e985a89a166b73ea220",
    "retryable": false
  }
}

Program against code, which is stable. message is for people and may change. field names the input at fault, or is null when no single field is. A few errors carry extra fields beside these (choices, supported, maintenance).

StatusCodesWhat to do
400invalid_requestThe body is not valid JSON, the Idempotency-Key is too long, or the key was sent in the URL. Fix the request
401invalid_key, expired_keyCheck or rotate the key. Do not retry in a loop
402payment_requiredYour plan's payment is overdue past its grace period. Pay it in the dashboard; sandbox keys keep working
403account_suspendedThe account is not active. Contact support
403plan_upgrade_requiredThe plan does not include AI readings or PDF and audio jobs on live keys. Choose a plan that does; sandbox keys can still test them
403plan_family_not_includedThe capability is outside your plan. The error names the family and the cheapest plans that have it. Not charged; sandbox keys can still test it
403key_scope_deniedThe capability is outside the key's scopes. Widen the scopes in the dashboard or use another key
403ip_not_allowedThe request did not come from the key's IP allow-list. Call from an allowed address or edit the list
403origin_not_allowedA publishable key was used from a website (or without a browser origin) that the key does not allow
403publishable_key_not_allowedPublishable keys cannot create PDF or audio jobs, poll jobs or use conversations. Use a secret key from your server
404not_foundThere is no such capability, job or file, or it is not yours
406not_acceptableYou sent Accept: text/event-stream to a capability that does not stream. Remove the header
409idempotency_conflictSee below
409conversation_fullA conversation holds at most 200 messages. Start a new one
410link_expiredA download link has expired. Poll the job for a fresh link
410file_expiredThe file is no longer kept. Create a new job
413payload_too_largeReduce the request size
422invalid_request, ambiguous_local_time, unsupported_option, unsupported_languageFix the input. field names the problem. ambiguous_local_time says to send utc_offset to choose, and lists the possible offsets in choices when the clocks went back; unsupported_language adds supported, the languages that capability does take
429rate_limitedWait for Retry-After seconds, then retry
429quota_exhaustedNo credits left, or a sandbox daily limit was reached. Top up, upgrade or wait for renewal. Retrying will not help
429spend_cap_reachedYour opt-in overage has reached the monthly spending cap you set (or this call would pass it). Raise the cap or buy a top-up in Billing, or wait for the next period. Retrying will not help
429project_budget_exceededThe key's project has used its monthly credit budget (or this call would pass it). An owner or admin can raise the budget under Projects; it resets on the 1st of the month (UTC). Retrying will not help
499client_disconnectedAppears only in your usage log, never in a response: you closed a streamed AI reading before it finished (see what a stream costs)
500computation_failedSafe to retry with the same idempotency key
501not_yet_availableReserved for a capability that is listed but not enabled. None is in this state now
502 / 503unavailableRetry with exponential backoff and jitter
503maintenanceAnnounced maintenance on the API or on one family. retryable is true, Retry-After says when to retry, and error.maintenance has the scope and ends_at
503temporarily_unavailableThe capability (or its family) has been switched off for now. It is not retryable in a loop: try again later and check the status page
504deadline_exceededThe calculation took too long. Retry with backoff

You are never charged for an error. Failed calls do not use credits.

Idempotency conflicts

409 idempotency_conflict has several causes; the message says which:

  • the same Idempotency-Key was used with a different body: use a new key;
  • a request with that key is still in progress: retryable is true, so retry shortly with the same key;
  • the key is more than 24 hours old, or its original response is no longer kept: use a new key.

Retrying safely

Retry only when retryable is true. Use exponential backoff with jitter, and send an idempotency key on every request, so a retry after a network timeout can never charge twice.

Was this page helpful?

On this page

Send us feedback

What is it about?