Error Handling

Understand and handle API errors effectively.

Common Error Codes

CodeMessageAction
400Bad Request --- invalid parameters or malformed JSONFix request format and required params.
401Unauthorized --- missing or invalid API key or bearer tokenProvide a valid `x-api-key` or `Authorization: Bearer <token>`.
402Payment Required --- insufficient Wallet Credits or missing Generated Data accessAdd Wallet Credits for supported pay-as-you-go Om usage, or use a protein UUID with qualifying Generated Data access.
403Forbidden --- access deniedEnsure the authenticated account has permission for this resource.
404Not FoundVerify endpoint path and resource identifiers.
409Conflict --- duplicate request still in progress, or job result requested before completionReuse the same idempotency key after the in-flight request settles, or wait for the job to succeed before calling enriched result routes.
429Too Many RequestsSlow down or wait before retrying.
500Internal Server ErrorRetry with exponential backoff.
503Service UnavailableCheck status page and retry later.
504Gateway TimeoutReduce limit or stream in smaller chunks.

Best Practices

  • Check status codes before processing response bodies.
  • Implement retries with exponential backoff for 5xx errors.
  • Log the request_id field from response payloads for debugging with support.
  • Handle HTTP 409 by distinguishing duplicate in-flight launches from result checks made before a job is ready.
  • Surface HTTP 402 to users so they can add Wallet Credits or use a protein UUID with qualifying Generated Data access.

Retry Strategy

Do not retry 400/401/403/404/409 errors without fixing the request. HTTP 402 can be retried after adding Wallet Credits for supported pay-as-you-go Om usage or after qualifying Data Generation output exists for the requested protein_uuid. For 5xx responses, use backoff (2s, 4s, 8s, 16s).