Requests, idempotency and errors
Conventions every endpoint follows: JSON in and out, decimal strings for money, safe retries and errors you can act on.
Format
- Bodies are JSON with
Content-Type: application/json, in UTF-8. Field names are camelCase. - Amounts are decimal strings in major units:
"12500.00", never numbers or cents. - Currencies are ISO 4217 codes (
AUD,PHP); stablecoins use their ticker (USDC). - Countries are ISO 3166-1 alpha-2 (
AU,PH). - Timestamps are ISO 8601 in UTC, with milliseconds (
2026-10-21T09:41:07.412Z). - Ids are opaque strings with a prefix (
cus_,route_,quo_,trf_,evt_,we_). Do not parse them. - Unknown fields in a request are refused with
400 validation_failed, in the body, in nested objects and in the query. Unknown fields in a response may appear at any time; your code should ignore them. - Bodies go up to 256 KB, and up to 15 MB on POST/v1/customers for the images in
kyc. Past that,413 payload_too_large.
Pagination
GET/v1/customers, GET/v1/routes and GET/v1/transfers page in two ways: by page number or by cursor. Both take limit (1 to 100, default 20).
By page
page starts at 1:
{ "data": [], "page": 1, "totalCount": 42, "totalPages": 3, "hasMore": true, "nextCursor": "WyIyMDI2LTEwLTIxVDA5OjEy…" }Customers and routes are sorted newest first (by createdAt, then id); transfers by their latest update, newest first. A page past the end returns data: [].
By cursor
Every answer of these lists carries nextCursor, an opaque string, null on the last page. Send it back as cursor, with limit if you want, for the next page:
curl "https://api.locals.money/v1/customers?cursor=WyIyMDI2LTEwLTIxVDA5OjEy…&limit=100" -H "Authorization: Bearer $LOCALS_KEY"{ "data": [], "page": null, "totalCount": null, "totalPages": null, "hasMore": true, "nextCursor": "WyIyMDI2LTEwLTIxVDA4OjU5…" }- By cursor the order is always newest created first (
createdAt, thenid), and what is created or updated during the walk neither repeats nor goes missing, whichpagecannot promise. Use it to walk a whole list: read the first page, then send eachnextCursorback until it isnull. - On transfers, the order by cursor is by creation, not by the latest update as by page. So the
nextCursorof a transfers answer by page starts the walk from the newest transfer, and may repeat what that page showed: drop duplicates byid. On customers and routes it goes on right after the page. - A page asked by cursor is not counted:
page,totalCountandtotalPagesarenull.hasMoreworks as usual. - Do not build or change a cursor. One that cannot be read, or one sent together with
page, is400 validation_failedoncursor.
Without cursor, the lists answer as before, with nextCursor added. GET/v1/events pages with after and limit instead: see Events.
Idempotency
Send an Idempotency-Key header with every POST: 1 to 255 printable ASCII characters, without spaces. Use a new UUID per operation and reuse it when you retry that same operation.
curl -X POST https://api.locals.money/v1/transfers \
-H "Authorization: Bearer $LOCALS_KEY" \
-H "Idempotency-Key: 4e6b2d81-7a9c-4f30-b5e2-1c8d3a9f6b70" \
-H "Content-Type: application/json" \
-d @transfer.json- The first answer is kept for 24 hours. A retry with the same key and the same body gets that answer again, errors included, with
Idempotent-Replayed: true. - The body is compared byte for byte: send the same bytes when you retry, not a re-serialized copy with other spacing or key order.
- The same key with a different body, or on another endpoint (the path counts, ids included), returns
409 idempotency_conflict. - The same key while the first request is still running returns
409 request_in_progress. Wait and retry. - A
5xxanswer, a429, or a409 operation_in_doubt, is not kept: the retry runs again.
Keys are per partner: another partner using the same key does not affect you.
Some operations are safe to repeat even without the header: a quote becomes only one transfer, so a retried POST/v1/transfers with the same details returns the first transfer (and 409 quote_already_used if the quote is reused with other details); creating a route for the same customer, source currency and destination (stablecoin, chain and address) returns the existing route; and creating a customer twice for the same externalId returns 409 customer_exists instead of creating a second one.
Response headers
| Header | When |
|---|---|
Request-Id | Every answer. The same value as requestId in an error. |
RateLimit-Limit, RateLimit-Remaining | Every answer except the 401 and 403 of the key checks: the requests the key may make per minute, and what is left. |
Retry-After | With 429, and with a 503 you can send again: seconds to wait. See Retry later. |
Idempotent-Replayed: true | An answer repeated for an Idempotency-Key. |
Rate limits
Each key may make a number of requests per minute, 120 by default. Past it, requests get 429 rate_limited with Retry-After. Spread bulk work over time and read RateLimit-Remaining instead of waiting for the 429. If you need more, tell us.
- Each key has its own limit, set when the key is created: from 10 to 120 a minute, more only when Locals sets it, up to 1200.
- All the keys of your account together may also make 1200 requests a minute. Past it, every key gets
429 rate_limitedwithRetry-After, andRateLimit-Remainingis0. - The minute is a fixed window of 60 seconds that starts with the key's first request in it.
Retry-Afteris the seconds left until the window ends. There is noRateLimit-Resetheader. - Only requests that pass the key and allowed IP checks count.
Retry later
Some requests are refused before anything is done, and come back with Retry-After: send the same request again after that many seconds.
429 rate_limited, a busy object. More than 10 requests for the same object are waiting at once, for example for the same quote on POST/v1/transfers or the same route on POST/v1/routes. Nothing was done for that request.429 rate_limited, too many calls at once. Your account already has 6 requests waiting on the banking partner at once, from the API and the backoffice together. Nothing was sent for this one, and a payout does not take its quote. Send it again when one of them has answered.503 service_unavailable, a long wait. The request waited too long behind others for the same object (30 seconds), and was not run.503 service_unavailable, the banking partner. The banking partner is saturated, with too many calls in flight, or was just failing: after several failures in a row, new customers, routes, quotes and payouts are refused for a few seconds. Nothing was sent to it.
503 service_unavailable, a busy write. The object was being changed by other requests at the same time and this one gave up after a few tries. The same request continues where it stopped: it never creates the object twice.
In the first four nothing was done. In all of them the same request, with the same Idempotency-Key, is safe to send again: these answers are not kept for the key, and the retry runs. A payout refused for a busy object, a long wait or the banking partner does not use its quote: send it again with the same quote, before it expires. The body is the same as every other error.
Errors
Errors use HTTP status codes and one body shape:
{
"statusCode": 422,
"code": "customer_not_ready",
"message": "Customer cus_8Hq2Lm is not enabled for AUD routes (processing)",
"requestId": "req_0c1f5b"
}Validation errors add fields, with the path of each field that failed:
{
"statusCode": 400,
"code": "validation_failed",
"message": "Some fields are invalid",
"fields": [ { "field": "destination.address", "message": "address must be an EVM address" } ],
"requestId": "req_7a21de"
}A body that is not valid JSON is 400 validation_failed with the parser's message and no fields.
limit_exceeded adds limit: which limit the operation would go over, and what is left of it. See Limits and blocks.
{
"statusCode": 422,
"code": "limit_exceeded",
"message": "Customer cus_8Hq2Lm would go over its daily offramp limit of 800 USD: 100.00 USD left",
"limit": { "direction": "offramp", "scope": "customer", "window": "daily", "currency": "USD", "limit": "800", "used": "700.00", "remaining": "100.00" },
"requestId": "req_3b9e40"
}scope is customer or tenant (the cap on your whole volume); window is perOperation, daily (the last 24 hours) or monthly (the last 30 days); used is null for perOperation.
| Status | Code | What to do |
|---|---|---|
| 400 | validation_failed | Fix the request; fields says what is wrong. |
| 401 | unauthorized | Check the key and the environment: a key only works on its own environment, and the message says why it was refused. |
| 403 | forbidden | Your account is suspended, or Locals does not allow that country, wallet or bank account. Talk to us. |
| 403 | ip_not_allowed | The key cannot be used from that address. Add your servers' addresses to the key. See Allowed IPs. |
| 403 | customer_blocked | The customer is blocked: no payouts or new routes. See Blocked customers. |
| 404 | not_found | The id does not exist, is malformed, or is not yours. The three answer the same. |
| 409 | customer_exists | Use the existing customer. |
| 409 | quote_already_used | The quote is already used for another customer, purpose code or payout account. Request a new quote. |
| 409 | idempotency_conflict | Same key, different body or endpoint. Use a new key. |
| 409 | request_in_progress | The first request with this key is still running. Retry shortly. |
| 409 | operation_in_doubt | Only on POST/v1/transfers: what became of an earlier attempt of the same payout at the banking partner is not known yet, and nothing was sent this time. The quote stays taken by that payout. Send the same payout again later: it is looked up again. If it does not settle, contact us with the quote id. |
| 409 | conflict | The object is not in a state that allows it, for example a third webhook secret. The message says why. |
| 409 | too_many_pending_deliveries | 50 or more deliveries of yours are waiting to go out: redeliver once they have gone. See Redeliver an event. |
| 413 | payload_too_large | Send a smaller body. |
| 415 | unsupported_media_type | Send UTF-8 JSON, without an unknown Content-Encoding. |
| 422 | customer_not_ready | The customer is still being created, or the capability the call needs is not enabled: the message says which, with its status. See Capabilities. |
| 422 | quote_expired | Request a new quote. |
| 422 | limit_exceeded | The operation would go over a limit. Read limit, and GET/v1/customers/{id}/limits. |
| 429 | rate_limited | Past your key's or your account's rate limit, too many requests for the same object at once, or too many of your requests waiting on the banking partner at once. Wait Retry-After seconds, then send the same request. |
| 500 | internal_error | Retry with backoff, and tell us with the requestId if it persists. |
| 502 | upstream_unavailable | A banking partner did not answer. Retry with the same idempotency key. |
| 502 | upstream_rejected | The banking partner refused the request. Quote the reference in the message when you contact us. |
| 503 | service_unavailable | With Retry-After: send the same request again after that many seconds, it is safe. See Retry later. Without it, retry with backoff. |
Quote requestId when you contact us; it lets us find the exact request.
Retries
Retry on 500, 502, 503 and network errors, with exponential backoff (for example 1 s, 2 s, 4 s, up to 5 attempts) and the same Idempotency-Key. On 429, and on a 503 with Retry-After, wait Retry-After; on 409 request_in_progress, wait a moment; on 409 operation_in_doubt, send the same payout again later, it is not kept for the Idempotency-Key. Do not retry other 4xx errors without changing the request.