Data API

Errors

Every failure returns the same shape, so one handler covers all of them.

Error response
{
  "detail": "Invalid or missing API key. Get a key at hexio.trade/account"
}

The HTTP status is what your code should branch on; detail is written for a human reading a log.

Status codes

CodeMeaningWhat to do
200Fine
400A parameter is malformedRead detail. Retrying will not help.
401Key missing, wrong, or revokedCheck the X-API-Key header. Confirm with /v1/usage.
402Out of creditsTop up, or wait for period_resets_at. Not retryable.
403Your plan does not include thisSignals, streaming and bulk are plan-gated. Upgrade or add the add-on.
404No such path, or no such walletCheck the path. An unknown address is a 404, not an empty 200.
429Too many requests per minuteBack off and retry — see Rate limits.
5xxOur problemRetry with backoff. If it persists, tell us.
401 and 402 look alike and are not. One means the key is not valid, the other means the key is valid and the account has run out. Retrying a 402 forever is the most common way to burn a worker.

WebSocket close codes

A stream that is refused closes with a code rather than an HTTP status. These are in the private-use range, so they will not collide with the standard ones.

CodeMeaningReconnect?
4401Key missing, wrong, or revokedNo — fix the key
4402Out of creditsNo — top up first
4429Too many concurrent streams for the planClose an existing one first
1006Connection dropped (network, deploy, idle)Yes — with backoff

A handshake refused before the socket opens surfaces as an HTTP 403 in most clients rather than a close code.

One handler

JavaScript
class HexioError extends Error {
  constructor(status, detail) { super(detail); this.status = status; }
  // 402 and 403 are decisions, not blips — retrying them wastes the budget.
  get retryable() { return this.status === 429 || this.status >= 500; }
}

async function call(path) {
  const res = await fetch(BASE + path, { headers: { 'X-API-Key': KEY } });
  if (res.ok) return res.json();
  const { detail } = await res.json().catch(() => ({ detail: res.statusText }));
  throw new HexioError(res.status, detail);
}