Where can I get a diesel price API?
OilPriceAPI is a diesel price API: daily US per-state retail diesel, EU country retail diesel, and ULSD / ICE gasoil (10ppm) benchmarks over one REST endpoint, with a free tier and Python/JavaScript SDKs.
Pull a state's retail diesel average or a wholesale gasoil benchmark as JSON — useful for logistics, fuel-cost, and freight models.
Diesel Price API capabilities
US per-state retail diesel
Daily retail diesel averages by US state (DIESEL_RETAIL_STATE_<XX>_USD) for logistics and fuel-cost tooling.
EU country diesel
Weekly national retail diesel averages for EU countries (DIESEL_RETAIL_<CC>_EUR).
ULSD & gasoil benchmarks
Wholesale ULSD (ULSD_DIESEL_USD) and ICE/Singapore gasoil (10ppm) for procurement and hedging.
One REST endpoint
GET /v1/prices/latest?by_code=DIESEL_RETAIL_STATE_TX_USD — JSON, one API key.
Free tier to start
7-day trial · 10,000 requests · then Free plan: 50 requests/day, no expiry
Official SDKs
Production-ready SDKs for Python, Node.js, Go, and PHP.
First call in Python
import os
import requests
response = requests.get(
"https://api.oilpriceapi.com/v1/prices/latest",
headers={"Authorization": f"Token {os.environ['OILPRICEAPI_KEY']}"},
params={"by_code": "DIESEL_RETAIL_STATE_TX_USD"},
timeout=10,
)
response.raise_for_status()
print(response.json())Looking for UK petrol and diesel or EU country-average coverage? See the UK and European fuel price API guide.
Endpoints you'll use
GET /v1/prices/latest?by_code=DIESEL_RETAIL_STATE_TX_USDTexas retail diesel (daily state average).
GET /v1/prices/latest?by_code=GASOIL_USDICE gasoil (10ppm ULSD benchmark).
Frequently asked questions
Does the diesel API cover US states?
Yes — OilPriceAPI serves daily retail diesel averages for every US state (e.g. DIESEL_RETAIL_STATE_TX_USD), plus EU country diesel and wholesale ULSD/gasoil benchmarks.
What's the difference between retail and benchmark diesel?
Retail (per-state/country) is the pump-level daily average; ULSD/gasoil (e.g. GASOIL_USD, SINGAPORE_GASOIL_USD) are wholesale 10ppm benchmarks used for procurement and hedging. Both are available.
How fresh is the data?
US retail state series update daily, while EU country series update weekly; wholesale gasoil benchmarks update through the trading day. Read the source timestamp returned with each value.
Is there a free tier?
Yes. Free plan: 50 requests/day, with no expiry. New accounts start with a 7-day trial: 10,000 requests, full API (except licensed datasets: aviation fuel pilot), no card. After the trial, you automatically continue on the Free plan. The Free plan is hard-capped and never billed.
Start with a free OilPriceAPI key
diesel-price-api