Infinity Africa

Reference

Error Codes

Every error response has the same shape — an HTTP status code, plus a stable machine-readable error.code you can branch your own logic on without parsing the human-readable message.

Error shape

json
{
  "success": false,
  "error": {
    "code": "validation_error",
    "message": "Invalid request",
    "details": [
      { "loc": ["body", "amount"], "msg": "Input should be greater than 0", "type": "greater_than" }
    ]
  }
}

details is null for most error codes — it's only populated for validation_error, where it's the field-by-field list of what failed.

Codes

HTTP Statuserror.codeMeaning
400bad_requestA generic request problem that doesn't fit a more specific code.
401unauthorizedMissing or invalid credentials — no X-API-Key/Bearer token, or the key was revoked.
403forbiddenYour credentials are valid, but not authorized for this merchant or resource.
404not_foundThe resource doesn't exist, or doesn't belong to your merchant.
409conflictThe request conflicts with the resource's current state (e.g. cancelling an already-paid link).
409idempotency_key_reusedThe same Idempotency-Key was sent with a different request body.
409insufficient_balanceA disbursement amount exceeds your current available balance.
422validation_errorThe request body failed validation — see error.details for the field-level breakdown.
500internal_errorSomething went wrong on Infinity Africa's side. Safe to retry; contact us if it persists.

Handling errors safely

  • Branch on error.code, never on error.message — the message text may change; the code won't.
  • A 409 idempotency_key_reused almost always means a bug in your retry logic (reusing a key across two different requests) — it's not something to retry.
  • 500 internal_error is safe to retry with the same idempotency key; everything else reflects something about the request itself that a retry won't fix.