EIA API v2: how to use it, its limits, and the OilPriceAPI mirror

OilPriceAPI mirrors the EIA series developers ask for most — weekly gas storage, Cushing stocks, spot and retail fuel prices — under plain price codes with one key and one JSON shape, while EIA's own free API v2 remains the authoritative source for the full 2M+ series catalog. This page shows both: how to call api.eia.gov directly, what EIA documents about its limits, and which series you can read from us instead.

EIA publishes official U.S. statistics on weekly and monthly release calendars. Use EIA's API when you need a series we do not carry; use the mirror when you want the headline series in the same call as WTI, Brent and gold.

Free key, in the URL

EIA issues a free key at eia.gov/opendata and emails it to you. It must appear as api_key= in the URL of every request — EIA does not read it from HTTP headers.

Routes, not series IDs

API v2 organises data as a tree of routes (petroleum/stoc/wstk, natural-gas/stor/wkly, steo) with facets, frequencies and data columns you select per request. Legacy v1 series IDs still work under /v1/.

5,000 rows per response

EIA's documentation caps JSON responses at 5,000 rows and returns a 'parameter out of range' warning above that. Paginate with offset and length, or constrain with facets, start and end.

Throttle guidance, not a published limit

EIA's FAQ says the exact throttles are unpublished for security reasons; as guidance, keep a sustained rate under about 9,000 requests per hour and bursts under 5 per second, or the key is temporarily disabled for seconds to minutes.

No update field in v2

EIA's FAQ notes v2 removed the v1 'updated' field for performance, so you cannot ask the API when a series last changed — poll on the release calendar instead.

The mirror: one code, one key

OilPriceAPI carries the headline EIA series under codes like NATURAL_GAS_STORAGE and CUSHING_STORAGE, with the source's timestamp and a freshness verdict on every response, in the same request as market benchmarks.

Calling the EIA API v2 directly

Register for a key at eia.gov/opendata. Every request is a GET against https://api.eia.gov/v2/<route>/data/ with the key in the URL. The examples use the same routes and series IDs this site already reads for its supply-constraints dashboard.

Weekly petroleum stocks

# U.S. commercial crude stocks (WCESTUS1) and SPR (WCSSTUS1), weekly, newest first
curl "https://api.eia.gov/v2/petroleum/stoc/wstk/data/?api_key=YOUR_EIA_KEY\
&frequency=weekly&data[0]=value\
&facets[series][]=WCESTUS1&facets[series][]=WCSSTUS1\
&start=2025-01-01&sort[0][column]=period&sort[0][direction]=desc\
&offset=0&length=5000"

Weekly natural gas storage

# Weekly natural gas storage route
curl "https://api.eia.gov/v2/natural-gas/stor/wkly/data/?api_key=YOUR_EIA_KEY\
&frequency=weekly&data[0]=value&sort[0][column]=period&sort[0][direction]=desc&length=5"

Discovering routes, facets and frequencies

# Walk the tree: each node lists its child routes, facets and frequencies
curl "https://api.eia.gov/v2/petroleum?api_key=YOUR_EIA_KEY"
curl "https://api.eia.gov/v2/petroleum/stoc/wstk/facet/series?api_key=YOUR_EIA_KEY"

Response shape

{
  "response": {
    "total": "…",
    "data": [
      { "period": "2026-09-05", "series": "WCESTUS1", "value": "…", "units": "MBBL" }
    ]
  },
  "request": { "command": "/v2/petroleum/stoc/wstk/data/", "params": { … } }
}
  • Parameters. frequency, data[0]=value, facets[…][], start, end, sort[0][column], sort[0][direction], offset and length. Parameters other than api_key may also be sent in an X-Params HTTP header when URLs get too long.
  • Output. JSON by default; add out=xml for XML. Row values arrive as strings.
  • Row cap. 5,000 rows per JSON response. Above that you get a truncated result and a "parameter out of range" warning.
  • Throttling. Exact rules are not published. EIA's guidance: under ~9,000 requests per hour sustained and under 5 per second burst. Exceeding it disables the key for seconds to minutes.

Source: EIA API technical documentation and EIA API FAQs, read 2026-09-15. EIA's data is public domain at the source; OilPriceAPI claims no rights in it.

The OilPriceAPI mirror

The headline EIA series under plain codes, one key, and the same JSON shape as WTI, Brent and gold. Cadence follows EIA's release calendar; every response carries the source period as its timestamp and a freshness verdict.

Live: six EIA-sourced series from one call

Rendered from a single /v1/prices/latest request. A row that did not return a usable value is shown as unavailable rather than substituted.

by_codeInstrumentLatestPerSource timestamp
NATURAL_GAS_STORAGEU.S. working gas in storage3,298.00Bcfdelayed
CUSHING_STORAGECushing, OK crude stocks21.48million barrels
WTI_SPOT_USDWTI spot price FOB, Cushing$107.02barrel
BRENT_SPOT_USDEurope Brent spot price FOB$130.80barrel
GASOLINE_RETAIL_USDU.S. regular gasoline, retail$4.319gallon
DIESEL_RETAIL_USDU.S. on-highway diesel, retail$6.285gallon

The request that produced this table

curl "https://api.oilpriceapi.com/v1/prices/latest?by_code=NATURAL_GAS_STORAGE,CUSHING_STORAGE,WTI_SPOT_USD,BRENT_SPOT_USD,GASOLINE_RETAIL_USD,DIESEL_RETAIL_USD" \
  -H "Authorization: Token YOUR_API_KEY"

# Not in the batched response today (api#8176) — fetched one code at a time:

