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?by_code=WTI_USD" \
-H "Authorization: Token YOUR_API_KEY"
{
"status": "success",
"data": {
"code": "WTI_USD",
"label": "WTI Crude Oil",
"price": 74.52,
"formatted": "$74.52",
"created_at": "2026-07-15T14:30:00.000Z"
}
}
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 |