Coffee Price API
Coffee is one of the world's most popular beverages and most traded agricultural commodities. Coffee (Arabica) futures are priced in US cents per pound. Coffee prices are affected by weather in growing regions, currency fluctuations, and global demand. The Coffee Price API provides coffee futures market data.
From 9,027 users
Applications using this API
API Status
API Response Times
Average | P50 | P75 | P90 | P95 |
|---|---|---|---|---|
| 224ms | 250ms | 293ms | 578ms | 1165ms |
Similar APIs
Didn't find what you were looking for? Suggest an improvement
/v1/commodityprice GET
https://api.api-ninjas.com/v1/commodityprice
Parameters
namerequiredName of commodity. Use
coffeefor Coffee. See the full list of supported commodities.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response
A JSON object with the following fields or an error if the request is unsuccessful.
exchangeThe symbol of the exchange where the commodity is traded (e.g.,
ICE).nameThe name of the commodity.
priceThe current price of the commodity in USD.
updatedThe Unix timestamp of the price update.
Sample Request Live Demo!
Try our APIs in the API playground
Sign up for a free API key to get started — no credit card required.
https://api.api-ninjas.com/v1/commodityprice?name=coffeeHeaders
X-Api-KeyLog in or sign up to get your API KeySample Response
Code Examples
1
2
curl -X GET "https://api.api-ninjas.com/v1/commodityprice?name=coffee" \
-H "X-Api-Key: YOUR_API_KEY"If your programming language is not listed above, you can still make API calls by using any HTTP request library and following the documentation above.
/v1/commoditypricehistorical GET Premium Only
https://api.api-ninjas.com/v1/commoditypricehistorical
Returns historical Coffee futures price data in OHLCV (Open, High, Low, Close, Volume) format. Data is returned in descending order (most recent first), and all prices are in USD.
Parameters
namerequiredUse
coffeefor Coffee.periodoptionalTime interval between data points. Valid values:
1m,5m,15m,30m,1h,4h,1d. Default is1h.startoptionalStart timestamp in Unix format. Defaults to 24 hours ago.
endoptionalEnd timestamp in Unix format. Defaults to current time.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response
A JSON array of objects or an error if the request is unsuccessful.
openOpening price in USD.
highHighest price in USD.
lowLowest price in USD.
closeClosing price in USD.
volumeTrading volume.
timeUnix timestamp of the period.
Sample Request Live Demo!
Try our APIs in the API playground
Sign up for a free API key to get started — no credit card required.
https://api.api-ninjas.com/v1/commoditypricehistorical?name=coffee&period=1hHeaders
X-Api-KeyLog in or sign up to get your API KeySample Response
Code Examples
1
2
curl -X GET "https://api.api-ninjas.com/v1/commoditypricehistorical?name=coffee&period=1h" \
-H "X-Api-Key: YOUR_API_KEY"Frequently Asked Questions
Can I use the Commodity Price API for commercial purposes?
Yes, but you must have a premium subscription. Commercial use of the Commodity Price API is not permitted on the free tier. See our pricing page to choose a plan that fits your needs.How do I get an API key and start using the Commodity Price API?
Sign up for a free account to instantly get your API key, then pass it in theX-Api-Keyheader on every request. The documentation above includes ready-to-run examples in cURL, Python, JavaScript, Node.js, and more.What happens if I exceed my quota for the month?
Your API requests will simply be denied once you hit your monthly quota — you will never be charged more than the plan you signed up for. To increase your quota, you can upgrade your plan any time on our pricing page.What happens if a request to the Commodity Price API fails?
The API responds with a standard HTTP status code and a JSON error message describing the problem. See our error codes reference for the full list of codes and how to resolve each one, or contact support if you need help.What commodities and endpoints does the Commodity Price API cover?
It provides real-time prices for dozens of commonly-traded commodities across categories likeprecious_metals,base_metals,energy,grains,softs, andlivestockon exchanges includingCME,NYMEX,COMEX, andICE. Available endpoints include/v1/commoditypricefor one or more commodities,/v1/commoditysnapshotfor every commodity at once,/v1/commoditypricehistoricalfor OHLCV history, plus/v1/commoditycontract,/v1/commoditycontractlist, and/v1/commodityforwardcurve; see the full list of finance APIs on our APIs page.How do I query a single commodity's price and convert its currency or unit?
Call/v1/commoditypricewith thenameparameter (e.g.,goldorplatinum), or pass a comma-separatednameslist of up to 30 commodities for a batch request. You can add the optionalcurrencyparameter (an ISO 4217 code likeEURorGBP) and theunitparameter (such askg,barrel, orMMBtu) to convert the price; for a comparable single-commodity service see the Gold Price API.What does the /v1/commodityprice response include?
Each result returns theexchange,name,price, and the quote convention viacurrency_unit(USDorUSXcents) andunit, along withprevious_close,change_24h,change_24h_percent,high_24h/low_24h,high_52w/low_52w(Developer tier and above), and anupdatedUnix timestamp. Free users receive 15-minute delayed data while premium members get live prices, which you can compare on the pricing page.How can I analyze whether a commodity is in contango or backwardation?
Use the/v1/commodityforwardcurveendpoint with thenameparameter (e.g.,crude_oil) to get every active futures contract sorted by month plus astructureclassification ofcontango,backwardation,mixed, orflat, along withcontango_slope_1m_pctandcontango_slope_12m_pctslopes and a fullcurvearray. This endpoint requires a Business, Professional, or annual subscription, which you can sign up for here.