DEV Community

Synergic-Apis
Synergic-Apis

Posted on

How to get US inflation data by API — CPI since 1913 (2026 guide)

If you need US inflation data in your app, the official source is the Consumer Price Index (CPI-U) published monthly by the Bureau of Labor Statistics — and the fastest way to consume it is a JSON API that already computes the year-over-year and month-over-month rates for you. In this guide you'll query the latest CPI for 11 categories, pull monthly history back to 1913, and download the full annual series in a single call — all on a free API key (500 requests/month, no credit card).

What "US inflation" actually means (and why the raw BLS data is painful)

When the press says "inflation was 3.5% in June", they mean the year-over-year change of the CPI-U index, not seasonally adjusted (NSA). The month-over-month figure, on the other hand, is conventionally quoted seasonally adjusted (SA). Two different series, two different conventions — and the BLS distributes them as index levels, not rates, so you have to compute the percentages yourself, rounding to 1 decimal exactly the way the BLS does or your numbers won't match the headlines.

The US Inflation API does that work server-side. It serves the official CPI-U (U.S. city average) as clean, versioned JSON:

  • 11 categories: all-items (headline), core, energy, food, housing, apparel, transportation, medical, recreation, education-communication, other
  • Both NSA and seasonally adjusted variants (adjusted=true|false)
  • YoY and MoM rates precomputed from the index, 1 decimal, matching the BLS methodology
  • Monthly history back to 1913 for the headline, plus the official annual averages (the M13 rows)
  • A bonus: the famous average price basket in dollars — eggs, gasoline, milk, bread, ground beef, coffee, electricity

Data refreshes automatically on each monthly CPI release (8:30 AM ET, scheduled days 10–18 of the following month). Everything is a JSON number — no strings pretending to be numbers.

Get a free API key

  1. Sign up at synergicapis.com — the free tier is 500 requests/month, no credit card.
  2. Grab your key and send it in the X-Api-Key header.

That's it. First call:

curl -s "https://api.synergicapis.com/inflation/latest" \
  -H "X-Api-Key: YOUR_API_KEY"
Enter fullscreen mode Exit fullscreen mode

Response (example data — the real call returns the latest published month):

{
  "data": [
    {
      "category": "all-items",
      "adjusted": false,
      "period": "2026-06",
      "index": 333.952,
      "yoy_pct": 3.5,
      "mom_pct": -0.3,
      "source": "BLS"
    },
    {
      "category": "core",
      "adjusted": false,
      "period": "2026-06",
      "index": 336.882,
      "yoy_pct": 2.7,
      "mom_pct": 0,
      "source": "BLS"
    }
  ],
  "meta": { "source": "U.S. Bureau of Labor Statistics", "area": "us" }
}
Enter fullscreen mode Exit fullscreen mode

That single response is the whole "inflation report table": every category, latest month, rates included.

Endpoints

Endpoint What it returns
GET /inflation/latest Latest CPI point of all 11 categories (the report table)
GET /inflation/{category} Latest point of one category
GET /inflation/{category}/history Monthly history (headline since 1913), paginated
GET /inflation/{category}/annual Official annual averages (headline since 1913)
GET /prices Latest US average price of eggs, gasoline, milk, bread, ground beef, coffee, electricity
GET /prices/{item}/history Monthly price history of one item (gasoline since 1976)
GET /health Liveness check (not rate limited)

Common query params: adjusted=true|false (default false = NSA, the YoY convention), start/end (YYYY-MM), limit (1–100 for monthly, up to 150 for annual).

Python: the full history since 1913

Pagination is keyset-based: each page's meta.next_end is the end you pass for the next page; it's null on the last page. This loop pulls every monthly headline point since 1913:

import requests

BASE = "https://api.synergicapis.com"
HEADERS = {"X-Api-Key": "YOUR_API_KEY"}

