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.


Parameters

  • name  required

    Name of commodity. The supported values are:

    ValueDescriptionPremium Only
    goldGold FuturesNo
    soybean_oilSoybean Oil FuturesYes
    wheatWheat FuturesYes
    platinumPlatinumNo
    micro_silverMicro Silver FuturesYes
    lean_hogsLean Hogs FuturesNo
    cornCorn FuturesYes
    oatOat FuturesNo
    aluminumAluminum FuturesNo
    soybean_mealSoybean Meal FuturesNo
    silverSilver FuturesYes
    soybeanSoybean FuturesYes
    lumberLumber FuturesNo
    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
    palladiumPalladiumNo
    cocoaCocoaYes
    brent_crude_oilBrent Crude OilYes
    gasoline_rbobGasoline RBOBYes
    heating_oilHeating OilYes
    class_3_milkClass III Milk FuturesYes

Headers

  • X-Api-Key  required

    API Key associated with your account.

Sample Request Live Demo!

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

Sample Response

JSON
1 2 3 4 5 6 { "exchange": "NYMEX", "name": "Platinum", "price": 995.05, "updated": 1728677095 }

Code Examples

1 2 3 4 5 6 7 8 9 import requests name = 'platinum' api_url = 'https://api.api-ninjas.com/v1/commodityprice?name={}'.format(name) response = requests.get(api_url, headers={'X-Api-Key': 'YOUR_API_KEY'}) if response.status_code == requests.codes.ok: print(response.text) else: print("Error:", response.status_code, response.text)

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.