Commodity Price API
The Commodity Price API provides access to commodity prices for dozens of commonly-traded commodities.
Available endpoints:
- /v1/commodityprice - Get current price information for one or more commodities, with optional currency and unit conversion
- /v1/commoditypricehistorical - Get historical price data for any given commodity
- /v1/commoditysnapshot - Get current prices for all supported commodities in a single call
- /v1/commoditycontract - Get price information for a specific commodity contract
- /v1/commoditycontractlist - Get a list of all available commodity contracts
- /v1/commodityforwardcurve - Get the forward curve (all active contracts) for a commodity, with contango/backwardation classification
Premium members have access to live prices, while free users only have access to 15-minute delayed data.
From 9,027 users
Applications using this API
API Status
API Response Times
Average | P50 | P75 | P90 | P95 |
|---|---|---|---|---|
| 258ms | 272ms | 334ms | 485ms | 918ms |
Similar APIs
Didn't find what you were looking for? Suggest an improvement
/v1/commodityprice GET
https://api.api-ninjas.com/v1/commodityprice
Returns the current price information for one or more commodities. Prices are based on rolling futures contracts and are quoted in the commodity's native unit and currency convention — see the unit and currency_unit fields below. Use the optional currency and unit parameters to convert into any supported currency or compatible mass/volume/energy unit. Premium members have access to live prices, while free users only have access to 15-minute delayed data.
For all 30 commodities in one call, see /v1/commoditysnapshot. For historical prices, see /v1/commoditypricehistorical.
Parameters
nameoptionalName of a single commodity. Either
nameornamesis required (not both). 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 silverSilver Futures platinumPlatinum palladiumPalladium micro_goldMicro Gold Futures micro_silverMicro Silver Futures copperCopper Free aluminumAluminum Futures Free crude_oilCrude Oil brent_crude_oilBrent Crude Oil Free natural_gasNatural Gas heating_oilHeating Oil gasoline_rbobGasoline RBOB cornCorn Futures wheatWheat Futures Free soybeanSoybean Futures soybean_oilSoybean Oil Futures soybean_mealSoybean Meal Futures oatOat Futures rough_riceRough Rice Futures coffeeCoffee Free sugarSugar cocoaCocoa Free cottonCotton orange_juiceOrange Juice lumberLumber Futures lean_hogsLean Hogs Futures live_cattleLive Cattle Futures feeder_cattleFeeder Cattle Futures class_3_milkClass III Milk Futures Free namesoptionalComma-separated list of commodity values for a batch request (e.g.,
gold,silver,platinum). Maximum 30 per call. When provided, the response is a JSON array instead of a single object. Mutually exclusive withname. Free tier users only receive results for commodities in the current weekly rotation; other entries are returned as{ error }rows.currencyoptionalISO 4217 currency code to convert the price into (e.g.,
EUR,GBP,INR,JPY). When provided, USX prices are first normalized to USD before conversion, so the response is always in major currency units. Defaults to the commodity's native USD/USX quote.unitoptionalTarget unit for the price. Supported: mass (
troy_ounce,lb,kg,g,oz,metric_ton,short_ton,hundredweight), volume (barrel,gallon,liter,cubic_meter), and energy (MMBtu,MWh,GJ,therm). Bushel and board_feet are commodity-specific and cannot be cross-converted — requests to convert them will return an error.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response
A JSON object with the following fields, or an array of such objects when names is used, or an error if the request is unsuccessful.
exchangeThe symbol of the exchange where the commodity is traded.
nameThe name of the commodity.
priceThe current price of the commodity. See
currency_unitandunitbelow for the quote convention.currency_unitUSDfor US dollars per unit;USXfor US cents per unit (corn, wheat, soybean, etc.). Whencurrencyis provided in the request, this reflects the requested currency code instead.unitThe quote unit (e.g.,
troy_ounce,barrel,bushel,lb,MMBtu,gallon,metric_ton,short_ton,hundredweight,board_feet). Whenunitis provided in the request, this reflects the requested unit.previous_closePrevious session's closing price in the same quote convention as
price.change_24hAbsolute price change vs
previous_close.change_24h_percentPercent change vs
previous_close.high_24h/low_24hDay's high and low prices.
high_52w/low_52wDeveloper tier and above52-week high and low prices.
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
A JSON object with the following fields or an error if the request is unsuccessful.
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 KeySample Response
/v1/commoditysnapshot GET
https://api.api-ninjas.com/v1/commoditysnapshot
Returns current price data for every supported commodity in a single response. Useful for dashboards, watchlists, and any UI that needs the full set of commodities. Premium members have access to live prices, while free users only have access to 15-minute delayed data.
Parameters
categoryoptionalFilter to a single product category. One of
precious_metals,base_metals,energy,grains,softs,livestock.exchangeoptionalFilter to commodities listed on a single exchange. One of
CME,NYMEX,COMEX,ICE.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response
A JSON array of objects with the following fields, or an error if the request is unsuccessful.
exchangeListing exchange (e.g.,
CME).nameDisplay name of the commodity.
valueThe API
?name=slug (e.g.,gold,crude_oil).categoryOne of
precious_metals,base_metals,energy,grains,softs,livestock.currency_unit/unitQuote convention. See /v1/commodityprice for details on USD vs USX and the supported units.
priceCurrent price in the commodity's native unit and currency convention.
change_24hAbsolute price change vs the previous close.
volumeTrading volume for the session.
updatedUnix timestamp when the snapshot was fetched.
Sample Request Live Demo!
Try this API endpoint with all available parameters in our API playground
https://api.api-ninjas.com/v1/commoditysnapshotHeaders
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/commoditysnapshot" \
-H "X-Api-Key: YOUR_API_KEY"/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
A JSON object with the following fields or an error if the request is unsuccessful.
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
A JSON object with the following fields or an error if the request is unsuccessful.
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/commodityforwardcurve GET Business, Professional, or annual subscriptions only
https://api.api-ninjas.com/v1/commodityforwardcurve
Returns every active futures contract for the requested commodity, sorted by contract month, along with a curve-shape classification and 1-month and ~12-month percent slopes. This is the standard view for analyzing contango (upward-sloping curve) vs backwardation (downward-sloping). Reads from the same contracts feed as /v1/commoditycontract; for a single contract or unfiltered contract list, use that endpoint or /v1/commoditycontractlist.
Parameters
namerequiredCommodity value, using the same set as the /v1/commodityprice
nameparameter (e.g.,crude_oil,gold,corn).
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response
A JSON object with the following fields or an error if the request is unsuccessful.
nameDisplay name of the commodity.
valueAPI
?name=slug for the commodity.symbol_rootContract symbol root (e.g.,
CLfor crude oil).as_ofUnix timestamp of the most recent contract update across the curve.
structureCurve-shape classification:
contango(strictly upward),backwardation(strictly downward),mixed(both directions across the curve), orflat.contango_slope_1m_pct/contango_slope_12m_pctPercent difference between the front-month price and the next month (1m) and approximately one-year-out (12m) contract prices. Positive = contango; negative = backwardation.
curveArray of contracts sorted by
contract_monthascending. Each entry hascontract_symbol,contract_month(YYYY-MM),month_offset(months between today and the contract month, 0 = current month),last_price, andlast_updated.
Sample Request Live Demo!
Try this API endpoint with all available parameters in our API playground
https://api.api-ninjas.com/v1/commodityforwardcurve?name=crude_oilHeaders
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/commodityforwardcurve?name=crude_oil" \
-H "X-Api-Key: YOUR_API_KEY"