Bosco Labs

Tools › Macro, health & places

US Energy Prices API (EIA): gasoline, diesel, power, stocks

On Apify Store

Ask for US energy data by plain name and get the latest value, the change and the recent history. Weekly retail gasoline and diesel prices (US, regions, 9 states), monthly electricity prices for every state and sector, and the weekly crude, gasoline, distillate and natural gas stock reports, straight from the U.S. Energy Information Administration. No EIA API key needed. Built for AI agents and for anyone who needs a quick, sourced number.

Price$0.002 per series returned
DomainMacro, health & places
Get it onApify Store

Pricing (pay per event): $0.002 per series returned ($2 per 1,000). A series with no data and the catalogue are free; an unknown name fails in a second and costs nothing. The same data is free at eia.gov with your own API key; you pay for the keyless plain-name lookup, the latest/previous/change summary and the hosted API.

Where to get it

The same data and the same rows on every channel; pick the one your agent or code already uses.

ChannelHowPay
Apify Storeapify.com/bosco_labs/us-energy-prices: run it in the Apify Console, by the Apify API or from Apify's MCP server (https://mcp.apify.com?tools=bosco_labs/us-energy-prices)$0.002 per series returned, billed to your Apify account

Questions agents ask

  • “How much did US gasoline and diesel prices change last week, and how full is natural gas storage? Cite the source.”

Example

Input

{ "series": ["gasoline_retail", "crude_stocks", "electricity_price:TX"] }

Output

{
  "schema_version": "1",
  "series": "gasoline_retail:US",
  "title": "U.S. Regular All Formulations Retail Gasoline Prices (Dollars per Gallon)",
  "description": "Weekly regular gasoline retail price in United States (Mondays), all formulations, including taxes.",
  "source": "EIA",
  "route": "petroleum/pri/gnd",
  "series_id": "EMM_EPMR_PTE_NUS_DPG",
  "frequency": "weekly",
  "unit": "USD per gallon",
  "latest_date": "2026-11-02",
  "latest_value": 4.153,
  "previous_date": "2026-10-26",
  "previous_value": 4.269,
  "change": -0.116,
  "observations": [
    { "date": "2026-10-19", "value": 4.284 },
    { "date": "2026-10-26", "value": 4.269 },
    { "date": "2026-11-02", "value": 4.153 }
  ],
  "observation_count": 3,
  "source_url": "https://www.eia.gov/dnav/pet/hist/LeafHandler.ashx?n=PET&s=EMM_EPMR_PTE_NUS_DPG&f=W",
  "provided_by": "Bosco Labs (boscolabs.dev)",
  "api_url": "https://api.eia.gov/v2/petroleum/pri/gnd/data/?frequency=weekly&data%5B0%5D=value&facets%5Bseries%5D%5B%5D=EMM_EPMR_PTE_NUS_DPG&sort%5B0%5D%5Bcolumn%5D=period&sort%5B0%5D%5Bdirection%5D=desc&length=4",
  "attribution": "Source: U.S. Energy Information Administration (EIA), eia.gov open data. Values are reproduced unmodified. The `change` field is computed by Bosco Labs (latest_value - previous_value) and is not an EIA figure. Bosco Labs is not affiliated with or endorsed by EIA.",
  "warnings": [],
  "error": null,
  "retrieved_at": "2026-11-08T21:53:03+00:00",
  "duration_seconds": 6.29
}

What you get

FieldTypeMeaning
schema_versionstringOutput schema version, "1".
seriesstringThe series as requested, normalised (e.g. crude_stocks, gasoline_retail:CA, electricity_price:TX:RES).
titlestring | nullThe series title as EIA states it (series-description), else our own title. null on error rows.
descriptionstringWhat the series is and how to read it, in plain words (written by Bosco Labs).
sourcestringPublisher of the values: EIA (U.S. Energy Information Administration).
routestringEIA API v2 route of the dataset, e.g. petroleum/pri/gnd.
series_idstringEIA series id (e.g. WCESTUS1, EMM_EPMR_PTE_SCA_DPG) or the facets used (stateid=TX, sectorid=RES).
frequencystringweekly or monthly.
unitstringUnit of the values, e.g. USD per gallon, thousand barrels, billion cubic feet, US cents per kilowatt-hour.
latest_datestring | nullDate of the newest observation as EIA dates it: YYYY-MM-DD for weekly series (week ending date for stocks, the Monday of the price survey for retail prices) or YYYY-MM (monthly). null on error rows.
latest_valuenumber | nullNewest value, unmodified from the source.
previous_datestring | nullDate of the observation before the newest one.
previous_valuenumber | nullValue of that previous observation, unmodified.
changenumber | nulllatest_value - previous_value, computed by Bosco Labs (exact decimal difference); not an EIA figure. null if there is no previous value.
observationsarrayThe newest last observations, oldest first, each {date, value}.
observation_countintegerNumber of entries in observations.
source_urlstringHuman page for this series at eia.gov (the API itself needs a key).
provided_bystringWho compiled this row; cite together with source_url.
api_urlstring | nullThe EIA API v2 query used, without the API key (add your own api_key to call it). null on error rows.
attributionstringRequired source notice: EIA as source, not endorsed by EIA; change is computed by Bosco Labs.
warningsarrayCaveats in plain words, e.g. a window cut to the newest 1000 observations.
errorstring | nullWhy this series has no data (empty date window, area without data, EIA down), with a hint. Error rows are not charged.
retrieved_atstringWhen the data was fetched (ISO 8601, UTC).
duration_secondsnumberHow long fetching all series took.

