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
typeandcode, never onmessage. 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
{
"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 | |
|---|---|
type | The class of problem, from the closed set below. |
code | The specific problem, stable across releases. Never absent: where an endpoint has no name for it, it is the type in capitals (NOT_FOUND). |
message | For a person. May change. |
request_id | Also 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
| Status | type | Usually means |
|---|---|---|
400 | invalid_request | Fix the request. |
401 | unauthenticated | The key is missing, wrong, or the wrong mode. |
402 | error | Your balance will not cover it. |
403 | forbidden | The key may not do this, or not from here. |
404 | not_found | No such object, or it belongs to the other mode. |
405 | method_not_allowed | Wrong HTTP method. |
409 | conflict | The object is in a state that refuses this. |
410 | gone | It existed and is no longer usable. |
413 | payload_too_large | The body is too big. |
422 | validation_error | Well formed, refused by a rule. |
429 | rate_limited | Too many requests. Wait Retry-After seconds. |
500 | internal_error | Our fault. Retry, and quote request_id if it persists. |
502 | upstream_error | A network or bank behind us failed. Retry. |
503 | unavailable | Paused or unreachable for now. Retry later. |
504 | upstream_timeout | A 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.
| Status | code | What it means | What to do |
|---|---|---|---|
401 | UNAUTHENTICATED | No Authorization header (Not authenticated), or the key is unknown, revoked or expired (Could not validate credentials). | Fix the key. Do not retry as is. |
401 | WRONG_KEY_MODE | A test key on an endpoint that serves live data only: GET /wallets. required_mode says which. | Use a live key. |
403 | INSUFFICIENT_AUTHORITY | The 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. |
403 | IP_NOT_ALLOWED | A 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. |
403 | BUSINESS_SUSPENDED | Your business is suspended for this action. | Contact support. |
Collections
| Status | code | What it means | What to do |
|---|---|---|---|
400 | INVALID_CHARGE | Not 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. |
400 | UNKNOWN_STATUS | GET /charges?status= with a status that does not exist. known lists them. | Fix the filter. |
400 | AMOUNT_OR_NET | GET /charges/fee needs exactly one of amount_minor and net_minor. | Fix the request. |
403 | CORRIDOR_NOT_OPEN | We 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. |
404 | CHARGE_NOT_FOUND | No such charge, or it belongs to the other mode. | Check the id and the key's mode. |
422 | LIMIT_EXCEEDED | A 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. |
503 | COLLECTIONS_PAUSED | We 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:
| Status | code | What it means | What to do |
|---|---|---|---|
400 | INVALID_LINK | A 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. |
404 | LINK_NOT_FOUND | No such link. | Check the id. |
Payouts
| Status | code | What it means | What to do |
|---|---|---|---|
400 | INVALID_PAYOUT | Not 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. |
402 | INSUFFICIENT_BALANCE | Your balance will not cover the amount and the fee. required_minor and currency say what is needed. | Top up, or send less. |
403 | CORRIDOR_NOT_OPEN | We do not pay that way to that country yet. country, method and direction say which. | Pay another way. |
404 | PAYOUT_NOT_FOUND | No such payout, or it belongs to the other mode. | Check the id and the key's mode. |
409 | BENEFICIARY_BLOCKED | The saved beneficiary is blocked, archived or has not cleared screening. screening_status says which. | Contact support. |
409 | PRICE_CHANGED | The payout now costs more than your max_total_minor. total_minor is the new price. | Accept the new price, or do not send. |
422 | LIMIT_EXCEEDED | A payout limit on your account. The body names the limit and what is used. | Send less, or ask us about your limits. |
422 | CURRENCY_NOT_ACTIVATED | Your business does not hold that currency. field is currency. | Contact support to activate it. |
503 | PAYOUTS_PAUSED | We have paused payouts to that country. Nothing was created or reserved. | Retry later with the same idempotency key. |
503 | NO_RAIL_AVAILABLE | Nothing 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. |
503 | NO_RATE | A 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:
| Status | code | What it means | What to do |
|---|---|---|---|
400 | COUNTRY_NOT_SUPPORTED | GET /payout-banks for a country other than RW or UG. | Fix the request. |
400 | INVALID_LOOKUP | The request does not name something that can be looked up. field says which part. | Fix the request. |
400 | LOOKUP_NOT_SUPPORTED | No lookup for this country or method yet. supported_countries lists the ones there are. | Skip the lookup. |
429 | LOOKUP_RATE_LIMITED | Your business has used its lookups for this hour. Retry-After says until when. | Wait, then retry. |
503 | LOOKUP_UNAVAILABLE | We could not ask. Nothing was decided about the account. | Retry shortly. Do not treat the account as bad. |
Webhooks
| Status | code | What it means | What to do |
|---|---|---|---|
400 | INVALID_ENDPOINT | The URL is not https, has no public address, or your business already sends to it. | Fix the URL. |
404 | ENDPOINT_NOT_FOUND | No such endpoint, or it belongs to the other mode. | Check the id and the key's mode. |
404 | DELIVERY_NOT_FOUND | No such delivery. | Check the id. |
409 | NOT_REPLAYABLE | Only 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
| Status | code | What it means | What to do |
|---|---|---|---|
422 | VALIDATION_FAILED | The 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. |
422 | IDEMPOTENCY_KEY_REUSED | This Idempotency-Key was used with a different body. | Use a new key for a new request. |
422 | IDEMPOTENCY_KEY_TOO_LONG | The Idempotency-Key header is over 255 characters. | Use a shorter key. |
409 | IDEMPOTENCY_KEY_IN_FLIGHT | The first request with this key is still running. | Retry once it has finished. |
429 | RATE_LIMIT_EXCEEDED | Too many requests for your key. See below. | Wait Retry-After seconds. |
404 | NOT_FOUND | No such route. | Check the path. |
500 | INTERNAL_ERROR | Something 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.