Commodity prices API for gold and oil
OilPriceAPI is a single commodity prices API that returns gold, silver, platinum, palladium, copper, aluminum, nickel, lead, tin and iron ore alongside crude oil, natural gas and refined fuels — every code in the same JSON shape, behind one API key.
Query GOLD_USD and BRENT_CRUDE_USD from the same endpoint, with the same auth header, and parse the same fields. Adding metals to an oil integration is a change of code string, not a second vendor.
Precious metals by code
GOLD_USD, SILVER_USD, PLATINUM_USD and PALLADIUM_USD each return a value per troy ounce, so a gold quote parses exactly like a crude quote.
Daily benchmark fixes, in three currencies
GOLD_AM_USD, GOLD_PM_USD and SILVER_FIX_USD publish once per trading day, and each has a GBP and a EUR companion code — no separate FX step for a sterling or euro book.
Base and industrial metals
COPPER_USD, ALUMINUM_USD, NICKEL_USD, LEAD_USD and TIN_USD are quoted per pound; IRON_ORE_USD is quoted per metric ton. The unit is on every response.
Oil, gas and fuels in the same schema
WTI_USD, BRENT_CRUDE_USD, NATURAL_GAS_USD and the refined-fuel codes use an identical request and response shape, so one parser covers the whole set.
JSON first, CSV export
Every endpoint returns JSON. Add ?format=csv to the same authenticated request for a flat file; the historical endpoints are on paid plans.
One key, official SDKs
A single Authorization header, plus production SDKs for Python, Node.js, Go and PHP. Start on the free tier with no credit card.
Live: oil, gold, silver, copper and gas from one call
Rendered from a single /v1/prices/latest request with a comma-separated by_code list. Every value carries the source's own timestamp; a code that did not return a usable value is shown as unavailable rather than substituted.
| by_code | Instrument | Latest | Per | Source timestamp |
|---|---|---|---|---|
| WTI_USD | WTI crude | $101.05 | barrel | |
| BRENT_CRUDE_USD | Brent crude | $103.39 | barrel | |
| GOLD_USD | Gold | $4,411.76 | troy ounce | |
| SILVER_USD | Silver | $67.36 | troy ounce | |
| COPPER_USD | Copper | $6.350 | pound | |
| NATURAL_GAS_USD | Natural gas (Henry Hub) | $2.870 | MMBtu |
The request that produced this table
curl "https://api.oilpriceapi.com/v1/prices/latest?by_code=WTI_USD,BRENT_CRUDE_USD,GOLD_USD,SILVER_USD,COPPER_USD,NATURAL_GAS_USD" \
-H "Authorization: Token YOUR_API_KEY"- Units differ by code — gold and silver per troy ounce, copper per pound, natural gas per MMBtu, crude per barrel. Read the unit field before doing arithmetic.
- The multi-code response is data.prices[]; a single-code request returns data as one object.
Metals and energy in one catalog
Every code below returned a live value when this page was last reviewed. Codes that are configured upstream but have never produced an observation are deliberately not listed here.
Precious metals
| by_code | Instrument | Quoted per |
|---|---|---|
| GOLD_USD | Gold | troy ounce |
| SILVER_USD | Silver | troy ounce |
| PLATINUM_USD | Platinum | troy ounce |
| PALLADIUM_USD | Palladium | troy ounce |
Daily benchmark fixes
| by_code | Instrument | Quoted per |
|---|---|---|
| GOLD_AM_USD | Gold morning fix, USD | troy ounce |
| GOLD_AM_GBP | Gold morning fix, GBP | troy ounce |
| GOLD_AM_EUR | Gold morning fix, EUR | troy ounce |
| GOLD_PM_USD | Gold afternoon fix, USD | troy ounce |
| GOLD_PM_GBP | Gold afternoon fix, GBP | troy ounce |
| GOLD_PM_EUR | Gold afternoon fix, EUR | troy ounce |
| SILVER_FIX_USD | Silver daily fix, USD | troy ounce |
| SILVER_FIX_GBP | Silver daily fix, GBP | troy ounce |
| SILVER_FIX_EUR | Silver daily fix, EUR | troy ounce |
Base and bulk metals
| by_code | Instrument | Quoted per |
|---|---|---|
| COPPER_USD | Copper | pound |
| ALUMINUM_USD | Aluminum | pound |
| NICKEL_USD | Nickel | pound |
| LEAD_USD | Lead | pound |
| TIN_USD | Tin | pound |
| IRON_ORE_USD | Iron ore | metric ton |
Oil and gas, same schema
| by_code | Instrument | Quoted per |
|---|---|---|
| WTI_USD | WTI crude | barrel |
| BRENT_CRUDE_USD | Brent crude | barrel |
| NATURAL_GAS_USD | Natural gas | MMBtu |
What the metals codes actually are
- Coverage
- Gold, silver, platinum and palladium per troy ounce; copper, aluminum, nickel, lead and tin per pound; iron ore per metric ton; plus daily gold and silver benchmark fix codes in USD, GBP and EUR.
- Source
- Aggregated from published market sources and normalized into one schema. We are not a party to any exchange or price-reporting agency.
- Cadence
- Latest available values carry a timestamp. Refresh cadence varies by source, market hours, dataset and plan; the daily fix codes publish once per trading day.
- First endpoint
- GET /v1/prices/latest?by_code=GOLD_USD
Response fields to inspect
- code — echoes the canonical code, which may differ from an alias you sent
- price and currency — USD unless you queried a GBP or EUR fix code
- unit — troy_ounce, lb or metric_ton depending on the metal
- created_at — treat this as the freshness signal, not the time you called
Keep visible
- History depth is uneven: gold runs back to December 2023, the other metals codes began in 2026.
- Units are not uniform across metals — never assume troy ounces for copper or iron ore.
- API access conveys no third-party right in the underlying source material.
First call: gold and crude, same shape
Two requests, one header, one parser. The only difference between a metals call and an oil call is the by_code value.
Request
curl "https://api.oilpriceapi.com/v1/prices/latest?by_code=GOLD_USD" \
-H "Authorization: Token YOUR_API_KEY"
curl "https://api.oilpriceapi.com/v1/prices/latest?by_code=BRENT_CRUDE_USD" \
-H "Authorization: Token YOUR_API_KEY"Expected shape
{
"status": "success",
"data": {
"code": "GOLD_USD",
"price": 4608.18,
"currency": "USD",
"unit": "troy_ounce",
"created_at": "2026-08-21T22:52:41Z"
}
}
{
"status": "success",
"data": {
"code": "BRENT_CRUDE_USD",
"price": 93.60,
"currency": "USD",
"unit": "barrel",
"created_at": "2026-08-21T22:52:35Z"
}
}- Responses are abridged for readability and show real observations captured on 2026-08-21; yours will differ.
- Add format=csv to either request for a flat CSV export instead of JSON.
- Read the unit field before doing arithmetic — gold is per troy ounce, Brent is per barrel.
Working in one commodity only? See the commodities API overview, oil price data, or the live gold price page.
Endpoints you'll use
GET /v1/prices/latest?by_code=GOLD_USDLatest gold value with currency, unit and timestamp fields.
GET /v1/prices/latest?by_code=WTI_USD,BRENT_CRUDE_USD,GOLD_USD,SILVER_USD,COPPER_USD,NATURAL_GAS_USDSix commodities in one request — the call behind the live table above. Each code comes back with its own price, unit and source timestamp.
GET /v1/prices/latest?by_code=BRENT_CRUDE_USDThe identical call shape for crude — swap the code, keep the parser.
GET /v1/prices/past_year?by_code=SILVER_USDHistorical observations for a single code (paid plans). Also past_day, past_week and past_month.
GET /v1/prices/allOne snapshot across the commodity codes your plan covers.
Frequently asked questions
Can one API return both gold prices and oil prices?
Yes. OilPriceAPI serves GOLD_USD and BRENT_CRUDE_USD from the same /v1/prices/latest endpoint, with the same Authorization header and the same JSON body. Adding metals to an existing oil integration means changing the by_code string, not adding a second vendor.
Which metals codes can I query?
Precious metals: GOLD_USD, SILVER_USD, PLATINUM_USD, PALLADIUM_USD. Daily benchmark fixes: GOLD_AM_USD, GOLD_PM_USD and SILVER_FIX_USD, each also in GBP and EUR. Base and bulk metals: COPPER_USD, ALUMINUM_USD, NICKEL_USD, LEAD_USD, TIN_USD and IRON_ORE_USD.
What unit are the metals quoted in?
Precious metals are quoted per troy ounce, copper, aluminum, nickel, lead and tin per pound, and iron ore per metric ton. Every response carries a unit field — read it rather than assuming it, because units differ across the catalog.
How far back does the metals history go?
Depth varies by code and it is not uniform. Gold has the longest daily record, running back to December 2023. The other metals codes began collecting during 2026, so treat them as recent series rather than a multi-decade archive. Call /v1/prices/past_year for a code and inspect what actually comes back before you build on it.
Does the commodity API support JSON and CSV?
Yes — every endpoint returns JSON by default, and adding format=csv to the same authenticated request returns a flat CSV export instead. CSV is a parameter on the API rather than a public download, so it needs an API key, and the historical endpoints require a paid plan.
Can I redistribute or publicly display the commodity and metals data?
API access buys collection, normalization, monitoring and delivery. It does not transfer, sublicense or otherwise convey any third-party right in the underlying source material, and no plan changes that. Scope any downstream display, redistribution or publication use separately.
Is there a free tier?
Yes — a 7-day free trial with 10,000 requests and no credit card, and a free tier of 50 requests per day after that. Paid plans start at $19/month.
Start with a free OilPriceAPI key
commodity-data-api