Error shape

json400 response
{
  "error": {
    "code": "invalid_currency",
    "message": "currency must contain up to 25 comma-separated asset codes.",
    "requestId": "req_01J6EXDZ...",
    "docsUrl": "https://api.exchangedz.com/docs/errors#invalid_currency"
  }
}
code
Stable machine-readable identifier. Branch application behavior on this value rather than parsing the message.
message
Concise human-readable recovery guidance.
requestId
Unique diagnostic identifier, also returned in X-Request-Id.
docsUrl
Documentation location for the error family.

Status codes

400
Invalid or conflicting query parameters. Correct the request before retrying.
401
The API key is missing, malformed, unknown, revoked or expired.
403
The key is recognized, but its access grant is inactive or the required scope is missing.
404
The requested resource or supported asset does not exist.
410
A one-time claim has expired, is invalid or has already been consumed.
429
The burst limit or monthly quota has been exhausted.
5xx
A temporary EXDZ service failure. Retry safe GET requests with bounded backoff.

Safe retries

All documented v1 data endpoints use GET and can be retried safely. Retry only transient responses, cap the attempt count and add jitter so clients do not synchronize.

javascriptBounded exponential backoff
async function requestWithBackoff(url, options, attempt = 0) {
  const response = await fetch(url, options);
  if (![429, 500, 502, 503, 504].includes(response.status) || attempt >= 4) {
    return response;
  }

  const retryAfter = Number(response.headers.get('Retry-After'));
  const delay = Number.isFinite(retryAfter)
    ? retryAfter * 1000
    : Math.min(8000, 500 * 2 ** attempt) + Math.random() * 250;

  await new Promise((resolve) => setTimeout(resolve, delay));
  return requestWithBackoff(url, options, attempt + 1);
}

Request IDs and support

Log the response status, error code, request ID, endpoint and safe API-key prefix. Never log or email the complete Authorization header.

When contacting support, include the request ID and approximate UTC time at exchangedz.com@gmail.com.