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.). Prices are based on rolling futures contracts.
Available endpoints:
- /v1/commoditycontract - Get price information for a specific commodity contract
- /v1/commoditycontractlist - Get a list of all available commodity contracts
- /v1/commodityprice - Get current price information for any given commodity
- /v1/commoditypricehistorical - Get historical price data for any given commodity
From 9,027 users
Applications using this API
API Status
API Response Times
Average | P50 | P75 | P90 | P95 |
|---|---|---|---|---|
| 257ms | 273ms | 311ms | 560ms | 1065ms |
Similar APIs
Didn't find what you were looking for? Suggest an improvement
/v1/commoditycontract GET Business, Professional, or annual subscriptions Only
https://api.api-ninjas.com/v1/commoditycontract
Returns price information for a specific commodity contract or all contracts matching a commodity root.
Either symbol or symbol_root must be provided, but not both.
Parameters
symboloptionalSpecific contract symbol to look up (e.g.,
GCK26).symbol_rootoptionalCommodity root to filter contracts (e.g.,
GCreturns all contracts starting with GC likeGCK26,GCM26, etc.).
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response
symbolThe full contract symbol.
last_priceThe last price of the commodity contract.
last_updatedThe Unix timestamp of when the price was last updated.
Sample Request Live Demo!
Try this API endpoint with all available parameters in our API playground
https://api.api-ninjas.com/v1/commoditycontract?symbol=GCK26Headers
X-Api-KeyLog in or sign up to get your API KeySample Response
Code Examples
1
2
curl -X GET "https://api.api-ninjas.com/v1/commoditycontract?symbol=GCK26" \
-H "X-Api-Key: YOUR_API_KEY"/v1/commoditycontractlist GET Business, Professional, or annual subscriptions Only
https://api.api-ninjas.com/v1/commoditycontractlist
Returns a list of all available commodity contracts with their symbols and commodity names. This endpoint is useful for discovering which contracts are available for querying.
Parameters
None
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response
symbolThe full contract symbol (e.g., "GCK26").
commodityThe name of the commodity (e.g., "Gold", "Soybean Oil").
Sample Request Live Demo!
Try this API endpoint with all available parameters in our API playground
https://api.api-ninjas.com/v1/commoditycontractlistHeaders
X-Api-KeyLog in or sign up to get your API KeySample Response
Code Examples
1
2
curl -X GET "https://api.api-ninjas.com/v1/commoditycontractlist" \
-H "X-Api-Key: YOUR_API_KEY"/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. Free tier users have access to 7 commodities per week. These commodities rotate weekly on a deterministic schedule. Premium users have access to all commodities. The supported values are:
Value Description goldGold Futures Premium only soybean_oilSoybean Oil Futures Premium only wheatWheat Futures Premium only platinumPlatinum Premium only micro_silverMicro Silver Futures lean_hogsLean Hogs Futures cornCorn Futures Premium only oatOat Futures Premium only aluminumAluminum Futures Premium only soybean_mealSoybean Meal Futures Premium only silverSilver Futures Premium only soybeanSoybean Futures Premium only lumberLumber Futures live_cattleLive Cattle Futures sugarSugar Premium only natural_gasNatural Gas crude_oilCrude Oil Premium only orange_juiceOrange Juice Premium only coffeeCoffee Premium only cottonCotton Premium only copperCopper Premium only micro_goldMicro Gold Futures feeder_cattleFeeder Cattle Futures Premium only rough_riceRough Rice Futures Premium only palladiumPalladium Premium only cocoaCocoa Premium only brent_crude_oilBrent Crude Oil Premium only gasoline_rbobGasoline RBOB Premium only heating_oilHeating Oil class_3_milkClass III Milk Futures Premium only
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!
Try this API endpoint with all available parameters in our API playground
https://api.api-ninjas.com/v1/commodityprice?name=platinumHeaders
X-Api-KeyLog in or sign up to get your API KeySample Response
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.
Sample Request Live Demo!
Try this API endpoint with all available parameters in our API playground
https://api.api-ninjas.com/v1/commoditypricehistorical?name=gold&period=1hHeaders
X-Api-KeyLog in or sign up to get your API Key