Unlock Real-timeCommodity Prices  with our Powerful Json API

CommodityPriceAPI is a simple JSON API that provides real-time and historical commodity prices for 70+ commodities including Crude Oil, Gold, Silver, Natural Gas, Wheat, Corn and many more.

Get a 7 day free trial.

https://api.commoditypriceapi.com/v1 
API Key:

Enter you API Key to Test the Results.

Core Features

Our API is easy to use and can be integrated into your application in minutes

title

Simple fast and reliable

Access an extensive list of 70+ commodities, from precious metals to energy resources. Our API provides comprehensive coverage, ensuring you have all the information you need in one place.

title

Easy to integrate

Our API is easy to integrate into your application and can be integrated in minutes. We provide comprehensive documentation and support to help you get started.

title

No complex contracts

We offer a simple, flexible pricing structure. You can choose between a monthly or annual subscription, and you can cancel at any time. We also offer a 7-day free trial

title

Trusted Data Sources

Our data is sourced from trusted exchanges and financial institutions.

Get your API key today

CommodityPriceAPI is the easiest way to get real-time and historical prices for a diverse range of commodities. Our API is easy to use and can be integrated into your application in minutes.

Documentation

CommodityPriceAPI


CommodityPriceAPI provides a simple REST API for live and historical rates for 70+ commodities in a simple JSON format.


Commodity rates are retrieved from various data sources and are delivered in 60 seconds or 10 minutes based on the subscription plan. There are no complex queries, confusing authentication methods, or long-term contracts.


Rates are available historically for all days going back up to 1st January, 1999.


Authentication


The CommodityPriceAPI uses API keys to authenticate requests. Each request must contain your API key via an apiKey query parameter or x-api-key in request header.



Get Your API key


You can get your API key from the Dashboard page.


Do not share your API key in publicly accessible areas such as GitHub, client-side code, and so forth.


Send Your API key


The Api Key may be sent in 2 ways


  • Request Parameters - Include an apiKey parameter in your request's query string.
  • Request Header - Include an x-api-key request header with each request.


Track Usage



You can track your API usage in the Dashboard page and also via the Usage endpoint.


Errors And Codes


The CommodityPriceAPI returns error status using both conventional HTTP codes and errorMessages within the JSON response body.

The status Property


API responses contain an status field of typestring. It is used to report the status of the request.


The message Property


API responses contain a message field of typestring. This field is used to report problems such as account overage and invalid parameters.


HTTP Status Codes


The API also returns success and error status via the HTTP status codes below.



CodeStatusDescription
200SuccessSuccessfully processed the request
400Bad RequestSomething is wrong with request and it cannot be processed. This can be invalid JSON or invalid parameters options.
402Usage errorThe API key has reached the maximum allowed requests.
403ForbiddenInvalid API key or the API key doesn't have permissions to perform the request.
404Not FoundThe requested resource doesn't exist.
429Too Many RequestsToo many requests, please try again in a minute
500Internal Server ErrorA server error occurred and the request was not able to be processed.

Supported Symbols


The full list of commodities presently available through the CommodityPriceAPI data, also available in JSON format via the symbols API endpoint.



