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.
Our API is easy to use and can be integrated into your application in minutes
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.
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.
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
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.
https://api.commoditypriceapi.com/v1
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.
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.
Code | Status | Description |
---|---|---|
200 | Success | Successfully processed the request |
400 | Bad Request | Something is wrong with request and it cannot be processed. This can be invalid JSON or invalid parameters options. |
402 | Usage error | The API key has reached the maximum allowed requests. |
403 | Forbidden | Invalid API key or the API key doesn't have permissions to perform the request. |
404 | Not Found | The requested resource doesn't exist. |
429 | Too Many Requests | Too many requests, please try again in a minute |
500 | Internal Server Error | A 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.
# | Symbol | Name | Category |
---|---|---|---|
1 | XAU | Gold | Metals |
2 | XAG | Silver | Metals |
3 | WTIOIL | Crude Oil WTI | Energy |
4 | BRENTOIL | Crude Oil Brent | Energy |
5 | NG | Natural Gas | Energy |
6 | HO | Heating Oil | Energy |
7 | LGO | Gas Oil | Energy |
8 | HG | Copper | Metals |
9 | RB | RBOB Gasoline | Energy |
10 | CC | Cocoa | Agriculture |
11 | CA | Coffee Arabica | Agriculture |
12 | PL | Platinum | Metals |
13 | PA | Palladium | Metals |
14 | CORN | Corn | Agriculture |
15 | LS | Sugar | Agriculture |
16 | ZW | Wheat | Agriculture |
17 | CT | Cotton | Agriculture |
18 | TIOC | Iron Ore 62% FE | Metals |
19 | LEAD | Lead | Metals |
20 | AL | Aluminium | Metals |
21 | SOYBEAN | Soybeans | Agriculture |
22 | OAT | Oats | Agriculture |
23 | OJ | Orange Juice | Agriculture |
24 | ZL | Soybean Oil | Agriculture |
25 | ZM | Soybean Meal | Agriculture |
26 | RR | Rough Rice | Agriculture |
27 | LB | Lumber | Industrial |
28 | NICKEL | Nickel | Metals |
29 | ZINC | Zinc | Metals |
30 | TIN | Tin | Metals |
31 | MILK | Milk | Agriculture |
32 | ETHANOL | Ethanol | Industrial |
33 | NAPHTHA | Naphtha | Industrial |
34 | STEEL | Steel | Metals |
35 | TITAN | Titanium | Metals |
36 | CHE | Cheese | Agriculture |
37 | RUBBER | Rubber | Industrial |
38 | PO | Palm Oil | Agriculture |
39 | UXA | Uranium | Metals |
40 | PROP | Propane | Energy |
41 | METH | Methanol | Energy |
42 | URAL-OIL | Ural Oil | Energy |
43 | COAL | Coal | Energy |
44 | HRC-STEEL | Hot-Rolled Coil Steel | Metals |
45 | CANOLA | Canola | Agriculture |
46 | WOOL | Wool | Agriculture |
47 | TEA | Tea | Agriculture |
48 | SUNF | Sunflower Oil | Agriculture |
49 | BUTTER | Butter | Agriculture |
50 | POTATO | Potato | Agriculture |
51 | BIT | Bitumen | Industrial |
52 | COB | Cobalt | Industrial |
53 | XRH | Rhodium | Industrial |
54 | POL | Polyethylene | Industrial |
55 | PVC | Polyvinyl Chloride | Industrial |
56 | PYL | Polypropylene | Industrial |
57 | SODASH | Soda Ash | Industrial |
58 | NDYM | Neodymium | Industrial |
59 | TEL | Tellurium | Industrial |
60 | UANEU | Urea Ammonium Nitrate | Industrial |
61 | UREA | Urea | Industrial |
62 | DIAPH | Diammonium Phosphate | Industrial |
63 | MG | Magnesium | Industrial |
64 | GA | Gallium | Industrial |
65 | INDIUM | Indium | Industrial |
66 | K-PULP | Kraft Pulp | Industrial |
67 | EGGS-CH | Eggs CH | Livestock |
68 | EGGS-US | Eggs US | Livestock |
69 | TTF-GAS | TTF Gas | Energy |
70 | UK-GAS | UK Gas | Energy |
71 | SALMON | Salmon | Livestock |
72 | POUL | Poultry | Livestock |
73 | RSO | Rapeseed Oil | Agriculture |
74 | LC | Lithium | Metals |
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
booleantrue if the request was successful, false if there was an error.
error
stringerror message if the request was unsuccessful.
plan
stringYour current plan.
quota
integerYour current quota.
used
integerYour 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
ParametersapiKey
string REQUIREDYour unique API key. Note This may also be passed via
x-api-key
header.Response Object
success
booleantrue if the request was successful, false if there was an error.
message
string OPTIONALerror message if the request was unsuccessful.
statusCode
string OPTIONALHTTP status code of the response, if the request was unsuccessful.
symbols
objectobject 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
ParametersapiKey
string REQUIREDYour unique API key. Note This may also be passed via
x-api-key
header.symbols
string array REQUIREDlist of comma separated currency symbols.
Response Object
success
booleantrue if the request was successful, false if there was an error.
message
string OPTIONALerror message if the request was unsuccessful.
statusCode
string OPTIONALHTTP status code of the response, if the request was unsuccessful.
rates
objectobject containing the requested rates.
timestamp
numbertimestamp 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
Code | Status | Description |
---|---|---|
400 | Bad Request | Invalid Symbols Found (A symbol in the symbols array is invalid). |
400 | Bad Request | Symbols is required in query params (symbols array is missing). |
402 | Payment Required | Maximum symbols per request exceeded. |
Historical Rates Endpoint
Api will return Historical rates for the specified date.
Endpoint
GET rates/historical
Request Object
ParametersapiKey
string REQUIREDYour unique API key. Note This may also be passed via
x-api-key
header.symbols
string array REQUIREDlist of comma separated currency symbols.
date
string REQUIREDdate for which the rates are requested. Format: YYYY-MM-DD
Response Object
success
booleantrue if the request was successful, false if there was an error.
message
string OPTIONALerror message if the request was unsuccessful.
statusCode
string OPTIONALHTTP status code of the response, if the request was unsuccessful.
rates
objectobject containing the requested rates.
date
stringdate 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
Code | Status | Description |
---|---|---|
400 | Bad Request | Invalid Symbols Found (A symbol in the symbols array is invalid). |
400 | Bad Request | Date is required in query params. |
400 | Bad Request | Invalid Date Format (YYYY-MM-DD). |
400 | Bad Request | Symbols 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
ParametersapiKey
string REQUIREDYour unique API key. Note This may also be passed via
x-api-key
header.symbols
string array REQUIREDlist of comma separated currency symbols.
startDate
string REQUIREDstart date for the fluctuation. Format: YYYY-MM-DD
endDate
string REQUIREDend date for the fluctuation. Format: YYYY-MM-DD
Response Object
success
booleantrue if the request was successful, false if there was an error.
message
string OPTIONALerror message if the request was unsuccessful.
statusCode
string OPTIONALHTTP status code of the response, if the request was unsuccessful.
rates
objectobject containing the requested rates.
startDate
stringstart date for the fluctuation. Format: YYYY-MM-DD
endDate
stringend 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
Code | Status | Description |
---|---|---|
400 | Bad Request | Invalid Symbols Found (A symbol in the symbols array is invalid). |
400 | Bad Request | startDate is required in query params. |
400 | Bad Request | endDate is required in query params. |
400 | Bad Request | Invalid date format specified for start or end date. |
400 | Bad Request | Symbols 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
ParametersapiKey
string REQUIREDYour unique API key. Note This may also be passed via
x-api-key
header.symbols
string array REQUIREDlist of comma separated currency symbols.
startDate
string REQUIREDstart date for the fluctuation. Format: YYYY-MM-DD
endDate
string REQUIREDend date for the fluctuation. Format: YYYY-MM-DD
Response Object
success
booleantrue if the request was successful, false if there was an error.
message
string OPTIONALerror message if the request was unsuccessful.
statusCode
string OPTIONALHTTP status code of the response, if the request was unsuccessful.
rates
objectobject containing the requested rates.
startDate
stringstart date for the fluctuation. Format: YYYY-MM-DD
endDate
stringend 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
Code | Status | Description |
---|---|---|
400 | Bad Request | Invalid Symbols Found (A symbol in the symbols array is invalid). |
400 | Bad Request | startDate is required in query params. |
400 | Bad Request | endDate is required in query params. |
400 | Bad Request | Invalid date format specified for start or end date. |
400 | Bad Request | Symbols is required in query params (symbols array is missing). |
Simple Pricing
Choose your plan and get started. Upgrade, downgrade or cancel anytime
Frequently AskedQuestions
We have over 70+ commodities available on our platform. Please take a look at the full list of available in our documentation.