Commodity Price API
The Commodity Price API provides access to real-time commodity prices for dozens of commonly-traded commodities in major exchanges (CME, NYMEX, etc.).
/v1/commodityprice GET
https://api.api-ninjas.com/v1/commodityprice
Returns the current price information for any given commodity. All quoted prices are in USD.
For historical commodity prices, see /v1/commoditypricehistorical.
Parameters
namerequiredName of commodity. The supported values are:
Value Description Premium Only goldGold Futures Yes soybean_oilSoybean Oil Futures Yes wheatWheat Futures Yes platinumPlatinum No micro_silverMicro Silver Futures No lean_hogsLean Hogs Futures Yes cornCorn Futures Yes oatOat Futures No aluminumAluminum Futures Yes soybean_mealSoybean Meal Futures Yes silverSilver Futures Yes soybeanSoybean Futures Yes lumberLumber Futures Yes live_cattleLive Cattle Futures Yes sugarSugar Yes natural_gasNatural Gas Yes crude_oilCrude Oil Yes orange_juiceOrange Juice Yes coffeeCoffee Yes cottonCotton Yes copperCopper Yes micro_goldMicro Gold Futures No feeder_cattleFeeder Cattle Futures No rough_riceRough Rice Futures No palladiumPalladium Yes cocoaCocoa Yes brent_crude_oilBrent Crude Oil Yes gasoline_rbobGasoline RBOB Yes heating_oilHeating Oil Yes class_3_milkClass III Milk Futures No 
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response
exchangeThe symbol of the exchange where the commodity is traded.
nameThe name of the commodity.
priceThe current price of the commodity in USD.
updatedThe Unix timestamp of the price update.
Sample Request Live Demo!
https://api.api-ninjas.com/v1/commodityprice?name=platinumHeaders
X-Api-KeyLog in or sign up to get your API KeySample Response
1
2
3
4
5
6
{
  "exchange": "NYMEX",
  "name": "Platinum",
  "price": 995.05,
  "updated": 1728677095
}Code Examples
1
2
curl -X GET "https://api.api-ninjas.com/v1/commodityprice?name=gold" \
  -H "X-Api-Key: YOUR_API_KEY"If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.
/v1/commoditypricehistorical GET Premium Only
https://api.api-ninjas.com/v1/commoditypricehistorical
Returns historical commodity futures price data in OHLCV (Open, High, Low, Close, Volume) format. The data is returned in descending order (most recent first), and all prices are in USD.
Parameters
namerequiredName of commodity. Use the same values as the name parameter in /v1/commodityprice.
periodoptionalTime interval between data points. Valid values are:
1m,5m,15m,30m,1h,4h,1d. Default is1h.startoptionalStart timestamp in Unix format. If not provided, defaults to 24 hours ago.
endoptionalEnd timestamp in Unix format. If not provided, defaults to current time.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response
openThe opening price of the commodity in USD.
lowThe lowest price of the commodity in USD.
highThe highest price of the commodity in USD.
closeThe closing price of the commodity in USD.
volumeThe volume of the commodity.
timeThe Unix timestamp of the price update.
Historical Price Sample Request
https://api.api-ninjas.com/v1/commoditypricehistorical?name=gold&period=1h&start=1728677095&end=1729677095Historical Price Sample Response
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
[
  {
    "open": 2757.2,
    "low": 2745.4,
    "high": 2758,
    "close": 2751.2,
    "volume": 29068,
    "time": 1729674000
  },
  {
    "open": 2763.9,
    "low": 2754.5,
    "high": 2764.5,
    "close": 2757.3,
    "volume": 16722,
    "time": 1729670400
  },
  {
    "open": 2764.6,
    "low": 2763,
    "high": 2767,
    "close": 2763.9,
    "volume": 5495,
    "time": 1729666800
  },
  "..."
]