Browse all documentation

Errors and credits

Handle Narwhal problems by HTTP status and stable machine-readable code.

REST errors use application/problem+json. 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.

RFC 9457 problem
{
  "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

StatusPublic codeMeaning
400invalid_queryThe country, period, or other request input is invalid.
400invalid_cursorThe pagination cursor is malformed or belongs to different filters.
400invalid_pairThe from and to currencies are the same.
400range_too_largeThe date window is longer than the route allows. Send a shorter window.
400invalid_intervalThe interval is not one the route accepts. Stock bars take 1d or 1m.
400invalid_nameA name search needs at least two letters or digits besides words like Inc.
401invalid_api_keyThe Bearer key is missing, malformed, unknown, or inactive.
402insufficient_creditsYour balance does not cover this call. The call did not run and cost nothing. Add credit at the top_up_url in the response.
403account_pausedThe account is paused while a payment dispute is open. Contact hello@narwhalapi.com.
403account_pendingAn 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.
403api_key_requiredThe monitor tools and report_missing_data need an API key as a Bearer token. An app sign-in is refused.
404series_not_foundNo approved current or historical observations match the request.
404resource_not_foundThe requested command resource is unavailable.
404event_not_foundNo event matches the id.
404not_foundNo calendar release matches the id.
404route_not_foundThe requested REST route does not exist.
404not_coveredThe country, market or listing is not covered for this data.
404tool_not_foundThe requested MCP tool is not public or does not exist.
404calendar_not_publishedThe requested country-year calendar has not been published.
404commodity_not_supportedThis commodity code is unavailable for spot prices or bars.
404currency_not_supportedThis commodity is not quoted in the requested currency.
404subscription_not_foundThe calendar subscription id is unknown or not yours.
404physical_series_not_foundNo physical price series matches the id.
404palmoil_series_not_foundNo palm oil series matches the id.
404webhook_request_failedThe webhook destination is unknown, or the delivery cannot be replayed.
405method_not_allowedThe route exists but does not accept the requested HTTP method.
409cursor_expiredThe cursor expired or its snapshot is unavailable. Calendar and events cursors also use this error. Restart without the cursor.
409physical_series_ambiguousThe selector matches more than one series.
409limit_reachedThe account's webhook destination limit has been reached.
410goneThe price stream has been removed. POST /v1/prices/stream-ticket answers this.
413request_too_largeThe request body is too large.
422out_of_rangeThe date or year is outside the span the calendar system covers. The detail gives the span.
422non_existent_dateThe date does not exist in that calendar, for example a day past the end of the month.
422no_sunriseThere is no sunrise on that day at that latitude (polar day or night), so the day has no sunrise-based value.
422time_zone_requiredSend tz (an IANA time zone) with lat and lon.
422location_requiredSend lat and lon with a tz other than Asia/Kolkata.
422inputs_unavailableA cost of capital input is not on file for this stock, so the figure cannot be worked out.
422currency_mismatchThe filings report in a currency other than the price currency.
422risk_free_unavailableThere is no government yield curve for the stock's country. Send risk_free, your own risk-free rate in percent.
422not_applicableThe measure is not meaningful for this stock, for example WACC for a bank.
422insufficient_historyThe stock and its benchmark share too few returns to work out beta.
429rate_limit_exceededThe network or account per-minute limit was reached; retry after Retry-After.
500internal_errorNarwhal could not complete the request.
503api_disabledThe public data gate is temporarily closed.
503economics_unavailableNarwhal cannot safely satisfy the request from an accepted official publication.
503calendar_coverage_unavailableThe calendar cannot be served safely right now.
503database_unavailableThe data store is temporarily unavailable.
503rights_state_changingNarwhal could not confirm that source permission stayed unchanged while preparing the response.
503predictions_unavailablePrediction data cannot be served safely right now.
503upstream_unavailablePrice or rate data cannot be read right now.
503upstream_busyThis data cannot be fetched right now. Retry after the seconds in Retry-After.
503palmoil_unavailablePalm oil data cannot be served safely right now.
503physical_price_unavailablePhysical price data cannot be served safely right now.
503physical_reference_unavailablePhysical series data cannot be served safely right now.
503rate_limiter_unavailableNarwhal could not check your rate limit. Retry shortly.
503command_unavailableThe account command could not be completed right now.
503webhook_unavailableWebhooks 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-Reset

X-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_limit_exceeded includes Retry-After and costs nothing.

When your credit runs out

A call that your balance cannot pay for is refused with 402 insufficient_credits. It carries the cost of the call, your balance and a link to add credit.

402 insufficient_credits
{
  "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 400 until the request is corrected.
  • Do not retry 402 until you have added credit.
  • Do not retry 401 with the same rejected key.
  • Retry 429 only after Retry-After or X-RateLimit-Reset.
  • Retry idempotent requests after 500 or 503 with bounded exponential backoff and jitter.
  • A 404 series_not_found may become available only after a supported official release is published.

Ask for help

Send the endpoint, UTC time, status, code, and request_id to Narwhal API support. Never include the API key.

Return to the quickstart or review the Economics API reference.

Was this page helpful?