Errors are predictable by design: every failure, from a validation slip to an internal fault, comes back in the same JSON envelope with a stable machine-readable code. Branch your code on code. Show the message to humans. Include the request_id when you contact support — it lets us find the exact request in our logs.
The Error Envelope
JSON example
{
"error": {
"code": "offer_expired",
"message": "The offer has expired",
"request_id": "req_01J9X4Y7ZQ",
"details": {}
}
}code is stable and safe to branch on. message is human-readable and may change, so do not match against it in code. details appears only when there is structured context to add. New codes may be added within /v1, but an existing code is never renamed — renaming one would be a breaking change.
Status Codes
| Status | Meaning | Typical codes |
|---|---|---|
400 | The request body is malformed or contains unknown/invalid fields. Fix the request; retrying unchanged will fail again. | invalid_request |
401 | The API key is missing, malformed, revoked, or expired. | invalid_api_key |
403 | The key is valid but not allowed to do this. | insufficient_scope |
404 | The resource does not exist — or belongs to another partner or the other mode (test vs live), which is deliberately indistinguishable. | advance_not_found |
409 | An Idempotency-Key was reused with a different body, or the first attempt is still running. | idempotency_conflict, idempotency_in_progress |
422 | The request is well-formed but a business rule says no. | offer_expired, invalid_status, invalid_disbursal_mode, invalid_status_transition |
5xx | Something failed on our side. | internal_error |
Retries and Reconciliation
A safe retry strategy in three rules:
- Retry
5xxand timeouts, never4xx. A4xxwill fail the same way every time until you change the request. Use modest exponential backoff for server errors. - Make writes replay-safe before you retry them. Send an
Idempotency-Keyon/v1writes so a retried request replays the original response instead of repeating the work. Advance creation is additionally protected bypartner_ref— repeating the same create returns the existing advance. - When in doubt, read. If a cancel or disbursal-preparation request times out and you cannot tell whether it landed, do not guess:
GET /v1/advances/:idreturns the current state, and webhooks will have reported any transition you missed.