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.
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.
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.
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.
413request_too_largeThe request body is too large.
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.
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 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_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 for the first 12 months of an account.

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?