Errors and credits
Handle Narwhal problems by HTTP status and stable machine-readable code.
REST errors use application/. MCP tool errors carry the same problem fields in structured content.
Problem response
Branch on status first and code second. Treat detail as human-readable diagnostic text, not a stable programmatic value.
{
"type": "https://narwhalapi.com/problems/series-not-found",
"title": "Economics series not found",
"status": 404,
"detail": "No approved economics observations matched the request.",
"code": "series_not_found",
"request_id": "019d1af4-8f33-7b21-91af-ef535f2dcf50"
}Statuses and codes
| Status | Public code | Meaning |
|---|---|---|
400 | invalid_ | The country, period, or other request input is invalid. |
400 | invalid_ | The pagination cursor is malformed or belongs to different filters. |
400 | invalid_ | The from and to currencies are the same. |
401 | invalid_ | The Bearer key is missing, malformed, unknown, or inactive. |
402 | insufficient_ | Your balance does not cover this call. The call did not run and cost nothing. Add credit at the top_up_url in the response. |
404 | series_ | No approved current or historical observations match the request. |
404 | resource_ | The requested command resource is unavailable. |
404 | event_ | No event matches the id. |
404 | not_ | No calendar release matches the id. |
404 | route_ | The requested REST route does not exist. |
404 | tool_ | The requested MCP tool is not public or does not exist. |
404 | calendar_ | The requested country-year calendar has not been published. |
404 | commodity_ | This commodity code is unavailable for spot prices or bars. |
404 | currency_ | This commodity is not quoted in the requested currency. |
404 | subscription_ | The calendar subscription id is unknown or not yours. |
404 | physical_ | No physical price series matches the id. |
404 | palmoil_ | No palm oil series matches the id. |
404 | webhook_ | The webhook destination is unknown, or the delivery cannot be replayed. |
405 | method_ | The route exists but does not accept the requested HTTP method. |
409 | cursor_ | The cursor expired or its snapshot is unavailable. Calendar and events cursors also use this error. Restart without the cursor. |
409 | physical_ | The selector matches more than one series. |
409 | limit_ | The account's webhook destination limit has been reached. |
413 | request_ | The request body is too large. |
429 | rate_ | The network or account per-minute limit was reached; retry after Retry-After. |
500 | internal_ | Narwhal could not complete the request. |
503 | api_ | The public data gate is temporarily closed. |
503 | economics_ | Narwhal cannot safely satisfy the request from an accepted official publication. |
503 | calendar_ | The calendar cannot be served safely right now. |
503 | database_ | The data store is temporarily unavailable. |
503 | rights_ | Narwhal could not confirm that source permission stayed unchanged while preparing the response. |
503 | predictions_ | Prediction data cannot be served safely right now. |
503 | upstream_ | Price or rate data cannot be read right now. |
503 | palmoil_ | Palm oil data cannot be served safely right now. |
503 | physical_ | Physical price data cannot be served safely right now. |
503 | physical_ | Physical series data cannot be served safely right now. |
503 | rate_ | Narwhal could not check your rate limit. Retry shortly. |
503 | command_ | The account command could not be completed right now. |
503 | webhook_ | Webhooks cannot be served right now. |
Credit headers
Every call that is charged returns the cost of the call and your balance after it. Both are in US dollars with six decimals.
X-Request-IDX-Narwhal-CostX-Narwhal-BalanceX-RateLimit-LimitX-RateLimit-RemainingX-RateLimit-ResetX-Narwhal-Cost is what this call took from your balance, for example 0.002000 for one Economics call. X-Narwhal-Balance is your free, bonus and paid credit added together. Errors and responses that say nothing changed cost nothing.
The X-RateLimit-* headers describe the per-minute limit only. The limit is 50 requests a minute while your account has only free credit, and 500 requests a minute once it holds paid credit. A request for several ids is one request. A separate abuse-protection bucket allows 120 requests per minute with a burst of 20 for one network identity, so clients sharing an address can be throttled together. A 429 rate_ includes Retry-After and costs nothing.
When your credit runs out
A call that your balance cannot pay for is refused with 402 insufficient_. It carries the cost of the call, your balance and a link to add credit.
{
"type": "https://narwhalapi.com/docs/errors#insufficient_credits",
"title": "Insufficient credits",
"status": 402,
"code": "insufficient_credits",
"detail": "This call costs $0.002. Your balance is $0.000. Top up at https://narwhalapi.com/dashboard/billing",
"top_up_url": "https://narwhalapi.com/dashboard/billing",
"cost_micro": 2000,
"balance_micro": 0
}cost_micro and balance_micro are whole millionths of a dollar, so 2000 is $0.002. Do not retry a 402 until the balance has changed. Free credit renews on the first day of each month for the first 12 months of an account.
Retry behavior
- Do not retry
400until the request is corrected. - Do not retry
402until you have added credit. - Do not retry
401with the same rejected key. - Retry
429only afterRetry-AfterorX-RateLimit-Reset. - Retry idempotent requests after
500or503with bounded exponential backoff and jitter. - A
404 series_may become available only after a supported official release is published.not_ found
Ask for help
Send the endpoint, UTC time, status, code, and request_ to Narwhal API support. Never include the API key.
Return to the quickstart or review the Economics API reference.
Was this page helpful?