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:

(4.3)

From 9,027 users

4,300+

Applications using this API

API Status

Online - All Systems Operational

API Response Times

Average
P50
P75
P90
P95
200ms230ms284ms524ms1141ms

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

  • symbol  optional

    Specific contract symbol to look up (e.g., GCK26).

  • symbol_root  optional

    Commodity root to filter contracts (e.g., GC returns all contracts starting with GC like GCK26, GCM26, etc.).

Headers

  • X-Api-Key  required

    API Key associated with your account.

Response

  • symbol

    The full contract symbol.

  • last_price

    The last price of the commodity contract.

  • last_updated

    The Unix timestamp of when the price was last updated.

Sample Request Live Demo!

symbol
symbol_root

Try this API endpoint with all available parameters in our API playground

https://api.api-ninjas.com/v1/commoditycontract?symbol=GCK26

Headers

X-Api-KeyLog in or sign up to get your API Key

Sample Response

JSON

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-Key  required

    API Key associated with your account.

Response

  • symbol

    The full contract symbol (e.g., "GCK26").

  • commodity

    The 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/commoditycontractlist

Headers

X-Api-KeyLog in or sign up to get your API Key

Sample Response

JSON

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

  • name  required

    Name of commodity. The supported values are:

    ValueDescriptionPremium Only
    goldGold FuturesYes
    soybean_oilSoybean Oil FuturesYes
    wheatWheat FuturesYes
    platinumPlatinumNo
    micro_silverMicro Silver FuturesNo
    lean_hogsLean Hogs FuturesYes
    cornCorn FuturesYes
    oatOat FuturesNo
    aluminumAluminum FuturesYes
    soybean_mealSoybean Meal FuturesYes
    silverSilver FuturesYes
    soybeanSoybean FuturesYes
    lumberLumber FuturesYes
    live_cattleLive Cattle FuturesYes
    sugarSugarYes
    natural_gasNatural GasYes
    crude_oilCrude OilYes
    orange_juiceOrange JuiceYes
    coffeeCoffeeYes
    cottonCottonYes
    copperCopperYes
    micro_goldMicro Gold FuturesNo
    feeder_cattleFeeder Cattle FuturesNo
    rough_riceRough Rice FuturesNo
    palladiumPalladiumYes
    cocoaCocoaYes
    brent_crude_oilBrent Crude OilYes
    gasoline_rbobGasoline RBOBYes
    heating_oilHeating OilYes
    class_3_milkClass III Milk FuturesNo

Headers

  • X-Api-Key  required

    API Key associated with your account.

Response

  • exchange

    The symbol of the exchange where the commodity is traded.

  • name

    The name of the commodity.

  • price

    The current price of the commodity in USD.

  • updated

    The Unix timestamp of the price update.

Sample Request Live Demo!

name

Try this API endpoint with all available parameters in our API playground

https://api.api-ninjas.com/v1/commodityprice?name=platinum

Headers

X-Api-KeyLog in or sign up to get your API Key

Sample Response

JSON

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

  • name  required

    Name of commodity. Use the same values as the name parameter in /v1/commodityprice.

  • period  optional

    Time interval between data points. Valid values are: 1m, 5m, 15m, 30m, 1h, 4h, 1d. Default is 1h.

  • start  optional

    Start timestamp in Unix format. If not provided, defaults to 24 hours ago.

  • end  optional

    End timestamp in Unix format. If not provided, defaults to current time.

Headers

  • X-Api-Key  required

    API Key associated with your account.

Response

  • open

    The opening price of the commodity in USD.

  • low

    The lowest price of the commodity in USD.

  • high

    The highest price of the commodity in USD.

  • close

    The closing price of the commodity in USD.

  • volume

    The volume of the commodity.

  • time

    The Unix timestamp of the price update.

Sample Request Live Demo!

name
period
start
end

Try this API endpoint with all available parameters in our API playground

https://api.api-ninjas.com/v1/commoditypricehistorical?name=gold&period=1h

Headers

X-Api-KeyLog in or sign up to get your API Key

Sample Response

JSON