Currency Conversion
The API returns each series in the currency it is published in. There is no currency parameter and no server-side conversion.
- Most codes are quoted in US dollars and end in
_USD. - Some series are published in another currency and say so in the code and in the
currencyfield.DUTCH_TTF_EUR, for example, returns"currency": "EUR". - To show a price in another currency, request the price and the exchange rate and convert in your own code.
What happens if you send currency
/v1/prices/latest, /v1/prices/historical and the past_day, past_week, past_month and past_year endpoints reject it with 400. GET /v1/prices/latest?by_code=WTI_USD¤cy=EUR:
{
"error": {
"code": "UNKNOWN_PARAMETERS",
"message": "This endpoint returns the latest quote in its published currency. It does not apply date windows or currency conversion. Use the historical endpoint with start_date/end_date for dated observations.",
"status": 400,
"request_id": "ffa8640e-3915-4888-9c40-ce166f37e251",
"docs": "https://docs.oilpriceapi.com/guides/error-codes#UNKNOWN_PARAMETERS",
"unrecognized_parameters": ["currency"],
"allowed_parameters": ["by_code", "code", "symbol", "by_type", "by_source", "partial", "include_private", "byos_only", "fields"],
"suggestions": {},
"historical_endpoint": "/v1/prices/historical"
}
}
/v1/prices/all ignores the parameter and returns every series in its published currency.
Convert with the exchange-rate codes
EUR_USD is US dollars per euro and GBP_USD is US dollars per British pound. Request the rate in the same call as the price:
curl "https://api.oilpriceapi.com/v1/prices/latest?by_code=WTI_USD,EUR_USD" \
-H "Authorization: Token YOUR_API_KEY"
From a live call on 2026-11-25, with the other fields left out:
[
{ "code": "WTI_USD", "price": 82.12, "currency": "USD", "unit": "barrel", "created_at": "2026-11-25T12:26:07.738Z" },
{ "code": "EUR_USD", "price": 1.0939, "currency": "USD", "unit": "currency_pair", "created_at": "2026-11-25T12:30:45.661Z" }
]
Divide the dollar price by the rate:
import requests
response = requests.get(
"https://api.oilpriceapi.com/v1/prices/latest",
params={"by_code": "WTI_USD,EUR_USD"},
headers={"Authorization": "Token YOUR_API_KEY"},
timeout=30,
)
response.raise_for_status()
prices = {p["code"]: p["price"] for p in response.json()["data"]["prices"]}
wti_eur = prices["WTI_USD"] / prices["EUR_USD"]
print(f"WTI: EUR {wti_eur:.2f} per barrel")
With the values above, 82.12 / 1.0939 is 75.07 euros per barrel.
The two values carry their own timestamps. Check created_at (or as_of) on both before using the result, since a rate and a price can be observed at different times. For history, request both codes from /v1/prices/historical and convert each date with that date's rate.