OPEC Basket Price API
Free OPEC Reference Basket price feed with no key: the daily crude oil basket price in USD per barrel, with the complete history from 2003 to today in one XML document.
Endpoint tested and returned HTTP 200 on 2026-08-21
What is the OPEC Basket Price API?
OPEC publishes its Reference Basket crude oil price as a free XML archive with no key. A single request returns every published daily value from 2003 onwards, each as a date and a US-dollars-per-barrel figure.
The OPEC Reference Basket is a weighted average of crude streams from member countries, and it is one of the small number of oil benchmarks quoted in general news coverage alongside Brent and WTI. Because the archive ships the entire history in one document, building a two-decade chart is a single HTTP request — no paging, no date arithmetic, no key.
That completeness is also the cost: the file grows every working day and you download all of it every time, so cache it and refresh once a day at most. Two practical notes. The document declares an `http://tempuri.org/basketDayArchives.xsd` namespace — a Visual Studio placeholder your parser must nonetheless honour — and the OPEC edge returns HTTP 403 to requests that send no `Accept-Language` header, an unusual bit of bot filtering that catches most default HTTP clients.
Quick facts
- Base URL
https://www.opec.org/basket- Authentication
- No key. The edge requires an Accept-Language header; requests without one receive HTTP 403.
- Rate limit
- No documented limit, but the file is large and grows daily. Fetch once a day and cache.
- Pricing
- Free.
- CORS
- Not enabled — call it from your server
- Official docs
- Read the docs
How to use the OPEC Basket Price API
Every request below was executed against the live API on 2026-08-21, and the response shown is the real body it returned — not an illustration.
1. Full OPEC Reference Basket daily price history
GET https://www.opec.org/basket/basketDayArchives.xml
curl 'https://www.opec.org/basket/basketDayArchives.xml' \
-H 'Accept-Language: en-GB,en;q=0.9'const res = await fetch("https://www.opec.org/basket/basketDayArchives.xml", {
headers: {
"Accept-Language": "en-GB,en;q=0.9",
},
});
if (!res.ok) throw new Error(`Request failed: ${res.status}`);
const data = await res.json();
console.log(data);import requests
headers = {
"Accept-Language": "en-GB,en;q=0.9",
}
res = requests.get("https://www.opec.org/basket/basketDayArchives.xml", headers=headers, timeout=20)
res.raise_for_status()
print(res.json())<?xml version="1.0" encoding="utf-8" ?>
<Basket xmlns="http://tempuri.org/basketDayArchives.xsd">
<BasketList data="2003-01-02" val="30.05" />
<BasketList data="2003-01-03" val="30.83" />
<BasketList data="2003-01-06" val="30.71" />
<BasketList data="2003-01-07" val="29.72" />
<BasketList data="2003-01-08" val="28.86" />
<BasketList data="2003-01-09" val="29.51" />
<BasketList data="2003-01-10" val="29.82" />
<BasketList data="2003-01-13" val="29.82" />
<BasketList data="2003-01-14" val="30.21" />
<BasketList data="2003-01-15" val="30.66" />
<BasketList data="2003-01-16" val="30.87" />
<BasketList data="2003-01-17" val="31.02" />
<BasketList data="2003-01-20" val="31.21" />
<BasketList data="2003-01-21" val="30.90" />
<BasketList data="2003-01-22" val="30.89" />
<BasketList data="2003-01-23" val="30.18" />
<BasketList data="2003-01-24" val="30.56" />
<BasketList data="2003-01-27" val="30.16" />
<BasketList data="2003-01-28" val="29.83" />
<BasketList data="2003-01-29" val="30.30" />
<BasketList data="2003-01-30" val="30.58" />
<BasketList data="2003-01-31" val="30.71" />
<BasketList data="2003-02-03" val="30.29" />
<BasketList data="2003-02-04" val="29.98" />
<BasketList data="2003-02-05" val="30.52" />
<BasketList data="2003-02-06" val="30.77" />
<BasketList data="2003-02-07" val="31.25" />
<BasketList data="2003-02-10" val="31.38" />
<BasketList data="2003-02-11" val="31.35" />
<BasketList data="2003-02-12" val="31.30" />
<BasketList data="2003-02-13" val="31.91" />
<BasketList data="2003-02-14" val="32.33" />
<BasketList data="2003-02-17" val="31.90" />
<BasketList data=Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
basketDayArchives.xml | path | Required | The complete daily archive. There is no date filter — the whole history is returned. |
Accept-Language | header | Required | Any value, for example `en-GB,en;q=0.9`. Without it the edge returns 403. en-GB,en;q=0.9 |
Response fields
Basketelement- Root element, in the `http://tempuri.org/basketDayArchives.xsd` namespace.
BasketList@dataattribute- Publication date in `YYYY-MM-DD`. Note the attribute is spelled `data`, not `date`.
BasketList@valattribute- Basket price in US dollars per barrel, as a string with two decimals.
(missing days)n/a- Weekends and OPEC holidays have no entry at all rather than a null value.
What you can build with the OPEC Basket Price API
- Chart the OPEC basket price over any historical window
- Show the latest crude benchmark price on a commodities page
- Compare the basket against other oil benchmarks in a dataset
- Load two decades of daily prices into an analysis in one request
Common errors and how to fix them
403 Forbidden
The request sent no `Accept-Language` header.
Fix: Add any Accept-Language value. This is edge bot filtering and affects most default HTTP client configurations.
XPath matches nothing
The tempuri namespace was ignored.
Fix: Register the namespace in your parser, or query by local name.
Attribute not found
You looked for `date` instead of `data`.
Fix: The date attribute is spelled `data`. It is a quirk of the original schema, not a typo in your code.
OPEC Basket Price API — frequently asked questions
What is the OPEC Reference Basket?
A weighted average of crude oil streams produced by OPEC member countries, published daily in US dollars per barrel. It sits alongside Brent and WTI as a headline oil benchmark, and its composition changes as member countries join or leave.
Is the OPEC price data free?
Yes, with no key or registration. The only requirement is an Accept-Language header — the OPEC edge returns 403 to requests that omit one.
Can I request just a date range?
No. The archive endpoint returns the complete history from 2003 in one document. Cache it locally and filter client-side.
Why are some dates missing?
Because the basket is priced on working days only. Weekends and OPEC holidays produce no entry at all rather than an empty one.
Tools that pair with this API
XML to JSON Converter
Convert XML to JSON online. Elements become objects, attributes are prefixed with @, text is preserved, and parse errors are reported clearly — in-browser.
Percentage Change Calculator
Work out the percentage increase or decrease between an old and a new value. See the absolute change and whether it went up or down, instantly and privately.
Fuel Cost Calculator
Estimate the fuel cost and amount of fuel for any trip using distance, efficiency and fuel price. Supports miles/km and MPG or L/100km. Free and private.
OPEC Basket Price is an independent third-party service and is not affiliated with ByteTools or ByteVancer. Details on this page were verified on 2026-08-21; always check the official documentation before relying on this API in production, as terms and limits can change.