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. |
400 | range_ | The date window is longer than the route allows. Send a shorter window. |
400 | invalid_ | The interval is not one the route accepts. Stock bars take 1d or 1m. |
400 | invalid_ | A name search needs at least two letters or digits besides words like Inc. |
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. |
403 | account_ | The account is paused while a payment dispute is open. Contact hello@narwhalapi.com. |
403 | account_ | An account made through agent sign-up is waiting for its user to verify the emailed code. Monitors, webhooks, stream tickets, team invites and top-ups stay closed until then. |
403 | api_ | The monitor tools and report_missing_data need an API key as a Bearer token. An app sign-in is refused. |
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 | not_ | The country, market or listing is not covered for this data. |
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. |
410 | gone | The price stream has been removed. POST /v1/prices/stream-ticket answers this. |
413 | request_ | The request body is too large. |
422 | out_ | The date or year is outside the span the calendar system covers. The detail gives the span. |
422 | non_ | The date does not exist in that calendar, for example a day past the end of the month. |
422 | no_ | There is no sunrise on that day at that latitude (polar day or night), so the day has no sunrise-based value. |
422 | time_ | Send tz (an IANA time zone) with lat and lon. |
422 | location_ | Send lat and lon with a tz other than Asia/Kolkata. |
422 | inputs_ | A cost of capital input is not on file for this stock, so the figure cannot be worked out. |
422 | currency_ | The filings report in a currency other than the price currency. |
422 | risk_ | There is no government yield curve for the stock's country. Send risk_free, your own risk-free rate in percent. |
422 | not_ | The measure is not meaningful for this stock, for example WACC for a bank. |
422 | insufficient_ | The stock and its benchmark share too few returns to work out beta. |
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 | upstream_ | This data cannot be fetched right now. Retry after the seconds in Retry-After. |
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 your request bucket. X-RateLimit-Limit is the size of the bucket, the burst, not a count of requests per minute: 8 while your account has only free credit and 84 once it holds paid credit. The bucket refills at 50 requests a minute on free credit and 500 requests a minute on paid credit. X-RateLimit-Remaining is what is left in it and X-RateLimit-Reset is when it is full again, in UTC (ISO 8601). X-RateLimit-Short-Limit, X-RateLimit-Short-Remaining and X-RateLimit-Short-Reset carry the same values and are sent alongside. 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.
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?