Economic Indicators
Metric History
/v2/metrics/{metric_code}/historyReturns the full time-series history for a specific macroeconomic metric and country. Supports cursor-based pagination for large result sets.
Included in: Growth.
Authentication
Send your API key in the x-api-key header on every request to https://api.bavest.co. The samples read it from the BAVEST_API_KEY environment variable. Get an API key · Authentication guide
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
| metric_code | path | string | yes | Metric code to retrieve history for. See EconomyMetricCode schema for all 63 available codes (e.g. CPI, GDP_REAL, UNEMPLOYMENT_RATE). One of Example |
| country | query | string | yes | ISO 3166-1 alpha-2 country code (e.g. US, DE, JP) Example |
| from | query | string (date) | no | Start date for the time series (YYYY-MM-DD) |
| to | query | string (date) | no | End date for the time series (YYYY-MM-DD) |
| source | query | string | no | Filter by data source code (e.g. BLS, FRED, EUROSTAT) Example when explicitly filtering: |
| vintage | query | string | no | Vintage date for revision tracking. Returns the data as it was known on this date. Example when explicitly filtering: |
| cursor | query | string | no | Pagination cursor (reference_period value from previous response's next_cursor). Use instead of from for subsequent pages. |
| limit | query | integer (int32) | no | Maximum number of observations to return per page (default 1000, max 1000) Default |
Try it
Metric code to retrieve history for. See EconomyMetricCode schema for all 63 available codes (e.g. CPI, GDP_REAL, UNEMPLOYMENT_RATE).
ISO 3166-1 alpha-2 country code (e.g. US, DE, JP)
GET /v2/metrics/CPI/history?country=US
Sent only to api.bavest.co for this request; not stored.
Response 200
Successful response · application/json
dataMetricsHistoryResponseFull time-series history for a macroeconomic metric in a single country.
categorystring | nullMetric category (e.g. inflation, gdp, employment)
Example
inflationcountrystringISO 3166-1 alpha-2 country code
Example
USfromstring (date) | nullEarliest reference period in the returned data
Example
2020-01-01tostring (date) | nullLatest reference period in the returned data
Example
2026-02-01next_cursorstring | nullCursor for the next page of results. Pass as the cursor query parameter to fetch the next page. Null when there are no more pages.
Example
2020-01-01metricsarray of MetricsHistoryMetricMetric time-series data (always a single-element array for the requested metric)
metaResponseMetaResponse envelope metadata. Always present on a 200:
timeis set bycore/response.pyon every successful response. Errors carry the same block, built by the same code, so a client parses one meta shape whether the call succeeded or failed.timeintegerServer-side processing time in milliseconds
Example
17parametersobjectEcho of the request parameters the endpoint resolved
Errors
- 400Invalid request parameters. Returned when required query parameters are missing, have invalid types, or violate constraints (e.g., providing both symbol and isin when they are mutually exclusive).
- 401Missing or invalid API key.
- 404Resource not found.
- 429Rate limit exceeded. Retry after the `Retry-After` header interval.
- 500An unexpected error occurred on the server. If the issue persists, contact support with the X-Request-Id header value.
- 502Upstream data provider returned an error or is temporarily unavailable. Retry after a short delay.
- 504The request timed out waiting for a response from the upstream data provider. This may occur for complex queries or during peak load.
- defaultAn unexpected error occurred on the server. If the issue persists, contact support with the X-Request-Id header value.

