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_codeInstrumentLatestPerSource timestamp
WTI_USDWTI crude$101.05barrel
BRENT_CRUDE_USDBrent crude$103.39barrel
GOLD_USDGold$4,411.76troy ounce
SILVER_USDSilver$67.36troy ounce
COPPER_USDCopper$6.350pound
NATURAL_GAS_USDNatural gas (Henry Hub)$2.870MMBtu

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_codeInstrumentQuoted per
GOLD_USDGoldtroy ounce
SILVER_USDSilvertroy ounce
PLATINUM_USDPlatinumtroy ounce
PALLADIUM_USDPalladiumtroy ounce

Daily benchmark fixes

by_codeInstrumentQuoted per
GOLD_AM_USDGold morning fix, USDtroy ounce
GOLD_AM_GBPGold morning fix, GBPtroy ounce
GOLD_AM_EURGold morning fix, EURtroy ounce
GOLD_PM_USDGold afternoon fix, USDtroy ounce
GOLD_PM_GBPGold afternoon fix, GBPtroy ounce
GOLD_PM_EURGold afternoon fix, EURtroy ounce
SILVER_FIX_USDSilver daily fix, USDtroy ounce
SILVER_FIX_GBPSilver daily fix, GBPtroy ounce
SILVER_FIX_EURSilver daily fix, EURtroy ounce

Base and bulk metals

by_codeInstrumentQuoted per
COPPER_USDCopperpound
ALUMINUM_USDAluminumpound
NICKEL_USDNickelpound
LEAD_USDLeadpound
TIN_USDTinpound
IRON_ORE_USDIron oremetric ton

Oil and gas, same schema

by_codeInstrumentQuoted per
WTI_USDWTI crudebarrel
BRENT_CRUDE_USDBrent crudebarrel
NATURAL_GAS_USDNatural gasMMBtu
Coverage truth

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 proof

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_USD

Latest 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_USD

Six 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_USD

The identical call shape for crude — swap the code, keep the parser.

GET /v1/prices/past_year?by_code=SILVER_USD

Historical observations for a single code (paid plans). Also past_day, past_week and past_month.

GET /v1/prices/all

One 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.