#SymbolNameCategory
1XAUGoldMetals
2XAGSilverMetals
3WTIOILCrude Oil WTIEnergy
4BRENTOILCrude Oil BrentEnergy
5NGNatural GasEnergy
6HOHeating OilEnergy
7LGOGas OilEnergy
8HGCopperMetals
9RBRBOB GasolineEnergy
10CCCocoaAgriculture
11CACoffee ArabicaAgriculture
12PLPlatinumMetals
13PAPalladiumMetals
14CORNCornAgriculture
15LSSugarAgriculture
16ZWWheatAgriculture
17CTCottonAgriculture
18TIOCIron Ore 62% FEMetals
19LEADLeadMetals
20ALAluminiumMetals
21SOYBEANSoybeansAgriculture
22OATOatsAgriculture
23OJOrange JuiceAgriculture
24ZLSoybean OilAgriculture
25ZMSoybean MealAgriculture
26RRRough RiceAgriculture
27LBLumberIndustrial
28NICKELNickelMetals
29ZINCZincMetals
30TINTinMetals
31MILKMilkAgriculture
32ETHANOLEthanolIndustrial
33NAPHTHANaphthaIndustrial
34STEELSteelMetals
35TITANTitaniumMetals
36CHECheeseAgriculture
37RUBBERRubberIndustrial
38POPalm OilAgriculture
39UXAUraniumMetals
40PROPPropaneEnergy
41METHMethanolEnergy
42URAL-OILUral OilEnergy
43COALCoalEnergy
44HRC-STEELHot-Rolled Coil SteelMetals
45CANOLACanolaAgriculture
46WOOLWoolAgriculture
47TEATeaAgriculture
48SUNFSunflower OilAgriculture
49BUTTERButterAgriculture
50POTATOPotatoAgriculture
51BITBitumenIndustrial
52COBCobaltIndustrial
53XRHRhodiumIndustrial
54POLPolyethyleneIndustrial
55PVCPolyvinyl ChlorideIndustrial
56PYLPolypropyleneIndustrial
57SODASHSoda AshIndustrial
58NDYMNeodymiumIndustrial
59TELTelluriumIndustrial
60UANEUUrea Ammonium NitrateIndustrial
61UREAUreaIndustrial
62DIAPHDiammonium PhosphateIndustrial
63MGMagnesiumIndustrial
64GAGalliumIndustrial
65INDIUMIndiumIndustrial
66K-PULPKraft PulpIndustrial
67EGGS-CHEggs CHLivestock
68EGGS-USEggs USLivestock
69TTF-GASTTF GasEnergy
70UK-GASUK GasEnergy
71SALMONSalmonLivestock
72POULPoultryLivestock
73RSORapeseed OilAgriculture
74LCLithiumMetals

Usage Endpoint


Api will return usage information for your account.

Endpoint



GET /usage




Request Object

Parameters

apiKey is REQUIRED


Your unique API key. Note This may also be passed via x-api-key header.



Response Object


success boolean

true if the request was successful, false if there was an error.





error string

error message if the request was unsuccessful.





plan string

Your current plan.





quota integer

Your current quota.





used integer

Your usage since start of month.





Response JSON



{
  "success": true,
  "plan": "lite",
  "quota": 2000,
  "used": 0
}


Symbols Endpoint


Api will return a list of all available symbols.

mdx filename="Endpoint" GET /symbols


Request Object

Parameters

apiKey string REQUIRED
Your unique API key. Note This may also be passed via x-api-key header.



Response Object


success boolean

true if the request was successful, false if there was an error.





message string OPTIONAL

error message if the request was unsuccessful.





statusCode string OPTIONAL

HTTP status code of the response, if the request was unsuccessful.





symbols object

object containing list of available symbols.





Response JSON



{
  "success": true,
  "symbols": [
    {
      "symbol": "WTIOIL",
      "category": "Energy",
      "currency": {
        "code": "USD",
        "name": "US Dollar",
        "symbol": "$"
      },
      "unit": {
        "symbol": "Bbl",
        "name": "Barrel"
      },
      "name": "Crude Oil WTI"
    },
    {
      "symbol": "NG",
      "category": "Energy",
      "currency": {
        "code": "USD",
        "name": "US Dollar",
        "symbol": "$"
      },
      "unit": {
        "symbol": "MMBtu",
        "name": "Million British Thermal Units"
      },
      "name": "Natural Gas"
    },
    {
      "symbol": "XAG",
      "category": "Metals",
      "currency": {
        "code": "USD",
        "name": "US Dollar",
        "symbol": "$"
      },
      "unit": {
        "symbol": "T.oz",
        "name": "Troy Ounce"
      },
      "name": "Silver"
    },
    {
      "symbol": "BRENTOIL",
      "category": "Energy",
      "currency": {
        "code": "USD",
        "name": "US Dollar",
        "symbol": "$"
      },
      "unit": {
        "symbol": "Bbl",
        "name": "Barrel"
      },
      "name": "Crude Oil Brent"
    },
    {
      "symbol": "XAU",
      "category": "Metals",
      "currency": {
        "code": "USD",
        "name": "US Dollar",
        "symbol": "$"
      },
      "unit": {
        "symbol": "T.oz",
        "name": "Troy Ounce"
      },
      "name": "Gold"
    },
    {
      "symbol": "HG",
      "category": "Metals",
      "currency": {
        "code": "USD",
        "name": "US Dollar",
        "symbol": "$"
      },
      "unit": {
        "symbol": "Lb",
        "name": "Pound"
      },
      "name": "Copper"
    }
  ]
}