curl "https://api.oilpriceapi.com/v1/prices/latest?by_code=NATURAL_GAS_STORAGE" \
  -H "Authorization: Token YOUR_API_KEY"

curl "https://api.oilpriceapi.com/v1/prices/latest?by_code=CUSHING_STORAGE" \
  -H "Authorization: Token YOUR_API_KEY"
  • A delayed or stale badge is the API's own verdict against that series' expected release cadence — a weekly series is not stale the day after its report.
  • Today the batched request omitted NATURAL_GAS_STORAGE, CUSHING_STORAGE; those rows come from the single-code requests listed above (tracked as oilpriceapi-api#8176).

EIA series carried, with cadence

by_codeSeriesEIA publicationCadenceUnit
NATURAL_GAS_STORAGEU.S. working gas in storageWeekly Natural Gas Storage ReportweeklyBcf
CUSHING_STORAGECushing, OK crude stocksWeekly Petroleum Status Reportweeklymillion barrels
WTI_SPOT_USDWTI spot price FOB, CushingSpot Prices (petroleum)daily values, published in weekly batchesbarrel
BRENT_SPOT_USDEurope Brent spot price FOBSpot Prices (petroleum)daily values, published in weekly batchesbarrel
GASOLINE_RETAIL_USDU.S. regular gasoline, retailWeekly Retail Gasoline and Diesel Pricesweeklygallon
DIESEL_RETAIL_USDU.S. on-highway diesel, retailWeekly Retail Gasoline and Diesel Pricesweeklygallon
HEATING_OIL_RESIDENTIAL_USDU.S. residential No. 2 heating oilWeekly Heating Oil and Propane Updateweekly, heating season onlygallon
CRUDE_FIRST_PURCHASE_US_USDU.S. crude oil first purchase priceDomestic Crude Oil First Purchase Pricesmonthlybarrel
CAPP_COAL_USDCentral Appalachian coal spotCoal Markets (weekly spot prices)weeklyshort ton
PERMIAN_DUC_WELLSPermian drilled-but-uncompleted wellsDrilling Productivity Report / STEOmonthlywells

Regional and basin companions:

  • GASOLINE_RETAIL_* and DIESEL_RETAIL_* for PADD 1–5 and California (weekly)
  • CRUDE_FIRST_PURCHASE_<STATE|PADD>_USD for producing states and PADDs (monthly)
  • <BASIN>_DUC_WELLS, <BASIN>_WELLS_DRILLED and <BASIN>_WELLS_COMPLETED for Permian, Bakken, Eagle Ford, Appalachia, Haynesville and Rest of Lower 48 (monthly)
  • PRB_COAL_USD and ILLINOIS_COAL_USD alongside CAPP_COAL_USD (weekly)

Not carried: PADD-level WPSR stock series and refinery utilization. The supply-constraints page computes those from EIA at render time; call EIA directly for them.

Side-by-side comparison: EIA alternative in the docs, or OilPriceAPI vs EIA. Related datasets: natural gas storage, oil inventories API, commodity prices API.

Endpoints you'll use

GET /v1/prices/latest?by_code=NATURAL_GAS_STORAGE,CUSHING_STORAGE,WTI_SPOT_USD,BRENT_SPOT_USD,GASOLINE_RETAIL_USD,DIESEL_RETAIL_USD

Six EIA-sourced series in one OilPriceAPI request — the call behind the live table above.

GET /v1/prices/latest?by_code=NATURAL_GAS_STORAGE

Latest weekly working gas in storage, in Bcf, with the EIA report week as the timestamp.

GET /v1/prices/past_year?by_code=CUSHING_STORAGE

A year of weekly Cushing stocks (paid plans). Also past_day, past_week and past_month.

GET /v1/commodities?include_unavailable=true

The full catalog, including each code's sources[] and update_frequency, so you can see which series come from EIA.

Frequently asked questions

How do I get an EIA API key?

Register at eia.gov/opendata. EIA sends the key automatically to the email address you provide; if it does not arrive, EIA's FAQ suggests whitelisting [email protected]. The key is free and must be included as api_key= in the URL of every request.

What is the EIA API rate limit?

EIA does not publish its exact throttles. Its FAQ gives guidance: under ideal network conditions, keep your sustained rate under roughly 9,000 requests per hour and your burst rate under 5 per second, and your key will not be throttled. Exceeding it disables the key temporarily, from a few seconds to a number of minutes, and some complex routes have tighter limits.

How many rows can one EIA API request return?

5,000 in JSON. Above that the API returns as many rows as it can plus a 'parameter out of range' warning asking you to constrain the request with facets, start or end, or to paginate with offset.

Which EIA series does OilPriceAPI mirror?

Weekly natural gas storage (NATURAL_GAS_STORAGE), Cushing crude stocks (CUSHING_STORAGE), EIA's WTI and Brent spot prices (WTI_SPOT_USD, BRENT_SPOT_USD), weekly retail gasoline and diesel nationally and by PADD, residential heating oil in season, monthly crude first purchase prices by state and PADD, weekly coal spot prices, and the monthly basin drilling series (DUC wells, wells drilled and completed). PADD-level WPSR stock series are not in the API.

Is the OilPriceAPI mirror real-time?

No. EIA series follow EIA's weekly and monthly release schedule, and the mirror keeps that cadence. Each response carries the source period as its timestamp plus a data_status of current, delayed or stale so you can judge freshness before using a value.

When should I call EIA directly instead?

When you need a series we do not carry — PADD-level stocks, refinery inputs, electricity, international data — or the full history in EIA's own units. EIA's API is free, authoritative and public domain at the source; the mirror is a convenience for the headline series, not a replacement for the catalog.