Developer tools

Errors

One error shape on every endpoint, and the codes an integration actually meets.

Every refusal has the same four fields. Branch on type for the class of problem and on code for the exact one.

Key requirements

  • Branch on type and code, never on message. The message is for a person and its wording may change.
  • Log request_id. It is what support asks for.
  • Retry with the same idempotency key. A retried write that already happened gives you the original result, not a second one.

How it works

403
{
  "type": "forbidden",
  "code": "IP_NOT_ALLOWED",
  "message": "This request came from 203.0.113.7, which is not on the business's API IP allowlist.",
  "request_id": "01JB2QK8S4WV6M0P7Z3X9Y1C5D",
  "caller_ip": "203.0.113.7"
}
Field
typeThe class of problem, from the closed set below.
codeThe specific problem, stable across releases. Never absent: where an endpoint has no name for it, it is the type in capitals (NOT_FOUND).
messageFor a person. May change.
request_idAlso sent as the X-Request-ID header. Send your own X-Request-ID and we use it (its first 64 characters), so one request has one id in your logs and ours.

Some codes carry more fields, at the top level beside these four: INSUFFICIENT_BALANCE says how much was needed, LIMIT_EXCEEDED names the limit, VALIDATION_FAILED lists the fields. The tables below say which. Read them when the code says they are there; never require them.

A refusal that sets a Retry-After header also carries retry_after, in seconds, in the body.

type, by status

StatustypeUsually means
400invalid_requestFix the request.
401unauthenticatedThe key is missing, wrong, or the wrong mode.
402errorYour balance will not cover it.
403forbiddenThe key may not do this, or not from here.
404not_foundNo such object, or it belongs to the other mode.
405method_not_allowedWrong HTTP method.
409conflictThe object is in a state that refuses this.
410goneIt existed and is no longer usable.
413payload_too_largeThe body is too big.
422validation_errorWell formed, refused by a rule.
429rate_limitedToo many requests. Wait Retry-After seconds.
500internal_errorOur fault. Retry, and quote request_id if it persists.
502upstream_errorA network or bank behind us failed. Retry.
503unavailablePaused or unreachable for now. Retry later.
504upstream_timeoutA network or bank did not answer in time. Retry.

402 is the one status outside the table's usual names: its type is error. Branch on its code, INSUFFICIENT_BALANCE.

Authentication

Returned before the endpoint runs, on any endpoint.

StatuscodeWhat it meansWhat to do
401UNAUTHENTICATEDNo Authorization header (Not authenticated), or the key is unknown, revoked or expired (Could not validate credentials).Fix the key. Do not retry as is.
401WRONG_KEY_MODEA test key on an endpoint that serves live data only: GET /wallets. required_mode says which.Use a live key.
403INSUFFICIENT_AUTHORITYThe key lacks the scope (the message names it; granted lists what it has), or no key may do this at all.Use a key with that scope, or do it in the dashboard.
403IP_NOT_ALLOWEDA live key from an address not on your IP allowlist, or a live key with payouts:write while the list is empty. caller_ip is the address we saw.Add the address in the dashboard, then retry.
403BUSINESS_SUSPENDEDYour business is suspended for this action.Contact support.

Collections

StatuscodeWhat it meansWhat to do
400INVALID_CHARGENot a charge we can take: a payer whose country_code contradicts their number, a payer in Rwanda charged in anything but RWF, or a payer in Rwanda with a number, network or amount we cannot collect (a part franc, say).Fix the request.
400UNKNOWN_STATUSGET /charges?status= with a status that does not exist. known lists them.Fix the filter.
400AMOUNT_OR_NETGET /charges/fee needs exactly one of amount_minor and net_minor.Fix the request.
403CORRIDOR_NOT_OPENWe do not collect that way from that country yet: a Ugandan payer by bank or card, say. country, method and direction say which.Collect another way.
404CHARGE_NOT_FOUNDNo such charge, or it belongs to the other mode.Check the id and the key's mode.
422LIMIT_EXCEEDEDA collection limit on your account. limit_label, limit_window, max_amount_minor and used_minor say which and how much is left. Live keys only.Collect less, or ask us about your limits.
503COLLECTIONS_PAUSEDWe have paused collections from that country. Nothing was created. Live keys only.Retry later with the same idempotency key.

Payment links, from the dashboard or with a key holding payments:write:

StatuscodeWhat it meansWhat to do
400INVALID_LINKA fixed link with no amount, an open link with a fixed amount, bounds the wrong way round, an expiry in the past.Fix the request.
404LINK_NOT_FOUNDNo such link.Check the id.

Payouts

