API error codes
Every error code of the Femtos API (REST, WebSocket, MCP, x402): its HTTP status, what it means and what the caller should do to fix its call.
Every error body, REST, WebSocket frame or MCP tool error, has the same fields: error (the text older clients match on), code (stable: branch on it), message, param (an invalid_param's parameter, when known), docs_url (this page, at the code) and request_id.
{"error": "limit must be 1..500", "code": "invalid_param", "message": "limit must be 1..500", "param": "limit",
"docs_url": "https://femtos.xyz/errors#invalid_param", "request_id": "6f1c2a9e-3b7d-4e2f-9a51-0c8d7e6b5a43"}request_id is the X-Request-Id header every answer carries, success too: send your own (up to 128 characters of A-Z a-z 0-9 _ . : / + = -) to follow a call, and quote it to support. 429 and the 503s that know when carry Retry-After. WebSocket error frames add channel and filter; their request_id is the upgrade's.
Codes
| Code | HTTP | Meaning | What to do |
|---|---|---|---|
| invalid_request | 400 | The request itself is malformed: a body that is not JSON, an unknown WebSocket op, a URL that does not parse. | Fix the request (JSON body, op subscribe / unsubscribe / ping) and send it again. |
| invalid_param | 400 | A parameter is missing or has a value the route does not accept; param names it when known. | Read message (the accepted values or range), fix param and send the call again. Never retry it unchanged. |
| invalid_payment | 400 | x402: the payment header does not decode (base64 JSON, fields, version). | Rebuild the payment from an accepts entry of this answer (reason says what is wrong) and send the request again. |
| 401 | An unknown, disabled or expired API key. A request with no key at all answers 402 payment_required instead (an x402 offer, and the link to a free key). | Send Authorization: Bearer <key>. No key yet: a free one at https://femtos.xyz/accounts/ or, for an agent, https://femtos.xyz/agents.md#agent-onboarding. | |
| invalid_ticket | 401 | WebSocket: the ticket is unknown, already used or older than 30 s. | POST /v1/ws-ticket with your key for a new ticket and open /v1/ws?ticket=<ticket> at once. |
| demo_pass_expired | 401 | The portal demo pass of this visitor expired. | Reload the page for a new pass, or use a free key. |
| payment_required | 402 | Payment needed: a medium, heavy or premium call of a key with no credits left or past its monthly spending cap (billing on); a free key's call of a route past its free trial (GET /v1/hypercore/liquidation-heatmap: 100 calls per account, then paid keys only, $10 prepaid or a plan; trial gives the calls used and allowed); any call (status and whoami apart) of an account created by an x402 payment with no credits left (no free tier); or, x402 on, a request with no key. A key whose account owes a debt it must pay first (plan overage past its float, a payment taken back; GET /v1/whoami billing debt) is refused every call but status and whoami, on every API, until it is paid in full: debtUsd says how much, and its x402 entries only amounts that cover it. | Top up (checkoutUrl), or pay one x402 entry of accepts and send the same request again with the payment header. In debt: pay at least debtUsd first (an x402 entry of this answer with the key, a USDC deposit to the key's deposit address, or https://femtos.xyz/accounts/billing); a smaller payment is refused, and nothing is served until the debt is paid in full. |
| payment_refused | 402 | x402: the payment was refused before settlement (reason: signature, amount, nonce, balance…). | Fix what reason names, sign a new payment from this answer's accepts and send the request again. |
| payment_failed | 402 | x402: the settlement transaction failed on chain, or was not sent (reason settlement_fee_too_high: gas on that network too high for this payment now); nothing was charged. | Sign a new payment from this answer's accepts (another network if it keeps failing), or send the same payment again later. |
| insufficient_balance | 402 | Femtos AI: the account's prepaid USD balance cannot cover the upper bound of this model call (neededUsd, what the account has: availableUsd). Femtos AI is paid from the balance only, never from credits. In a job: its error. | Top up the balance (https://femtos.xyz/accounts/billing, a USDC deposit, an x402 pack), or ask with a smaller max_tokens, a shorter conversation or a cheaper model. |
| forbidden | 403 | The request is not allowed for this caller. | Check message; another key or another call is needed. |
| account_frozen | 403 | x402: the paying wallet's account is frozen by its owner: the payment was credited, no key was issued. | The account owner unfreezes it with the key and the management secret (POST https://femtos.xyz/accounts/me/unfreeze), or, either lost, recovers it with the paying wallet's signature, no payment (POST https://femtos.xyz/accounts/x402/recover/challenge): a new, live key and management secret. |
| demo_pass_refused | 403 | The portal demo pass does not allow this call (GET only, femtos.xyz only, the sample's addresses only). | Use a free key to ask about anything else. |
| limit_reached | 403 | A limit of the key's tier is reached: webhook endpoints or subscriptions of the account, or its webhook deliveries a day (a replay past them). | Delete one first (DELETE /v1/webhooks/{id}), replay fewer deliveries (or after 00:00 UTC), or use a key of a higher tier. |
| not_found | 404 | The route exists, the thing asked does not: unknown token, coin, market, launch, pool, transaction, collection or entity, or an address that is not an ERC-20 (token security). | Check the identifier (layer, address, coin name); list endpoints (/v1/coins, /v1/markets, /v1/launches) give valid ones. |
| route_not_found | 404 | No route at this path. | Check the path against https://api.femtos.xyz/v1/openapi.json (REST lives under /v1/). |
| invalid_state | 409 | The resource is not in a state that allows this call: a webhook not verified yet asked for a test, a delivery still pending asked for a replay, an active webhook asked to enable. | Read the resource (GET) and do what its state needs first; message says what. |
| payload_too_large | 413 | The request body is over 64 KiB (512 KiB on POST /v1/elysium/rpc and POST /v1/hyperevm/rpc, 1 MiB on POST /v1/ai/chat and /v1/ai/jobs). | Send a smaller body. |
| rate_limited | 429 | Over the rate limit: the key's rps / burst (X-RateLimit-*), a keyless IP's, a paying wallet's, or the key's new token security reports (20 a minute). | Wait retryAfter seconds (Retry-After) and retry; a key of a higher tier has higher limits. |
| ai_busy | 429 | Femtos AI: this account already runs 4 calls at once (POST /v1/ai/chat), or has 32 jobs queued or running. | Wait retryAfter seconds, or send it as a job (POST /v1/ai/jobs): jobs queue behind the running calls. |
| too_many_connections | 429 | WebSocket upgrade refused: this key already holds its maxConns open connections. | Close a connection, or subscribe to more channels on one (64 per connection). |
| replay_window_too_large | 400 | WebSocket replay: the window (replay_from to replay_to) is longer than this key's tier replays (max_window_ms). | Ask for a shorter window, or replay it in several sessions one after the other; a higher tier replays longer windows. |
| replay_speed_not_allowed | 403 | WebSocket replay: speed=max (as fast as the client reads, book frames at their byte rate) is for paid tiers; this key replays at 100x at most (max_speed). A free key, or one past its credits, gets it at the upgrade or on replay.speed. | Ask for speed=1, 10 or 100. max needs a key on a paid tier with its billing ok: a plan (or a deal with Femtos), or pay-as-you-go once its account was credited at least $10 in all (USDC deposits, x402 packs; less keeps the free tier, whatever the balance), while it has credits or balance left. |
| replay_limit | 429 | WebSocket replay: this key already holds as many replay sessions as its tier allows (max_sessions). | Close a replay session (or let it end) before opening another; a higher tier holds more at once. |
| replay_before_checkpoints | WS frame | WebSocket replay: a book channel (hc.book, hc.bbo, hc.book.named) at a position with no book checkpoint at or before it. first_available is the first time it replays from (Unix ms; null when none is stored yet). Other channels of the session go on. | Subscribe again from first_available or later: replay.seek there, or open a replay that starts there. |
| too_many_subscriptions | WS frame | WebSocket: this connection already holds 64 subscriptions, 500 addresses over its wallets subscriptions, or its share of the server's live feeds (the address and filter feeds only it follows). | Unsubscribe from one first, or open another connection. |
| demo_pass_exhausted | 429 | The portal demo pass is used up (calls, WebSockets) or no pass is left for now. | Get a free key; retryAfter, when present, says when a pass is available again. |
| internal_error | 500 | An unexpected error on our side. | Retry later; if it persists, quote request_id to support. |
| upstream_error | 502 | A source behind the API (database, node, stream) answered with an error. | Retry with backoff; if it persists, quote request_id to support. |
| 503 | The source of this layer cannot answer now (database, table or snapshot missing, server down, layer not configured). | Retry later (after retryAfter seconds when the answer carries Retry-After); GET /v1/status shows each layer. | |
| 503 | Femtos AI cannot answer now: not enabled on this server, its models or its billing unreachable, or its capacity for today reached. Nothing was charged. | Retry after retryAfter seconds (Retry-After). | |
| 503 | The call asks for the Elysium testnet (network=testnet or the header X-Femtos-Network: testnet) and this server cannot answer it: the testnet is not served here, or it is frozen (its chain data stops at a date, message says which) and the call needs its node or a live feed (the JSON-RPC, a balance at a past block or verified on the node, a token security report, gas, a transaction status, a wallet value history, a webhook subscription). | Call without network (Elysium mainnet). On a frozen testnet the routes answered from stored data still answer (tokens, markets, candles, trades, transfers, holders, launches, blocks, balances); GET /v1/status?network=testnet shows its layer and, frozen, frozenSince. | |
| replay_book_limit | WS frame | WebSocket replay: a book channel (hc.book, hc.bbo, hc.book.named) while as many replay sessions with a book channel as allowed are open: this key's (per tier, 4 at most, a free key 1), or those of all keys (8, of which 3 of free keys). max_book_sessions says the limit reached. Only that subscription is refused: the session and its other channels go on. | Close another replay session of this key or unsubscribe its book channels, or subscribe again later. Other channels need no such slot. |
| 503 | WebSocket replay is not available. Off on this server: 503 at the upgrade. Its engine full or unreachable, or the replays of free keys holding their whole share of it: the upgrade succeeds (101), then an error frame with this code and replay.end. | Open /v1/ws without replay_from for the live stream; retry the replay later. | |
| syncing | 503 | The source is still syncing and cannot answer this call yet (order book syncing). | Retry after Retry-After seconds. |
| not_ready | 503 | An answer computed in the background is not there yet (the process just started). | Retry after retryAfter seconds (Retry-After). |
| server_busy | 503 | The server is saturated: the database query of this call waited too long for its turn or ran out of time, or too many heavy queries, token security simulations or WebSocket tickets are waiting. Nothing was charged. | Retry after retryAfter seconds (Retry-After), with backoff if it repeats. |
| 503 | x402: our payment verification could not run (chain or facilitator unreachable), or this server does not settle payments right now (reason settlement_paused: a deploy in progress); nothing was charged. | Send the same request with the same payment header again after Retry-After. | |
| payment_pending | 503 | x402: the payment was broadcast or settled, its crediting is not finished (error: settlement_pending or credit_pending). | Send the same request with the same payment header again after Retry-After: it is never charged twice. Paid without a key, that request is credited but not served (403, keyWithheld: "replay": the signature is public on chain by then): get a new key and management secret with the paying wallet's signature, no payment (recoverUrl: POST https://femtos.xyz/accounts/x402/recover/challenge), or pay again from the same wallet with no key. |
Markdown: this page as Markdown, JSON: errors.json, agents.md.
Agent guide (agents.md)llms.txtOpenAPIMCP serverGet an API keyChangelog