Errors and retries

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

StatusMeaningTypical codes
400The request body is malformed or contains unknown/invalid fields. Fix the request; retrying unchanged will fail again.invalid_request
401The API key is missing, malformed, revoked, or expired.invalid_api_key
403The key is valid but not allowed to do this.insufficient_scope
404The resource does not exist — or belongs to another partner or the other mode (test vs live), which is deliberately indistinguishable.advance_not_found
409An Idempotency-Key was reused with a different body, or the first attempt is still running.idempotency_conflict, idempotency_in_progress
422The request is well-formed but a business rule says no.offer_expired, invalid_status, invalid_disbursal_mode, invalid_status_transition
5xxSomething failed on our side.internal_error

Retries and Reconciliation

A safe retry strategy in three rules:

  1. Retry 5xx and timeouts, never 4xx. A 4xx will fail the same way every time until you change the request. Use modest exponential backoff for server errors.
  2. Make writes replay-safe before you retry them. Send an Idempotency-Key on /v1 writes so a retried request replays the original response instead of repeating the work. Advance creation is additionally protected by partner_ref — repeating the same create returns the existing advance.
  3. 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/:id returns the current state, and webhooks will have reported any transition you missed.