StatuscodeWhat it meansWhat to do
400INVALID_PAYOUTNot a payout we can send: a destination we cannot pay, a country_code that contradicts the number, an amount outside the bounds for the destination, a part shilling in Uganda. field names the part at fault where there is one.Fix the request.
402INSUFFICIENT_BALANCEYour balance will not cover the amount and the fee. required_minor and currency say what is needed.Top up, or send less.
403CORRIDOR_NOT_OPENWe do not pay that way to that country yet. country, method and direction say which.Pay another way.
404PAYOUT_NOT_FOUNDNo such payout, or it belongs to the other mode.Check the id and the key's mode.
409BENEFICIARY_BLOCKEDThe saved beneficiary is blocked, archived or has not cleared screening. screening_status says which.Contact support.
409PRICE_CHANGEDThe payout now costs more than your max_total_minor. total_minor is the new price.Accept the new price, or do not send.
422LIMIT_EXCEEDEDA payout limit on your account. The body names the limit and what is used.Send less, or ask us about your limits.
422CURRENCY_NOT_ACTIVATEDYour business does not hold that currency. field is currency.Contact support to activate it.
503PAYOUTS_PAUSEDWe have paused payouts to that country. Nothing was created or reserved.Retry later with the same idempotency key.
503NO_RAIL_AVAILABLENothing can carry this payout right now, or we do not pay there. The message says which.Retry later, unless the message says we do not pay there.
503NO_RATEA payout that converts currency, and no exchange rate right now. Nothing was held.Retry shortly.

Every one of these is checked before the payout exists or money is reserved, so a refusal leaves nothing behind.

Account lookups and the bank list:

StatuscodeWhat it meansWhat to do
400COUNTRY_NOT_SUPPORTEDGET /payout-banks for a country other than RW or UG.Fix the request.
400INVALID_LOOKUPThe request does not name something that can be looked up. field says which part.Fix the request.
400LOOKUP_NOT_SUPPORTEDNo lookup for this country or method yet. supported_countries lists the ones there are.Skip the lookup.
429LOOKUP_RATE_LIMITEDYour business has used its lookups for this hour. Retry-After says until when.Wait, then retry.
503LOOKUP_UNAVAILABLEWe could not ask. Nothing was decided about the account.Retry shortly. Do not treat the account as bad.

Webhooks

StatuscodeWhat it meansWhat to do
400INVALID_ENDPOINTThe URL is not https, has no public address, or your business already sends to it.Fix the URL.
404ENDPOINT_NOT_FOUNDNo such endpoint, or it belongs to the other mode.Check the id and the key's mode.
404DELIVERY_NOT_FOUNDNo such delivery.Check the id.
409NOT_REPLAYABLEOnly a dead-lettered delivery can be replayed, and only to an enabled endpoint.Enable the endpoint, or leave a live delivery to its retries.

General

StatuscodeWhat it meansWhat to do
422VALIDATION_FAILEDThe body or query could not be read: a missing field, a wrong type, a value out of range (an amount_minor of 0, say), a fee_minor on a charge (we set the fee). errors lists each field and message.Fix the request.
422IDEMPOTENCY_KEY_REUSEDThis Idempotency-Key was used with a different body.Use a new key for a new request.
422IDEMPOTENCY_KEY_TOO_LONGThe Idempotency-Key header is over 255 characters.Use a shorter key.
409IDEMPOTENCY_KEY_IN_FLIGHTThe first request with this key is still running.Retry once it has finished.
429RATE_LIMIT_EXCEEDEDToo many requests for your key. See below.Wait Retry-After seconds.
404NOT_FOUNDNo such route.Check the path.
500INTERNAL_ERRORSomething broke on our side.Retry with the same idempotency key; quote request_id if it persists.

Testing

A sk_test_ key is refused the way a live one is, request for request, with these exceptions: the IP allowlist (IP_NOT_ALLOWED) applies to live keys only, and so do a charge's limits and pauses (LIMIT_EXCEEDED, COLLECTIONS_PAUSED). GET /wallets refuses every test key (WRONG_KEY_MODE). To see a failure after a request is accepted, use the amounts on Testing.

Developer notes

Rate limits

Each key, and each dashboard session, has a request allowance. Every response carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset, so you can pace yourself and never be refused.

A 429 has the usual shape, plus retry_after, the same number of seconds as the Retry-After header:

{
  "type": "rate_limited",
  "code": "RATE_LIMIT_EXCEEDED",
  "message": "Rate limit of 100 requests per 60s exceeded. Retry in 17s.",
  "request_id": "01JB2QK8S4WV6M0P7Z3X9Y1C5D",
  "retry_after": 17
}

A 5xx is safe to retry

A 5xx does not hold your Idempotency-Key, so a retry with the same key is processed rather than refused. A 4xx is stored against the key and replayed for 24 hours, with Idempotent-Replay: true.

What's next

On this page