DOCS Live

The basics

Handling errors

Every error has a stable code; branch on it, show the right message, and retry only what can be retried.

Errors are application/problem+json (RFC 7807) with a stable code. Branch on the code, never on the title or detail text, which can change. The error catalogue lists every code, what it means, what to do and whether retrying helps.

The flow at a glance

#WhoWhat happens
1Your systemReads the HTTP status and the code.
2Your systemRetries only what the catalogue says passes; fixes the request otherwise.
3Your systemLogs the X-Request-ID header of every failed call, for support.

1. Read the problem

Your system.

Every error answer looks like this. detail explains this case; validation problems add an errors list with each field.

Response

{
  "type": "about:blank",
  "title": "Deposit refused",
  "status": 422,
  "code": "deposit_refused",
  "detail": "the reference lookup has expired"
}

2. Decide whether to retry

Your system.

3. Tell support what failed

Your team.

Every answer carries an X-Request-ID header. Keep it with failed calls: it is how support finds your request.

Errors that matter here

Every error is application/problem+json with a stable code; branch on the code, not the message. The full list is in the error catalogue.

ErrorWhenWhat to do
400 invalid_request

The request is malformed or a field is out of range.

Fix the field the detail names.

401 unauthorized

No key, or a key that does not work.

Check the key.

403 insufficient_scope

The key lacks a scope.

Use a key with the scope.

404 not_found

Unknown, or not visible to this key's account or mode.

Check the ID and the key's mode.

409 idempotency_key_reused

The key was used for a different request.

New operation, new key.

421 wrong_region

The account is served in another region.

Resend to the base URL in the answer.

429 rate_limited

Too many requests.

Wait for Retry-After.

500 internal_error

An error on KulPay's side.

Retry with the same key; contact support with the X-Request-ID if it persists.

Testing it

Send a request with a missing field and check your code shows the right message from the code. Send too many lookups in a minute to see 429 and your back-off.


All flows · API reference · Error catalogue