Latest Rates Endpoint


Api will return the latest rates for the given symbols, depending on the subscription plan latest rates may be delayed by up to 10 minutes.

Endpoint



GET rates/latest




Request Object

Parameters

apiKey string REQUIRED
Your unique API key. Note This may also be passed via x-api-key header.

symbols string array REQUIRED
list of comma separated currency symbols.



Response Object


success boolean

true if the request was successful, false if there was an error.





message string OPTIONAL

error message if the request was unsuccessful.





statusCode string OPTIONAL

HTTP status code of the response, if the request was unsuccessful.





rates object

object containing the requested rates.





timestamp number

timestamp of the response in seconds since UNIX epoch. .





Response JSON



{
  "success": true,
  "timestamp": 1703866777,
  "metaData": {
    "XAU": {
      "unit": "T.oz",
      "base": "USD"
    },
    "WTIOIL": {
      "unit": "Bbl",
      "base": "USD"
    }
  },
  "rates": {
    "WTIOIL": 72.29,
    "XAU": 2066.98
  }
}


HTTP Status Codes



CodeStatusDescription
400Bad RequestInvalid Symbols Found (A symbol in the symbols array is invalid).
400Bad RequestSymbols is required in query params (symbols array is missing).
402Payment RequiredMaximum symbols per request exceeded.

Historical Rates Endpoint


Api will return Historical rates for the specified date.

Endpoint



GET rates/historical




Request Object

Parameters

apiKey string REQUIRED
Your unique API key. Note This may also be passed via x-api-key header.

symbols string array REQUIRED
list of comma separated currency symbols.

date string REQUIRED
date for which the rates are requested. Format: YYYY-MM-DD



Response Object


success boolean

true if the request was successful, false if there was an error.





message string OPTIONAL

error message if the request was unsuccessful.





statusCode string OPTIONAL

HTTP status code of the response, if the request was unsuccessful.





rates object

object containing the requested rates.





date string

date for which the rates are requested. Format: YYYY-MM-DD





Response JSON



{
  "success": true,
  "date": "2019-01-04",
  "rates": {
    "XAU": {
      "open": 1295.17,
      "high": 1298.49,
      "low": 1276.6,
      "close": 1284.81
    },
    "WTIOIL": {
      "open": 46.9,
      "high": 49.22,
      "low": 46.65,
      "close": 47.96
    }
  }
}


HTTP Status Codes



CodeStatusDescription
400Bad RequestInvalid Symbols Found (A symbol in the symbols array is invalid).
400Bad RequestDate is required in query params.
400Bad RequestInvalid Date Format (YYYY-MM-DD).
400Bad RequestSymbols is required in query params (symbols array is missing).

Timeseries Endpoint


with this endpoint you can get the historical rates for a time period.

EndPoint



GET rates/time-series




Request Object

Parameters

apiKey string REQUIRED
Your unique API key. Note This may also be passed via x-api-key header.

symbols string array REQUIRED
list of comma separated currency symbols.

startDate string REQUIRED
start date for the fluctuation. Format: YYYY-MM-DD

endDate string REQUIRED
end date for the fluctuation. Format: YYYY-MM-DD


The maximum difference between the start and end date is 30 days.


Response Object


success boolean

true if the request was successful, false if there was an error.





message string OPTIONAL

error message if the request was unsuccessful.





statusCode string OPTIONAL

HTTP status code of the response, if the request was unsuccessful.





rates object

object containing the requested rates.





startDate string

