BLS API: Get inflation rate
Gets the latest U.S. Consumer Price Index inflation for a spending category, with up to 24 recent months of history. Monthly changes are seasonally adjusted; 12-month changes are not.
Unofficial. Not affiliated with or endorsed by BLS.
Inputs
Values from the run on Oct 23, 2026, shown under Output.
- Months optional
months Number of recent months to list, for example 6; at most 24.
4
Whole number from 1 to 24. Default
1.- Category optional
category Spending area, such as food at home or gasoline.
gasoline
One of
all items,food,food at home,energy,gasoline,shelter,rent,electricity,new vehicles,used cars,medical care,apparel. Defaultall items.
Input as JSON
{ "months": 4, "category": "gasoline"}Output
{ "link": "https://www.bls.gov/news.release/cpi.htm" , "history": [ { "month": "2026-09", "one_month_percent": 9.1, "twelve_month_percent": 34.2 }, { "month": "2026-08", "one_month_percent": 3.9, "twelve_month_percent": 27.4 }, { "month": "2026-07", "one_month_percent": -2.9, "twelve_month_percent": 24.6 } ], "category": "gasoline", "latest_month": "2026-09", "release_date": "2026-10-14", "cpi_index_level": 383.182, "next_release_date": "2026-11-10", "one_month_percent": 9.1, "twelve_month_percent": 34.2, "unadjusted_series_id": "CUUR0000SETB01", "core_twelve_month_percent": 2.6, "core_unadjusted_series_id": "CUUR0000SA0L1E", "seasonally_adjusted_series_id": "CUSR0000SETB01"}Code
curl https://api.fous.com/v1/runs \ -H "Authorization: Bearer $FOUS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"method":"bls.gov/get_inflation_rate","input":{"months":4,"category":"gasoline"}}' # Save as fous.py, then run: python3 fous.pyimport json, os, timefrom urllib.error import HTTPErrorfrom urllib.request import Request, urlopenAPI = "https://api.fous.com/v1/runs" KEY = os.environ["FOUS_API_KEY"]HEADERS = { "Authorization": f"Bearer {KEY}", "Content-Type": "application/json" ,}def call(url, body=None): data = json.dumps(body).encode() if body else None request = Request(url, data, HEADERS) try: with urlopen(request, timeout=120) as r: return r.status, json.load(r) except HTTPError as error: message = json.load(error)["error"]["message"] raise RuntimeError(message) from errorstatus, run = call(API, { "method": "bls.gov/get_inflation_rate" , "input": { "months": 4, "category": "gasoline" }})# 202: still going after 30 s. Ask again until it ends.while status == 202: time.sleep(2) status, run = call(f"{API}/{run['id']}")print(json.dumps(run["data"], indent=2))// Save as fous.mjs, then run: node fous.mjsconst api = "https://api.fous.com/v1/runs" ;const headers = { Authorization: `Bearer ${process.env.FOUS_API_KEY}`, "Content-Type": "application/json" ,};let response = await fetch(api, { method: "POST", headers, body: JSON.stringify({ "method": "bls.gov/get_inflation_rate" , "input": { "months": 4, "category": "gasoline" } }), signal: AbortSignal.timeout(120_000),});let run = await response.json();// 202: still going after 30 s. Ask again until it ends.while (response.status === 202) { await new Promise((done) => setTimeout(done, 2_000)); response = await fetch(`${api}/${run.id}`, { headers }); run = await response.json();}if (!response.ok) throw new Error(run.error.message);console.log(run.data);# Connect your agent to Fous once, over MCP (Streamable HTTP):# https://api.fous.com/mcp# Set FOUS_API_KEY first: create a key at https://app.fous.com/keys.# Claude Codeclaude mcp add \ --scope user \ --transport http fous https://api.fous.com/mcp \ --header "Authorization: Bearer ${FOUS_API_KEY:?Set FOUS_API_KEY to your Fous API key}"# Codexcodex mcp add fous \ --url https://api.fous.com/mcp \ --bearer-token-env-var FOUS_API_KEY# Cursor, VS Code, Windsurf, Cline and morenpx -y add-mcp https://api.fous.com/mcp -g -n fous \ --header "Authorization: Bearer ${FOUS_API_KEY:?Set FOUS_API_KEY to your Fous API key}"# Then ask your agent:# "Use Fous to run bls.gov/get_inflation_rate# with {"months":4,"category":"gasoline"}"Over HTTP, the answer’s data holds the output. A run still going after 30 seconds answers 202 with its id: ask GET /v1/runs/{id} until it ends.
Schema
Input schema
{ "type": "object", "properties": { "months": { "type": "integer", "default": 1, "maximum": 24, "minimum": 1, "description": "Number of recent months to list, for example 6; at most 24." }, "category": { "enum": [ "all items", "food", "food at home", "energy", "gasoline", "shelter", "rent", "electricity", "new vehicles", "used cars", "medical care", "apparel" ], "type": "string", "default": "all items", "description": "Spending area, such as food at home or gasoline." } }}Output schema
{ "type": "object", "required": [ "category", "latest_month", "twelve_month_percent", "one_month_percent", "core_twelve_month_percent", "release_date", "link", "cpi_index_level", "unadjusted_series_id", "seasonally_adjusted_series_id", "core_unadjusted_series_id" ], "properties": { "link": { "type": "string" }, "history": { "type": "array", "items": { "type": "object", "properties": { "month": { "type": "string" }, "one_month_percent": { "type": [ "number", "null" ] }, "twelve_month_percent": { "type": [ "number", "null" ] } } } }, "category": { "type": "string" }, "latest_month": { "type": "string" }, "release_date": { "type": "string" }, "cpi_index_level": { "type": "number" }, "next_release_date": { "type": [ "string", "null" ] }, "one_month_percent": { "type": "number" }, "twelve_month_percent": { "type": "number" }, "unadjusted_series_id": { "type": "string" }, "core_twelve_month_percent": { "type": "number" }, "core_unadjusted_series_id": { "type": "string" }, "seasonally_adjusted_series_id": { "type": "string" } }}- Price
- 1 credit per completed run (1¢ with pay as you go); failed runs are free.
- Method
bls.gov/get_inflation_rate- Returns
- latest month, 12-month and 1-month percent changes, core inflation, release dates, history
Use it from your agent
Give your agent this line. It reads SKILL.md, gets a Fous API key and connects the Fous MCP server. Its run then takes the method bls.gov/get_inflation_rate with the inputs above.
Ask your agent
- What is the latest 12-month change in gasoline prices from the CPI, with the last 6 months of history?
- Show me the most recent monthly CPI change for food at home, seasonally adjusted.
- I need the current inflation rate for shelter over the past 24 months from bls.gov.
- What were rent and electricity CPI changes last month, and when was that data released?
- Give me the all items consumer price index inflation for the latest month plus core inflation figures.
See more
All BLS methodsConverts a US dollar amount from one month or annual average to another using the US city average CPI-U for all items, not seasonally adjusted. Defaults to the latest published month.
bls.gov/calculate_inflationGets the latest seasonally adjusted unemployment rate and labor-force counts for the United States or a state, with up to 24 months of history.
bls.gov/get_unemployment_rateFinds the latest published BLS pay and employment for an occupation in the US, a state, or a metro area, and compares it with the national median.
bls.gov/get_occupation_wagesFinds the best-matching Occupational Outlook Handbook profile for a job title and returns its pay, entry requirements, jobs and 10-year outlook.
bls.gov/get_occupation_outlookGets a state's latest monthly electricity price for a customer type from EIA. It also returns the year-over-year change, the year-to-date average and the matching US average.
eia.gov/get_electricity_pricesGets the latest weekly EIA retail gasoline and on-highway diesel prices for a U.S. area, with changes from the prior week and from 52 weeks earlier.
eia.gov/get_fuel_pricesReturns seven key economic indicators for a country from its public Trading Economics overview: GDP growth rate, inflation rate, interest rate, unemployment rate, government debt to GDP, currency and stock market. Indicators absent from the overview are null; the US dollar index is not reported as a USD exchange rate.
tradingeconomics.com/get_country_overviewGets decades of yearly commodity or stock-index price history from Macrotrends: yearly average, open, high, low, close, annual change and inflation-adjusted value for gold, silver, crude oil, natural gas, copper, Dow Jones, S&P 500 and Nasdaq. The current year may be incomplete.
macrotrends.net/get_long_term_price_history