Keep the key out of the URL
Store your Narwhal key as a secret or environment variable. Send it in the Authorization header as a Bearer token. Do not put it in a query string, commit it to a repository, or expose it in browser code.
Call the CPI endpoint
Omit the period to retrieve the latest accepted complete release.
curl --request GET \
--url https://api.narwhalapi.com/v1/economics/USA/cpi \
--header "Authorization: Bearer $NARWHAL_API_KEY"Read the response
The response is typed JSON without a generic data wrapper. Decimal values are strings so clients do not silently lose precision. Missing values stay missing; they do not become zero.
{
"country": "USA",
"period": "2026-07",
"value": "333.918",
"base_period": "1982-84",
"base_value": "100",
"released_on": "2026-08-12"
}Change the country or operation
Replace USA with AUS, CAN, DEU, FRA, GBR, JPN, MYS, or SGP to request the same measure for another live country. Replace cpi with another documented operation path for inflation, unemployment, labour-force participation, GDP, GDP growth, trade, exports, or imports.
Handle errors by status and code
A 400 response means the request is invalid. A 401 means the API key is missing or invalid. A 404 means the requested route or series is not available. A 429 means the quota is exhausted. A 503 means the requested data or service cannot be served safely at that moment.
Error bodies use application/problem+json and include a request ID. Retry 500 and 503 responses with bounded backoff. Fix 400 and 401 responses before trying again, and wait for the documented reset before retrying a 429.
REST and MCP use the same data
The MCP tools use the same key, stored publications, response schemas, and data quota as REST. Choose the interface that fits your application; the underlying economic data is the same.
