BchainPayBchainPay

Errors


title: "Errors" description: "Every BchainPay error has a stable code, a human-readable message, and a documented HTTP status." section: "API reference" order: 1 updated: "2026-04-18" sourcePath: "content/docs/api/errors.mdx"

The BchainPay API returns conventional HTTP status codes and a JSON body with a stable error code. Always switch on code, not message (messages may change).

Error envelope

{
  "error": {
    "type": "invalid_request",
    "code": "invalid_network",
    "message": "Network 'avalanche' is not supported.",
    "param": "network",
    "request_id": "req_8H2x...91"
  }
}
FieldTypeRequiredDescription
typestringrequiredCoarse category: invalid_request, auth, rate_limit, idempotency, api_error.
codestringrequiredStable machine-readable code. Switch on this.
messagestringrequiredHuman-readable explanation. Safe to log; not safe to display to end users.
paramstringoptionalField that caused the error, when applicable.
request_idstringrequiredEcho this back to support to speed up triage.

HTTP status codes

StatusMeaning
200OK.
201Resource created.
202Accepted; the work is queued (e.g. a withdrawal).
400Invalid request — usually bad input.
401Authentication failed.
403Authenticated but not authorized.
404Resource does not exist.
409Conflict (idempotency reuse, locked pocket).
422Semantically invalid (e.g. address/network mismatch).
429Rate limited.
5xxBchainPay had a problem. Retry with backoff and jitter.

Common codes

CodeStatusMeaning
invalid_api_key401Bearer token missing, malformed, or revoked.
forbidden_scope403Key lacks the required permissions.
invalid_network400Network is not in the supported list.
invalid_settlement_currency400Coin is not available on that network.
address_network_mismatch422Destination is not valid on the pocket's network.
address_blocked422Destination matches a sanctioned address list.
insufficient_balance400Pocket balance below amount_cents + network_fee_cents.
pocket_locked409Another withdrawal is already in flight.
idempotency_conflict409Idempotency key reused with a different body.
rate_limited429Per-key rate limit exceeded. Honor Retry-After.
Last updated Edit on GitHub