Skip to content

Instantly share code, notes, and snippets.

@syntaxhacker
Created October 14, 2026 12:57
Show Gist options
  • Select an option

  • Save syntaxhacker/557b6655a91a65ebd31849bb0312486c to your computer and use it in GitHub Desktop.

Select an option

Save syntaxhacker/557b6655a91a65ebd31849bb0312486c to your computer and use it in GitHub Desktop.
US CPI APIs for next CPI session: BLS at 6pm, FRED for history (verified Oct 14 2026)

US CPI APIs — Quick Reference for Next CPI Session

Release: BLS 8:30 ET = 6pm IST. Next: Nov 10, 2026. Sept print was MoM +0.6%, YoY 3.7%, core +0.3% / 2.6% (BLS index Sept 336.940, Aug 334.980).

Rule

  • At 6pm: BLS API (only source live at print; FRED still ends prior month).
  • History/backtest: FRED CSV (fastest, no key).
  • Skip AlphaVantage demo (slowest + rate-limited).

1. BLS API v2 — release-day source of truth

curl -s -X POST "https://api.bls.gov/publicAPI/v2/timeseries/data/" \
  -H "Content-Type: application/json" \
  -d '{"seriesid":["CUUR0000SA0","CUUR0000SA0L1E"],"startyear":"2026","endyear":"2026"}'
  • CUUR0000SA0 = headline CPI-U SA; CUUR0000SA0L1E = core (less food+energy) SA.
  • No key: 25 req/day. Free key (email signup at bls.gov/developers): 500/day.
  • Python:
import requests
r = requests.post("https://api.bls.gov/publicAPI/v2/timeseries/data/",
    json={"seriesid": ["CUUR0000SA0", "CUUR0000SA0L1E"],
          "startyear": "2026", "endyear": "2026",
          # "registrationkey": "YOUR_KEY",
          }).json()
for s in r["Results"]["series"]:
    print(s["seriesID"], [(d["periodName"], d["value"]) for d in s["data"][:3]])
  • Benchmarked 0.87–1.17s. Note: BLS web page (bls.gov/news.release/cpi.htm) returns 403 to plain curl (bot wall) — use www+https in browser or this API instead.

2. FRED CSV — fastest history, no key

curl -s "https://fred.stlouisfed.org/graph/fredgraph.csv?id=CPIAUCSL&cosd=2025-01-01" | tail -5
  • CPIAUCSL = headline SA, CPILFESL = core SA, CPIAUCNS = NSA.
  • Benchmarked 0.30–0.84s (fastest of three). Lags BLS by days on release day.
  • Python:
import pandas as pd
df = pd.read_csv("https://fred.stlouisfed.org/graph/fredgraph.csv?id=CPIAUCSL",
                 parse_dates=["observation_date"], index_col="observation_date")
yoy = df["CPIAUCSL"].pct_change(12) * 100
mom = df["CPIAUCSL"].pct_change(1) * 100

3. AlphaVantage — fallback only

curl -s "https://www.alphavantage.co/query?function=CPI&interval=monthly&apikey=YOUR_KEY" | head -c 400
  • Benchmarked 0.91–1.23s (slowest). Demo key works but throttled. Prefer 1 or 2.

Page mirrors (when BLS HTML 403s)

  • https://www.bls.gov/cpi/ (needs www+https)
  • https://www.bls.gov/news.release/pdf/cpi.pdf
  • https://fred.stlouisfed.org/series/CPIAUCSL (always 200)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment