Responses and errors
Every endpoint answers the same way: a JSON object on success, a single error object on failure, and an HTTP status that tells you which before you read the body.
Success responses
A single object is returned as itself, with no wrapper. Each endpoint's page in the reference lists the fields of its response body.
HTTP/1.1 201 Created
X-Request-Id: req_01…
{
"id": "esc_01M1MD43G9ZRNVVHV25TQ85MCD",
"status": "CREATED",
"environment": "test",
"amountAtomic": "1000000",
…
}Status codes
| Status | When |
|---|---|
| 200 OK | A read, or a change to an existing object. |
| 201 Created | An object was created, or a transaction was prepared for signing. |
| 202 Accepted | A funding transaction hash was accepted for verification — a claim, not a confirmed payment. |
| 401 Unauthorized | Missing, malformed, revoked or wrong-environment API key (authentication_error). |
| 403 Forbidden | The key lacks the route's scope (insufficient_scope), or the action is not allowed for your organization. |
| 404 Not Found | No such object in your organization and environment. Another organization’s id answers the same. |
| 409 Conflict | The object's state does not allow the action, a reused externalReference, or an Idempotency-Key reused with a different body. |
| 422 Unprocessable Entity | The body or query is invalid; details.fields names each field. |
| 429 Too Many Requests | Your rate-limit bucket is empty; wait Retry-After seconds. |
| 503 Service Unavailable | A platform service is briefly unavailable. Retry with backoff and the same Idempotency-Key. |
Pagination
Lists are returned as { data, nextCursor }. Pass limit (1–100, default 20) and, for every page after the first, the previous response's nextCursor as cursor. nextCursor is null on the last page. Cursors are opaque: do not build or edit them.
GET /v1/escrows?status=FUNDED&limit=20
{
"data": [ { "id": "esc_…", … }, … ],
"nextCursor": "eyJjIjoiMjAyNi0wOS0wM1Qx…"
}let cursor;
do {
const url = new URL(`${process.env.ESCROW_API_BASE}/escrows`);
url.searchParams.set('limit', '100');
if (cursor) url.searchParams.set('cursor', cursor);
const page = await fetch(url, { headers: { Authorization: `Bearer ${key}` } }).then((r) => r.json());
for (const escrow of page.data) handle(escrow);
cursor = page.nextCursor;
} while (cursor);Errors
A failed request returns one error object. Branch on code, which is stable; show message to people; quote requestId when you ask for help. details carries structured context and never secrets or stack traces.
HTTP/1.1 422 Unprocessable Entity
{
"error": {
"type": "invalid_request",
"code": "validation_failed",
"message": "The request body is invalid.",
"requestId": "req_01…",
"details": { "fields": ["amount"] }
}
}| type | Family |
|---|---|
| invalid_request | Something about the request: validation, state, not found, idempotency conflict. |
| authentication_error | The API key is missing or not valid. |
| authorization_error | The key is valid but not allowed to do this. |
| rate_limit_error | Too many requests; slow down. |
| api_error | Something went wrong on our side. Safe to retry with the same Idempotency-Key. |
Every code, the details.reason values and a troubleshooting table are on Errors and limits.
Idempotency
- Send an
Idempotency-Keyheader (8–255 characters) on any write. Your order id is a good key. - The same key with the same body replays the original response instead of acting twice.
- The same key with a different body is refused with
409 idempotency_key_reuse. - After a timeout or a
503, retry with the same key — you can never create two escrows for one order that way.
Request ids
Every response carries an X-Request-Id header, also echoed in error.requestId. Send your own (up to 128 letters, digits and ._:-) and it is kept, so you can find the request in the dashboard's request log from your own logs.
Rate limits
Each credential has a token bucket. Every response reports it in X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset; when it is empty you get 429 with Retry-After. Details on Errors and limits.