Integration guides

Errors and retries

Every error has a stable code. Branch on the code, and retry only what is safe to retry.

Errors return a machine-readable code, a human-readable message, and the field at fault where there is one. Branch on code; messages may change.

When to retry

  • 429 rate_limited: wait for the number of seconds in the Retry-After header, then retry.
  • 500 server_error: safe to retry with the same Idempotency-Key.
  • Other 4xx errors: fix the request before sending it again. Retrying unchanged returns the same error.

Requests experts can't answer

These are not HTTP errors. The request is accepted, then completes with status: failed and a reason such as deadline_missed or no_matching_experts. Failed requests are not charged.

Error codes

Missing, mistyped or unknown field.
Missing, invalid or revoked API key.
Not enough credits. Top up, or switch on auto top-up.
Over a spend or volume limit you set.
The key's scope doesn't allow this call.
Unknown request_id, or not visible to this key.
Same Idempotency-Key with a different body.
The request's follow-up round was already used.
Screening found personal, patient or customer-identifying data.
Too many requests. Retry after Retry-After seconds.
Safe to retry with the same Idempotency-Key.

Next

Idempotency →

Error shapejson
{
  "error": {
    "code": "context_blocked",
    "message": "context.notes contains a patient name",
    "field": "context.notes"
  }
}
Rate limited · 429bash
HTTP/1.1 429 Too Many Requests
Retry-After: 2
Content-Type: application/json

{"error": {"code": "rate_limited", "message": "Too many requests"}}