Our Live Commodity Prices API provides commodity market live rates, covering a wide spectrum of commodities—from common agricultural goods like sugar commodity price, coffee commodity prices, soybean commodity price and cotton commodity price to energy and metals. Whether you're building a trading dashboard, financial report, or consumer-facing app, we'll provide you with real time commodities prices for the markets that matter most to your users.
By delivering instant commodity prices reliably, our API enables businesses and developers to build applications that require real-time insights into commodity trends. With the support of custom quote currency, you can display the commodity prices in any supported currency like USD, EUR, or more, so your data is always presented in the context that matters most to your audience.
Stay ahead of market shifts with lightning-fast access to live commodity prices. By specifying the updates parameter, you can control how frequently your data refreshes, ensuring you always have the most current information on commodities.
Query dozens of commodities at once—track today silver and gold rate, agricultural commodity prices, key metal commodity prices and much more. One comma‑separated symbols parameter gives a comprehensive data in a single response.
Transform raw commodity values into a currency of your choice. By setting your own default quote currency, you gain more control over how prices are displayed, simplifying comparisons and helping streamline your analytical processes.
Note that the response returned will only be in json format, so the query parameter format=xml won't work. (See details about the format parameter here)
Parameter | Required | Type | Default | Description |
---|---|---|---|---|
symbols | Yes | Array | - | Comma separated list of desired commodities symbols. |
updates | Yes | String | - | Exchange rates update period. Possible values are: (1) 10m - 10 minutes update (2) 1m - 1 minute update |
quote | No | String | Default quote currency is the market currency of commodity. | Specifies the target currency for the exchange rate. |
View the full list of supported symbols by visiting here.
For all allowed quote values, visit here, and explore the fiat currencies.
Field | Type | Requirement | Description |
---|---|---|---|
success | Boolean | Mandatory | API request success indicator. "true" for successful requests. |
timestamp | Number | Mandatory | Unix timestamp indicating when the response was generated. |
rates | Map | Mandatory | Map containing rate data for all the requested commodities. |
metadata | Map | Mandatory | Map containing detailed information for all the requested commodities. |
metadata.[SYMBOL] | Map | Mandatory | Map containing detailed information for the specified commodity. |
metadata.[SYMBOL].unit | String | Mandatory | Unit of the respective commodity. |
metadata.[SYMBOL].quote | String | Mandatory | Quote currency of the respective commodity. |
HTTP Status | Reasons |
---|---|
404 | (1) The quote currency is invalid, please visit the documentation for a list of valid quote currencies
(2) The symbol is not supported, please visit the documentation for a list of supported symbols |
To get the latest commodity rates, call the endpoint by providing the updates and symbols query parameters. The response will be commodity rates of all the provided symbols.
#Response { "success": true, "timestamp": 1703866777, "rates": { "WTIOIL": 72.29, "XAU": 2066.98 }, "metaData": { "XAU": { "unit": "T.oz", "quote": "USD" }, "WTIOIL": { "unit": "Bbl", "quote": "USD" } } }}$ curl 'https://api.apifreaks.com/v1.0/commodity/rates/latest?apikey=API-KEY&updates=1m&symbols=WTIOIL,XAU'
For real time commodities prices, pass the updates query parameter to get the commodity rates that are updated after a specific period. The possible values are 10m, and 1m, which will return commodity rates updated every 10 minutes and 1 minute respectively in our database.
# Get exchange rates that get updated every 10 minutes.$ curl 'https://api.apifreaks.com/v1.0/commodity/rates/latest?apikey=API-KEY&updates=10m&symbols=WTIOIL,XAU'
Pass the symbols query parameter that is comma separated list of commodity symbols whose rates are required. The response will be the rates of the desired commodities.
#Response { "success": true, "timestamp": 1744813445, "rates": { "PL": 976.6, "ZW": 559.7 }, "metadata": { "PL": { "unit": "T.oz", "quote": "USD" }, "ZW": { "unit": "Bu", "quote": "USD" } } }$ curl 'https://api.apifreaks.com/v1.0/commodity/rates/latest?apikey=API-KEY&updates=1m&symbols=PL,ZW'
Pass the quote query parameter to get the commodity quotations in the desired currency.
#Response { "success": true, "timestamp": 1744813652, "rates": { "PL": 859.457, "ZW": 492.564 }, "metadata": { "PL": { "unit": "T.oz", "quote": "EUR" }, "ZW": { "unit": "Bu", "quote": "EUR" } } }$ curl 'https://api.apifreaks.com/v1.0/commodity/rates/latest?apikey=API-KEY&updates=1m&symbols=PL,ZW"e=EUR'
To use the Live Commodity Prices API, API credits are required. We only charge for successful queries, defined by a 2xx status code. If a request results in a 4xx or 5xx status code, no credits will be deducted, and any credits already charged will be refunded.
Service | Credits |
---|---|
10-Minute Rates Updates | 30 credit |
1-Minute Rates Updates | 35 credits |
Symbols | 1 credit per symbol |
For example:
$ curl 'https://api.apifreaks.com/v1.0/commodity/rates/latest?updates=10m&symbols=XAU,HG'
For a successful response from the above request, total of 32 credits will be charged: 30 credits for 10 minutes updates, and 2 credits for the 2 symbols.
If invalid symbols are provided along with valid values, then API will return successful response with 2xx status code but only the valid symbols will be returned. No credits will be deducted for the invalid symbols and any credits charged will be refunded.
Utilize the Credits Usage API to efficiently monitor your recent consumption of both one-off and subscription credits. This API provides a streamlined way to track and manage your credit usage, helping you stay informed about your remaining balance and optimize your resource allocation effectively.