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 keyProvide a valid x-api-key.
402Payment Required --- insufficient Wallet Credits or missing dataset accessAdd Wallet Credits for pay-as-you-go API usage, or restore the required dataset access for data exports.
403Forbidden --- access deniedEnsure your API key user 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 restore the required dataset 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 pay-as-you-go API usage or restoring dataset access (active subscription or qualifying buyout for public datasets; qualifying owned data-generation order for private datasets). For 5xx responses, use backoff (2s, 4s, 8s, 16s).