curl --request GET \
--url https://api.financialdatasets.ai/macro/inflation \
--header 'X-API-KEY: <api-key>'import requests
url = "https://api.financialdatasets.ai/macro/inflation"
headers = {"X-API-KEY": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-KEY': '<api-key>'}};
fetch('https://api.financialdatasets.ai/macro/inflation', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.financialdatasets.ai/macro/inflation",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.financialdatasets.ai/macro/inflation"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-KEY", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.financialdatasets.ai/macro/inflation")
.header("X-API-KEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.financialdatasets.ai/macro/inflation")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-KEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"inflation": [
{
"series": "<string>",
"date": "<string>",
"value": 123,
"change_1m_pct": 123,
"change_12m_pct": 123
}
],
"next_page_url": "<string>"
}{
"error": "Bad Request",
"message": "Invalid request parameters"
}{
"error": "Unauthorized",
"message": "Invalid API key provided"
}{
"error": "Payment Required",
"message": "This endpoint requires a paid subscription. Please upgrade your plan."
}{
"error": "Not Found",
"message": "Ticker XXXX not found"
}Historical
Get monthly US consumer price index history since 1947: headline and core CPI plus food, energy, shelter, and services, with month-over-month and year-over-year changes.
curl --request GET \
--url https://api.financialdatasets.ai/macro/inflation \
--header 'X-API-KEY: <api-key>'import requests
url = "https://api.financialdatasets.ai/macro/inflation"
headers = {"X-API-KEY": "<api-key>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {'X-API-KEY': '<api-key>'}};
fetch('https://api.financialdatasets.ai/macro/inflation', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.financialdatasets.ai/macro/inflation",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"X-API-KEY: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.financialdatasets.ai/macro/inflation"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-API-KEY", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.financialdatasets.ai/macro/inflation")
.header("X-API-KEY", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.financialdatasets.ai/macro/inflation")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-API-KEY"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"inflation": [
{
"series": "<string>",
"date": "<string>",
"value": 123,
"change_1m_pct": 123,
"change_12m_pct": 123
}
],
"next_page_url": "<string>"
}{
"error": "Bad Request",
"message": "Invalid request parameters"
}{
"error": "Unauthorized",
"message": "Invalid API key provided"
}{
"error": "Payment Required",
"message": "This endpoint requires a paid subscription. Please upgrade your plan."
}{
"error": "Not Found",
"message": "Ticker XXXX not found"
}Overview
The Inflation API lets you pull the monthly US Consumer Price Index (CPI) for one series at a time, from 1947 to today, with the month-over-month and year-over-year percent changes computed for you. We source the data directly from authoritative government sources. Values are index levels (1982-84 = 100); the changes are percentages. To get started, please create an account and grab your API key at financialdatasets.ai. You will use the API key to authenticate your API requests.Coverage
| History | Series | Updated |
|---|---|---|
| 1947 to today | 12 | Monthly |
Series
Six concepts, each seasonally adjusted (_sa) and not seasonally adjusted (_nsa):
| Series | What it is | From |
|---|---|---|
cpi_all_sa, cpi_all_nsa | All items | 1947 |
cpi_core_sa, cpi_core_nsa | All items less food and energy | 1957 |
cpi_food_sa, cpi_food_nsa | Food | 1947 |
cpi_energy_sa, cpi_energy_nsa | Energy | 1957 |
cpi_shelter_sa, cpi_shelter_nsa | Shelter | 1953 |
cpi_services_less_energy_sa, cpi_services_less_energy_nsa | Services less energy services | 1957 (NSA), 1967 (SA) |
GET request to:
https://api.financialdatasets.ai/macro/inflation/series/
Reading the fields
dateis the reference month as its first day:2026-08-01is the August 2026 print, which is published in mid September. It is not the release date.valueis the published index level.change_1m_pctis the percent change from the prior month andchange_12m_pctfrom the same month a year earlier, both rounded to one decimal. The headline “inflation rate” ischange_12m_pctofcpi_all_nsa; the headline monthly figure ischange_1m_pctofcpi_all_sa.- A field is
nullwhen the comparison month was not published. October 2025 isnullin every series because no October 2025 CPI was published, so the November 2025 1-month change and the October 2026 12-month change arenulltoo. - History is the latest published values. When a past month is revised, the stored value is replaced.
Getting Started
There are only 3 steps for making a successful API call:- Add your API key to the header of the request as
X-API-KEY. - Add the
seriesparameter, which is required. Optionally addstart_dateandend_date(inclusive,YYYY-MM-DD; any day inside a month selects that month). With no dates you get the trailing five years. - Execute the API request.
next_page_url; request it as-is to get the next page. See the pagination guide.
Example
import requests
# add your API key to the headers
headers = {
"X-API-KEY": "your_api_key_here"
}
# set parameters
series = 'cpi_all_sa' # required
start_date = '2025-09-01' # optional
end_date = '2026-08-31' # optional
# create the URL with parameters
url = (
f'https://api.financialdatasets.ai/macro/inflation'
f'?series={series}'
f'&start_date={start_date}'
f'&end_date={end_date}'
)
# make API request
response = requests.get(url, headers=headers)
# parse the observations from the response
inflation = response.json().get('inflation')
Example Response
{
"inflation": [
{
"series": "cpi_all_sa",
"date": "2026-08-01",
"value": 334.131,
"change_1m_pct": 0.4,
"change_12m_pct": 3.4
}
]
}
Authorizations
API key for authentication.
Query Parameters
The series id, e.g. cpi_all_sa. Six concepts (all items, core, food, energy, shelter, services less energy), each seasonally adjusted (_sa) and not (_nsa). Use the /macro/inflation/series endpoint to get the list.
The first month to return, inclusive, in YYYY-MM-DD format; any day inside a month selects that month. Defaults to five years before end_date when both dates are omitted; omit it with an end_date to get all available history through that month.
The last month to return, inclusive, in YYYY-MM-DD format. Defaults to today.
Opaque pagination cursor from a previous response's next_page_url. When provided, all other query parameters are ignored: the cursor carries the original request's filters. Treat it as opaque; do not construct or modify it.