start date for the fluctuation. Format: YYYY-MM-DD





endDate string

end date for the fluctuation. Format: YYYY-MM-DD





Response JSON



{
  "success": true,
  "startDate": "2023-12-08",
  "endDate": "2023-12-13",
  "rates": {
    "2023-12-08": {
      "XAU": {
        "open": 2027.93,
        "high": 2033.89,
        "low": 1994.49,
        "close": 2004.35
      },
      "WTIOIL": {
        "open": 69.34,
        "high": 71.63,
        "low": 69.5,
        "close": 71.23
      }
    },
    "2023-12-10": {
      "XAU": {
        "open": 2005.5,
        "high": 2007.44,
        "low": 2004.43,
        "close": 2006.93
      },
      "WTIOIL": {
        "open": 71.25,
        "high": 71.66,
        "low": 70.92,
        "close": 71.47
      }
    },
    "2023-12-11": {
      "XAU": {
        "open": 2006.92,
        "high": 2007.62,
        "low": 1975.76,
        "close": 1982.79
      },
      "WTIOIL": {
        "open": 71.4,
        "high": 71.92,
        "low": 71.36,
        "close": 71.92
      }
    },
    "2023-12-12": {
      "XAU": {
        "open": 1982.79,
        "high": 1996.48,
        "low": 1977.09,
        "close": 1982.44
      },
      "WTIOIL": {
        "open": 68.72,
        "high": 68.88,
        "low": 68.26,
        "close": 68.43
      }
    },
    "2023-12-13": {
      "XAU": {
        "open": 1982.44,
        "high": 2033.06,
        "low": 1972.91,
        "close": 2032.68
      },
      "WTIOIL": {
        "open": 69.91,
        "high": 70.17,
        "low": 69.67,
        "close": 69.83
      }
    }
  }
}


HTTP Status Codes



CodeStatusDescription
400Bad RequestInvalid Symbols Found (A symbol in the symbols array is invalid).
400Bad RequeststartDate is required in query params.
400Bad RequestendDate is required in query params.
400Bad RequestInvalid date format specified for start or end date.
400Bad RequestSymbols is required in query params (symbols array is missing).

Fluctuation Endpoint


with this endpoint you can get the commodity's fluctuation on a day-to-day basis.

EndPoint



GET rates/time-series




Request Object

Parameters

apiKey string REQUIRED
Your unique API key. Note This may also be passed via x-api-key header.

symbols string array REQUIRED
list of comma separated currency symbols.

startDate string REQUIRED
start date for the fluctuation. Format: YYYY-MM-DD

endDate string REQUIRED
end date for the fluctuation. Format: YYYY-MM-DD




Response Object


success boolean

true if the request was successful, false if there was an error.





message string OPTIONAL

error message if the request was unsuccessful.





statusCode string OPTIONAL

HTTP status code of the response, if the request was unsuccessful.





rates object

object containing the requested rates.





startDate string

start date for the fluctuation. Format: YYYY-MM-DD





endDate string

end date for the fluctuation. Format: YYYY-MM-DD





Response JSON



{
  "success": true,
  "startDate": "2023-12-08",
  "endDate": "2023-12-13",
  "rates": {
    "WTIOIL": {
      "startRate": 71.23,
      "endRate": 69.83,
      "change": -1.4,
      "changePercent": -1.97
    },
    "XAU": {
      "startRate": 2004.35,
      "endRate": 2032.68,
      "change": 28.33,
      "changePercent": 1.41
    }
  }
}


HTTP Status Codes



CodeStatusDescription
400Bad RequestInvalid Symbols Found (A symbol in the symbols array is invalid).
400Bad RequeststartDate is required in query params.
400Bad RequestendDate is required in query params.
400Bad RequestInvalid date format specified for start or end date.
400Bad RequestSymbols is required in query params (symbols array is missing).
PRICING PLANS

Simple Pricing

Choose your plan and get started. Upgrade, downgrade or cancel anytime

Dotted

Frequently AskedQuestions

We have over 70+ commodities available on our platform. Please take a look at the full list of available in our documentation.