Browse all documentation

Errors and quota

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
{
  "ok": false,
  "type": "https://narwhalapi.com/problems/series-not-found",
  "title": "Economics series not found",
  "status": 404,
  "detail": "No complete approved economics publication matched the request.",
  "code": "series_not_found",
  "request_id": "019d1af4-8f33-7b21-91af-ef535f2dcf50",
  "instance": "/v1/economics/USA/cpi"
}

Statuses and codes

StatusPublic codeMeaning
400invalid_queryThe country, period, or other request input is invalid.
401invalid_api_keyThe Bearer key is missing, malformed, unknown, or inactive.
404series_not_foundNo complete approved publication matches the request.
404route_not_foundThe requested REST route does not exist.
404tool_not_foundThe requested MCP tool is not public or does not exist.
405method_not_allowedThe route exists but does not accept the requested HTTP method.
429quota_exhaustedThe account has used its monthly request allowance.
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.
503database_unavailableThe data store is temporarily unavailable.
503rights_state_changingNarwhal could not confirm that source permission stayed unchanged while preparing the response.

Quota headers

Every successful data response consumes quota exactly once and includes:

X-Request-IDX-RateLimit-LimitX-RateLimit-RemainingX-RateLimit-Reset

The reset is the start of the next UTC calendar month. A 429 also includes Retry-After. Responses with 400, 401, 404, 405, 429, 500, or 503 do not consume quota.

Retry behavior

  • Do not retry 400 until the request is corrected.
  • 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.