Batch Prices
Bulk lookup for multiple commodity codes in one request.
POST/v1/prices/batch
Request
curl -X POST "https://api.oilpriceapi.com/v1/prices/batch" \
-H "Authorization: Token YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"codes": ["WTI_USD", "BRENT_CRUDE_USD", "NATURAL_GAS_USD"],
"fields": ["price", "formatted", "currency", "created_at"]
}'
| Field | Type | Required | Description |
|---|---|---|---|
codes | array[string] | Yes | Commodity codes to fetch. Keep batches to the smallest set your workflow needs. |
fields | array[string] | No | Optional response field selection. |
currency | string | No | Supported output currency, for example USD, EUR, or GBP where conversion is enabled. |
Response
{
"status": "success",
"data": {
"prices": [
{
"code": "WTI_USD",
"price": 74.52,
"formatted": "$74.52",
"currency": "USD",
"created_at": "2026-07-15T14:30:00.000Z"
}
],
"missing_codes": []
}
}
Error Cases
| Status | When |
|---|---|
400 | Missing codes, invalid code, or malformed JSON body |
401 | Missing or invalid API key |
402 | Quota exhausted or historical depth unavailable on the current plan |
429 | Rate limit exceeded |
Quota Notes
Batch pricing is quota-based, not feature-gated. The exact quota accounting can vary by account configuration, so production integrations should monitor X-RateLimit-* headers and treat 402 as a non-retryable plan/quota failure.