Skip to main content

Errors

Every error answers with a JSON body. Branch on code, not on the error text.

{
"error": "insufficient balance, top up to continue",
"code": "insufficient_balance",
"hint": "The prepaid balance is too low for this call. Top up, or turn on auto top-up, at https://datamaxiplus.com/dashboard/billing.",
"docs_url": "https://docs.datamaxiplus.com/api/pricing",
"request_id": "…",
"charged": false
}
FieldMeaning
errorA short message. It can change; don't parse it.
codeA stable code from the table below.
hintOne line on what to do next. Agents can show it as is.
docs_urlThe docs page for this error, when there is one.
request_idQuote it when you contact us.
chargedAlways false: only successful responses are charged.

Error codes​

HTTPcodeWhat happenedWhat to do
400invalid_requestA parameter is missing or not supported. error says which.Fix the request. Check the endpoint's parameters in the REST reference.
401missing_api_keyNo API key on a paid endpoint.Send the key in X-DTMX-APIKEY. See Authentication.
401invalid_api_keyThe key is mistyped, rotated or revoked.Copy an active key from My page → API keys.
401api_key_not_allowedThe key's account can't use this endpoint.Check the endpoint's access, or contact us.
401origin_not_allowedA browser call from an origin that isn't accepted.Call the API from your server with a key.
402insufficient_balanceThe balance can't pay for this call.Top up, or turn on auto top-up. See When your balance runs out.
402balance_expiredThe balance expired 12 months after the latest top-up.Top up to continue.
402key_spend_capThis named key reached its own spend cap. The balance is untouched.Wait for resets_at, raise the cap, or use another key. See Spend caps.
403key_ip_not_allowedThis named key has an IP allowlist and the request came from another address.Call from an allowed address, or edit the key's allowed IPs. See IP allowlists.
404not_foundUnknown path, symbol or exchange.Check the path and the supported values.
405method_not_allowedWrong HTTP method.Data endpoints are GET.
408, 504timeoutThe request took too long.Retry, or narrow it: a shorter time range or fewer rows.
429rate_limitedOver the per-minute limit for the account.Wait the seconds in Retry-After. See Limits.
500server_errorSomething went wrong on our side.Retry in a few seconds. If it keeps failing, contact us with the request_id.
502, 503service_unavailableThe service is briefly unavailable.Retry with backoff.

The three 402 bodies also carry balance_url, auto_topup_url, topup_url and billing_url, and a key_spend_cap body adds resets_at (RFC 3339, UTC). Treat 401, 402 and 403 as a signal to fix the key or the balance, not to retry: the same request fails until you do.

Accounts still on a legacy subscription plan can also see plan_required, subscription_expired, no_credit and credit_limit_exceeded; the hint says what to do. See Legacy subscription plans.

Over MCP​

MCP tools return the same errors as the API call behind them. On insufficient_balance or balance_expired, the tool error tells the agent to call get_usage and topup. On key_spend_cap, it keeps the API's hint, because the balance is fine and only that key is capped.

WebSocket​

The same checks run when a stream opens, so a refused connection answers with the codes above. An open stream is closed when the balance runs out or a named key reaches its spend cap. Top up or raise the cap, then reconnect.