UniversalEscrow
DocumentationAPI reference

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.

One object
HTTP/1.1 201 Created
X-Request-Id: req_01…

{
  "id": "esc_01M1MD43G9ZRNVVHV25TQ85MCD",
  "status": "CREATED",
  "environment": "test",
  "amountAtomic": "1000000",
  …
}

Status codes

StatusWhen
200 OKA read, or a change to an existing object.
201 CreatedAn object was created, or a transaction was prepared for signing.
202 AcceptedA funding transaction hash was accepted for verification — a claim, not a confirmed payment.
401 UnauthorizedMissing, malformed, revoked or wrong-environment API key (authentication_error).
403 ForbiddenThe key lacks the route's scope (insufficient_scope), or the action is not allowed for your organization.
404 Not FoundNo such object in your organization and environment. Another organization’s id answers the same.
409 ConflictThe object's state does not allow the action, a reused externalReference, or an Idempotency-Key reused with a different body.
422 Unprocessable EntityThe body or query is invalid; details.fields names each field.
429 Too Many RequestsYour rate-limit bucket is empty; wait Retry-After seconds.
503 Service UnavailableA 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.

One page
GET /v1/escrows?status=FUNDED&limit=20

{
  "data": [ { "id": "esc_…", … }, … ],
  "nextCursor": "eyJjIjoiMjAyNi0wOS0wM1Qx…"
}
Every page (Node.js)
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.

Error envelope
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"] }
  }
}
typeFamily
invalid_requestSomething about the request: validation, state, not found, idempotency conflict.
authentication_errorThe API key is missing or not valid.
authorization_errorThe key is valid but not allowed to do this.
rate_limit_errorToo many requests; slow down.
api_errorSomething 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-Key header (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.

Next