Use with AI agents (MCP)

Add this URL to your MCP client (Claude, Cursor, VS Code, ...) to load the Actor as a tool through the Apify hosted MCP server. It signs you in with OAuth or accepts Authorization: Bearer <APIFY_TOKEN>.

https://mcp.apify.com?tools=bosco_labs/us-energy-prices

For “How much did US gasoline and diesel prices change last week, and how full is natural gas storage? Cite the source.” the agent passes:

{ "series": ["gasoline_retail", "diesel_retail", "gas_storage"], "last": 2 }

one small JSON item per series (about 2 KB with the default 12 observations), stable snake_case fields, numbers as numbers, ISO dates, null for unknown, a source link and the API query per series. Unknown names fail at once with "did you mean" suggestions. 14 series take about 6 seconds.

Or call the Apify API: POST https://api.apify.com/v2/acts/bosco_labs~us-energy-prices/run-sync-get-dataset-items with the input as JSON body. Cost: $0.002 per series returned.

Input fields

FieldTypeMeaning
seriesarrayWhich series to fetch, by plain name (case-insensitive), up to 20 per run, e.g. ["gasoline_retail:CA", "crude_stocks", "electricity_price:TX:RES"]. Names: gasoline_retail[:<area>] and diesel_retail[:<area>] (USD/gallon, weekly; area US (default), PADD1-PADD5, or CA, CO, FL, MA, MN, NY, OH, TX, WA; diesel US, PADD1-5, CA), electricity_price[:<state>[:<sector>]] (cents/kWh, monthly; state US (default) or a 2-letter code; sector ALL (default), RES, COM, IND, TRA), crude_stocks, spr_stocks, gasoline_stocks, distillate_stocks (thousand barrels, weekly), crude_production (thousand barrels/day, weekly), gas_storage (Bcf, weekly), refinery_utilization (%, weekly). Not offered: WTI/Brent/Henry Hub spot prices (licensed third-party data at EIA). An unknown name fails at once with suggestions and costs nothing. Empty = list the catalogue for free.
lastintegerHow many of the newest observations to return per series, e.g. 12 (12 weeks of a weekly series). Empty = 12, or with dateFrom every observation in the window (up to 1000). latest_value, previous_value and change are always filled. The price is the same for any number.
dateFromstringFirst date of the window, YYYY-MM-DD, e.g. "2026-01-01". For monthly series the month holding the date counts. Empty = no lower bound (only last limits).
dateTostringLast date of the window, YYYY-MM-DD, e.g. "2026-03-15". With last = 1 you get the value on that date or the last one before it. Empty = up to the latest published value.
modestring"series" (default) fetches the series above. "catalogue" returns one row per supported name pattern with its EIA route, series id, frequency, unit and an example, free of charge.

Sources, licence and limits

How fresh is it? Live: every call reads the EIA API. Retail gasoline and diesel prices are surveyed on Mondays and published Monday evening or Tuesday. Petroleum stocks, production and refinery use come from the Weekly Petroleum Status Report (Wednesdays), gas storage from the Weekly Natural Gas Storage Report (Thursdays). Monthly electricity prices lag about two months. Federal holidays shift the schedule.

Why no WTI or Brent price? See "Not included" above: those are licensed vendor prices.

Why no diesel price for Texas? EIA's weekly diesel survey covers the US, the five PADD regions and California only; other areas come back as a free error row.

Do I need an EIA API key? No. We call EIA with our own key; it never appears in the output or logs.

Can I republish the values? EIA data is US government work in the public domain. Name EIA as the source (each row has an attribution), don't present changed values as EIA's, and don't imply EIA endorses you. Our change field is marked as computed by Bosco Labs.

Personal data? None. National, regional and state aggregates only.