Error handling

Every Anaxer API error carries a machine-readable code: REST errors as an HTTP status with a JSON body, stream errors as a message on the open WebSocket.

REST errors

{
  "error": {
    "code": "unauthorized",
    "message": "Invalid or missing API key."
  }
}

A REST error is an HTTP status plus this body. Branch on code; message is for people. A 429 also carries a Retry-After header.

400invalid_request
Bad mint, wallet, param value, source name, batch size, or cursor, or a query parameter the endpoint doesn't take (the message names it and lists the allowed ones).
401unauthorized
Missing or invalid API key.
404not_found
Unknown token, or no price for the mint (never priced, or no trade in the last 72 hours). An unknown wallet is not an error: it returns 200 with an empty list.
429rate_limited
Per-key burst limit exceeded.
429quota_exceeded
Per-user monthly request quota exceeded.
500internal
Unexpected server failure.
503upstream_unavailable
Dependency unavailable (e.g. metadata resolve), or a list read that ran past 10 seconds: narrow from / to and retry.

Stream errors

{
  "v": 1,
  "type": "error",
  "code": "plan_restricted",
  "message": "Your plan doesn't include this stream.",
  "id": "trades-1",
  "ts": 1783259497400
}

A stream error is a JSON message on the WebSocket, sent instead of a reply when a message you sent is rejected. id is the subscription it concerns, when there is one. The connection stays open, except after unauthorized and slow_consumer.

invalid_message
Client frame is not a recognized control message
invalid_filters
Filters fail schema or channel rules: an unknown source name, a filter the channel doesn't take (volume filters off trades and transfers, direction without wallets), a list over its cap, or a Starter transfers subscription without wallets or mints. The message names the problem.
unknown_channel
subscribe.channel is not a v1 channel
subscription_limit
Active subscriptions on that channel would exceed the account-wide connectionsPerStream cap
duplicate_id
subscribe.id already active on this connection
unknown_subscription
unsubscribe.id is not active
unauthorized
Auth failed or revoked (closes socket)
slow_consumer
Client outbound buffer exceeded (closes socket)
plan_restricted
Plan does not include the requested channel
internal_error
Unexpected server failure handling the message

Close codes

The WebSocket close codes Anaxer streams use. See Streams for reconnecting.

1008
Unauthorized — invalid or missing API key (preceded by error frame)
1009
Message too big — a frame you sent was over 64 KiB
1013
Slow consumer — outbound buffer exceeded (preceded by slow_consumer error)
1011
Internal server error

Last updated · Changelog