Price Widget Endpoints
Widget endpoints support lightweight dashboard and embeddable display workflows.
Endpoints
| Method | Endpoint | Purpose |
|---|---|---|
| GET | /v1/prices/widget | General widget payload |
| GET | /v1/prices/widget/diesel | Diesel-focused widget payload |
| GET | /v1/prices/widget/ping | Widget health check |
General Widget
curl "https://api.oilpriceapi.com/v1/prices/widget"
The payload is a fixed basket keyed by commodity, not wrapped in status/data, and it does not take by_code:
{
"brent_crude_usd": 88.1,
"wti_crude_usd": 83.44,
"natural_gas_usd": 2.89,
"diesel_usd": 4.34,
"brent_change": -0.22,
"wti_change": 0.0,
"natgas_change": 0.0,
"updated_at": "2026-08-30T16:31:03Z"
}
*_change is the 24-hour percentage move computed the same way as changes["24h"] on Latest Prices: it is null when no comparison price exists inside the permitted lookback, never a figure taken from an older row. diesel_usd has no change field. Responses are cached for 5 minutes.
Diesel Widget
curl "https://api.oilpriceapi.com/v1/prices/widget/diesel" \
-H "Authorization: Token YOUR_API_KEY"
Use this for fleet, logistics, and fuel-surcharge widgets that need diesel-specific labeling.
Widget Ping
curl "https://api.oilpriceapi.com/v1/prices/widget/ping" \
-H "Authorization: Token YOUR_API_KEY"
Use ping for lightweight monitoring of the widget service path. Do not use it as a substitute for the public API status page.
Data Rights
Widgets that display prices publicly can trigger display or redistribution review. Check Data Usage Policy before embedding price data in public pages, customer portals, or downstream products.
Error Cases
| Status | When |
|---|---|
400 | Invalid widget parameter |
401 | Missing or invalid API key |
402 | Quota exhausted or plan not enabled |
429 | Rate limit exceeded |