Tidava
Free public data · developer guide

Free EIA API: pull weekly crude and Cushing data

EIA’s v2 API is free, but the route, series IDs and units are easy to get wrong. This guide shows a working Cushing request, the current row cap, and how Tidava packages the same public series for members.

Cushing dataset previewEIA vs paid energy dataStart the 6-hour free trial

Latest EIA Cushing value: 25.023 MB · week ending 2026-11-27 · next scheduled release see EIA schedule

1. Get a free API key

Register at the EIA Open Data page. The key is free. Keep it in an environment variable, not in source code:

export EIA_API_KEY="your-key-here"

EIA data is public domain. The API is a service layer, not a paid data product.

2. Use the v2 petroleum-stocks route

Weekly stocks are under petroleum/stoc/wstk in the current v2 documentation. The base URL is https://api.eia.gov/v2/.

Series IDWhat it isRaw unit
WCESTUS1U.S. commercial crude stocks, excluding SPRthousand barrels
W_EPC0_SAX_YCUOK_MBBLCushing, Oklahoma crude stocksthousand barrels
WCSSTUS1Strategic Petroleum Reserve stocksthousand barrels

Unit trap: the API commonly returns thousand barrels. Divide by 1,000 for million barrels. A value of 27,356 is 27.356 MB, not 27,356 MB.

3. Python example

import os
import requests
import pandas as pd

API = "https://api.eia.gov/v2/petroleum/stoc/wstk/data/"
SERIES = "W_EPC0_SAX_YCUOK_MBBL"  # Cushing, thousand barrels

params = {
    "api_key": os.environ["EIA_API_KEY"],
    "frequency": "weekly",
    "data[0]": "value",
    "facets[series][]": SERIES,
    "start": "2018-01-01",
    "sort[0][column]": "period",
    "sort[0][direction]": "asc",
    "length": 5000,
}
r = requests.get(API, params=params, timeout=30)
r.raise_for_status()
rows = r.json()["response"]["data"]
df = pd.DataFrame(rows)
df["period"] = pd.to_datetime(df["period"])
df["value"] = pd.to_numeric(df["value"], errors="coerce")
df = df.dropna(subset=["value"]).set_index("period").sort_index()
print((df["value"] / 1000).tail())  # million barrels

The JSON response is under response.data. Values can arrive as strings, so coerce with pd.to_numeric before arithmetic.

4. Limits and practical handling

  • JSON row cap: 5,000 rows per request. Use offset/pagination for longer series.
  • Throttling: EIA asks users to throttle. Exact limits are not published in the docs; do not burst or hammer the API. Cache locally.
  • Revisions: weekly estimates can be revised in later EIA publications.
  • Route changes: verify the route against current EIA docs before relying on it in production.

For one Cushing history, the official EIA API is free. If you want Tidava's formatted series, CSV and API, those are member features; the public Cushing page is a preview.

Prefer JSON? Tidava members get a keyless endpoint: https://tidava.com/api/public/cushing-inventory?limit=260. It returns the latest value, weekly change and a date/stocks series.

5. API vs the EIA report

The API returns the same official WPSR series; it does not replace understanding the report. For the release-day comparison, see API vs EIA crude inventory. For what free satellite imagery can and cannot measure, see the Cushing dataset and satellite test.

FAQ

Is the EIA API free?

Yes. EIA's open-data API is free; you register for an API key with an email address. The underlying EIA data is public domain. EIA asks users to throttle requests and cache responses.

What is the EIA API v2 base URL?

The v2 base is https://api.eia.gov/v2/. Weekly petroleum stocks are under the petroleum/stoc/wstk route in the current documentation. Endpoints and routes can change, so check EIA's docs before production use.

Which series is Cushing crude inventory?

W_EPC0_SAX_YCUOK_MBBL is the weekly Cushing, Oklahoma crude stocks series in the EIA WPSR. The API commonly returns thousand barrels; divide by 1,000 for million barrels.

How many rows can one EIA API call return?

A JSON response is capped at 5,000 rows per request. Use pagination/offset for longer series or cache locally.

Do I need an API key to get Cushing history?

The official EIA API is free and requires a key. Tidava also offers a member CSV/API for its formatted Cushing dataset; the public preview does not expose the full history. Use the official EIA API for raw free access.

Build the context, not just the pull

The EIA gives you the official Cushing series. Tidava gives members a repeatable browser workflow and context around the release.

Start free trialGet weekly notes

Sources: EIA Open Data API v2 documentation and WPSR series definitions. Last updated 16 November 2026. No paid data or invented values.