def full_history(category="all-items"):
    points, end = [], None
    while True:
        params = {"limit": 100}
        if end:
            params["end"] = end
        r = requests.get(f"{BASE}/inflation/{category}/history",
                         headers=HEADERS, params=params)
        r.raise_for_status()
        body = r.json()
        points.extend(body["data"])
        end = body["meta"]["next_end"]
        if end is None:
            return points

history = full_history()
print(len(history), "monthly points, oldest:", history[-1]["period"])
Enter fullscreen mode Exit fullscreen mode

If you only need annual data, one call is enough — limit=150 returns the complete official annual-average series in a single page:

r = requests.get(f"{BASE}/inflation/all-items/annual",
                 headers=HEADERS, params={"limit": 150})
annual = r.json()["data"]   # 1913 ... today, done
Enter fullscreen mode Exit fullscreen mode

Example annual point, straight from the official M13 rows:

{ "category": "all-items", "period": "2025", "index": 321.348, "source": "BLS" }
Enter fullscreen mode Exit fullscreen mode

JavaScript: current inflation rate in 10 lines

const BASE = "https://api.synergicapis.com";

const res = await fetch(`${BASE}/inflation/all-items`, {
  headers: { "X-Api-Key": "YOUR_API_KEY" },
});
const { data } = await res.json();

console.log(
  `US inflation (${data.period}): ${data.yoy_pct}% YoY, ${data.mom_pct}% MoM`
);
// e.g. "US inflation (2026-06): 3.5% YoY, -0.3% MoM"  (example data)
Enter fullscreen mode Exit fullscreen mode

Want the seasonally adjusted variant (the one used for month-over-month analysis)? Add ?adjusted=true.

Good to know: the honest edge cases

  • October 2025 does not exist. The BLS never published that month (federal shutdown). It's a real hole in the official record — this API serves it as a hole, not an interpolation. Rates that need it (Nov-2025 MoM, Oct-2026 YoY) come back as null, never invented.
  • Rates can be null at series starts for the same reason: no mirror month, no rate.
  • Responses are cacheable (Cache-Control, ETag/If-None-Match304) and include RateLimit-* budget headers, so a well-behaved client can poll cheaply. A 429 includes Retry-After.
  • Errors follow one uniform contract: { "error": { "code": "...", "message": "..." } } with stable codes like CATEGORY_NOT_FOUND or VALIDATION_ERROR.

Pricing

The free tier (500 req/month, no card) covers a dashboard that refreshes on release day with room to spare. Paid plans on synergicapis.com: PRO $7.99/mo (50k req), ULTRA $24.99/mo (500k), BUSINESS $79/mo (5M). Official data, versioned JSON, free tier — no scraping, no CSV parsing.

If you're building a macro dashboard, the same platform also serves the US National Debt API — daily to the penny, with history back to 1790 — same JSON conventions, and the same key covers both APIs.

FAQ

What is the current US inflation rate?
The year-over-year change of the CPI-U all-items index (NSA), published monthly by the BLS. GET /inflation/all-items returns it precomputed — in the example data above, 3.5% for 2026-06. One request, one number.

How far back does CPI data go?
The headline (all-items) series starts in 1913, both monthly and as official annual averages. Other categories start later. GET /inflation/all-items/annual?limit=150 returns the entire annual series in one call.

Is this the official BLS data?
Yes — the source is the U.S. Bureau of Labor Statistics CPI-U (U.S. city average), refreshed on each monthly release, and every number traces to a named BLS series: the CPI-U index family (headline CUUR0000SA0) and the Average Price series for the dollar basket. The exact series IDs per endpoint are listed in the API's data provenance section. The API computes rates the same way the BLS does (1 decimal). It is an independent product, not affiliated with the BLS.

What's the difference between adjusted=true and adjusted=false?
false (default) is not seasonally adjusted — the convention for year-over-year figures the press quotes. true is seasonally adjusted — the convention for month-over-month analysis.


Source: U.S. Bureau of Labor Statistics. This product is independent and not endorsed by or affiliated with the BLS.

Top comments (0)