API Reference
Authentication
Authorization: Token YOUR_API_KEY
Get your API key from oilpriceapi.com/dashboard.
Base URL
https://api.oilpriceapi.com/v1
Response Format
{
"status": "success|error",
"data": { ... },
"meta": {
"request_id": "req_abc123",
"response_time_ms": 42,
"timestamp": "2025-07-18T10:30:00Z"
}
}
Rate Limits
Plan | Requests/Month | Per Minute |
---|---|---|
Free | 1,000 | 10 |
Hobby | 10,000 | 100 |
Starter | 50,000 | 500 |
Professional | 100,000 | 1,000 |
Business | 200,000 | 2,000 |
Headers:
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 999
X-RateLimit-Reset: 1736784000
Endpoints
Prices
Method | Endpoint | Description |
---|---|---|
GET | /prices/latest | Latest commodity prices |
GET | /prices/past_day | Hourly prices (24h) |
GET | /prices/past_week | Daily prices (7d) |
GET | /prices/past_month | Daily prices (30d) |
GET | /prices/past_quarter | Weekly prices (90d) |
GET | /prices/past_year | Monthly prices (365d) |
Commodities
Method | Endpoint | Description |
---|---|---|
GET | /commodities | List all commodities |
GET | /commodities/{code} | Commodity details |
Premium Endpoints
Method | Endpoint | Description | Plan |
---|---|---|---|
GET | /prices/all | All 40+ commodities | Professional+ |
GET | /storage/cushing | Cushing storage data | Professional+ |
GET | /drilling/overview | Drilling intelligence | Business+ |
GET | /futures/ice-brent | ICE Brent futures | Business+ |
GET | /marine-fuels/overview | Marine fuel prices | Professional+ |
Marine Fuels
Method | Endpoint | Description |
---|---|---|
GET | /marine/ports | List fuel ports |
GET | /marine/ports/{code} | Port details |
GET | /marine/fuels | All marine fuel prices |
Common Parameters
Parameter | Type | Description | Example |
---|---|---|---|
by_code | string | Filter by commodity code | WTI_USD |
fields | string | Specific fields to return | price,timestamp |
page | integer | Pagination page number | 1 |
per_page | integer | Results per page (max: 100) | 100 |
Error Codes
Code | Status | Description |
---|---|---|
MISSING_API_KEY | 401 | No API key provided |
INVALID_API_KEY | 401 | Invalid or expired key |
RATE_LIMIT_EXCEEDED | 429 | Too many requests |
INVALID_COMMODITY | 400 | Unknown commodity code |
INTERNAL_ERROR | 500 | Server error |
See Error Codes Guide for complete list.
Interactive API Explorer
Test endpoints directly: API Explorer