Overview
A scheduled collector reads twelve daily spot price series from the U.S. Energy Information Administration's open data API twice a day and stores every close since 1986 (the series start at different dates; Henry Hub begins in 1997, ultra-low sulfur diesel in 2006). Requests are served from that store, never from EIA live. The data is public domain; source: U.S. Energy Information Administration, Spot Prices for Crude Oil and Petroleum Products and Natural Gas Spot and Futures Prices.
`price` is the close on `date` and `previousClose` the close on the trading day before it; `change` is the difference and `changePercent` the same as a percent of the previous close. `high52w` and `low52w` are the highest and lowest closes in the 364 days up to `date`. EIA publishes closing assessments a few days after the trading day, so `date` usually trails today by two to five days. These are spot prices, not futures settlements or live quotes.
Crude is published per barrel, refined products and propane per gallon and natural gas per MMBtu. `unit` converts with 42 gallons per barrel, 3.785411784 liters per gallon, 10 therms per MMBtu and 3.412141633 MMBtu per MWh. `history` returns closes from `days - 1` calendar days before `date` through `date`; `weekly` keeps the last close of each Monday-to-Sunday week.
Endpoint
One host, one path per API. The block below shows this call in four languages; every one of them is the same HTTP request. Making requests covers the timeouts, retries and parameter rules that apply to all of them. The SDKs wrap the same call in a typed client.
curl "https://api.apiverve.com/v1/energyprices?benchmark=wti&unit=gallon&date=2025-06-13&history=daily&days=30" \
-H "x-api-key: your_api_key_here"const res = await fetch('https://api.apiverve.com/v1/energyprices?benchmark=wti&unit=gallon&date=2025-06-13&history=daily&days=30', {
headers: { 'x-api-key': 'your_api_key_here' },
});
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`);
const { data } = await res.json();
console.log(data);import requests
res = requests.get(
"https://api.apiverve.com/v1/energyprices?benchmark=wti&unit=gallon&date=2025-06-13&history=daily&days=30",
headers={"x-api-key": "your_api_key_here"},
timeout=15,
)
res.raise_for_status()
print(res.json()["data"])package main
import (
"fmt"
"io"
"net/http"
)
func main() {
req, _ := http.NewRequest("GET", "https://api.apiverve.com/v1/energyprices?benchmark=wti&unit=gallon&date=2025-06-13&history=daily&days=30", nil)
req.Header.Set("x-api-key", "your_api_key_here")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
out, _ := io.ReadAll(res.Body)
fmt.Println(string(out))
}Replace your_api_key_here with the key from your dashboard. When the inputs arrive as a list rather than one at a time, batch requests run up to 200 of them through this same API in a single call.
Authentication
Send your key in the x-api-key header. That is the only auth step — there is no token exchange and no per-endpoint scope to configure. Authentication covers creating, rotating and revoking keys.
A 401 means the key is missing, invalid or expired. A 403 means the key is valid but not permitted here — blocked by a key restriction or an IP allow-list. Running out of credits is a 429.
Parameters
Sent in the query string. Premium parameters are accepted on every plan but only take effect on plans that include them.
| Parameter | Type | Description |
|---|---|---|
benchmarkOptional | string | Benchmark to price, or a comma-separated list (paid plans), or all. Defaults to wti.wtibrenthenryhubgasoline_nyhgasoline_gulfrbob_laulsd_nyhulsd_gulf+5 |
unitOptional | string | Unit to price per: barrel, gallon or liter for crude and refined products; mmbtu, therm or mwh for natural gas. Defaults to each benchmark's published unit.barrelgallonlitermmbtuthermmwh |
dateOptionalPremium | string | Date to look up (YYYY-MM-DD). Returns the close on that day, or the latest trading day before it. Omit for the latest close. date |
historyOptionalPremium | string | Include a price series ending at the returned date: daily closes or the last close of each week.dailyweekly |
daysOptionalPremium | integer | Calendar days of history to include (1-3650). Daily history allows up to 366. Defaults to 30. range 1–3650 |
Response
Every API returns the same three top-level keys, so one response handler covers your whole integration: status, error and data. Only data changes shape. Response format covers the envelope, the other output formats and how premium fields are withheld.
{
"status": "ok",
"error": null,
"data": {
"count": 1,
"date": "2026-11-11",
"prices": [
{
"benchmark": "wti",
"name": "WTI Crude Oil",
"product": "crude oil",
"location": "Cushing, OK",
"currency": "USD",
"unit": "barrel",
"nativeUnit": "barrel",
"price": 89.62,
"date": "2026-11-11",
"previousClose": 89.62,
"previousDate": "2026-11-10",
"change": 0,
"changePercent": 0,
"changeDirection": "unchanged",
"high52w": 114.58,
"high52wDate": "2026-04-07",
"low52w": 55.44,
"low52wDate": "2025-12-16"
}
]
}
}
Response fields
Paths are relative to data. Premium fields are absent rather than zeroed on plans that do not include them, so check for presence instead of comparing to 0.
| Field | Type | Example | Description |
|---|---|---|---|
count | number | 1 | Number of benchmarks returned |
date | string | "2026-11-11" | The requested date, or the most recent close across the returned benchmarks (YYYY-MM-DD) |
prices | array[1] | One entry per benchmark | |
benchmark | string | "wti" | Benchmark id, e.g. wti or henryhub |
name | string | "WTI Crude Oil" | Benchmark name |
product | string | "crude oil" | Commodity: crude oil, natural gas, gasoline, diesel, heating oil, propane or jet fuel |
location | string | "Cushing, OK" | Delivery point the spot price is assessed at |
currency | string | "USD" | Currency of every price in the entry (USD) |
unit | string | "barrel" | Unit the prices are quoted per |
nativeUnit | string | "barrel" | Unit EIA publishes the benchmark in |
price | number | 89.62 | Closing spot price on date |
date | string | "2026-11-11" | Trading day of the close (YYYY-MM-DD) |
previousClose | number | 89.62 | Close on the previous trading day |
previousDate | string | "2026-11-10" | Trading day of the previous close |
change | number | 0 | Change from the previous close, in currency per unit |
changePercent | number | 0 | Change from the previous close, in percent |
changeDirection | string | "unchanged" | up, down or unchanged |
high52wPremium | number | 114.58 | Highest close in the 52 weeks to date |
high52wDatePremium | string | "2026-04-07" | Trading day of the 52-week high |
low52wPremium | number | 55.44 | Lowest close in the 52 weeks to date |
low52wDatePremium | string | "2025-12-16" | Trading day of the 52-week low |
Errors
Read the HTTP status first, then error for the specific reason. The body names the parameter that has to change. Error handling covers the full status list and which of them are worth retrying.
| Status | Meaning | What to do |
|---|---|---|
400 | Input was rejected | Read error; it names the parameter. |
401 | Key missing or invalid | Check the header name and the key value. |
403 | Key valid, but not permitted | A key restriction or IP allow-list; see key scoping. |
429 | Rate limited, or out of credits | Read error to tell them apart; see rate limits. |
Use cases
- Fuel Surcharge Calculators
- Freight and airline tools tie surcharges to the daily diesel or jet fuel spot close and its weekly average, recalculated automatically as the benchmark moves.
- Energy Cost Dashboards
- Finance teams chart WTI, Brent and Henry Hub side by side in one call, with daily change and 52-week range for context.
- Utility and Heating Estimates
- Home energy apps convert Henry Hub gas to therms and heating oil to gallons to estimate the wholesale cost behind a household bill.
- Backtests and Research
- Analysts pull years of weekly closes for crude and products to study crack spreads, seasonality and price shocks.
Other ways to use Energy Prices
Set up Energy Prices on APIVerve, or reach the same source a different way. Your APIVerve account and credits work on all of them — one key, one balance.
Related
More in Finance: