Gold Price API
The Gold Price API provides access to current and historical gold prices.
Available endpoints:
- /v1/goldprice - Access the current gold price
- /v1/goldpricehistorical - Access historical gold prices
For other commodity prices, please check out our Commodity Price API.
Premium members have access to live prices, while free users only have access to 15-minute delayed data.
From 4,675 users
Applications using this API
API Status
API Response Times
Average | P50 | P75 | P90 | P95 |
|---|---|---|---|---|
| 269ms | 298ms | 357ms | 720ms | 1033ms |
Didn't find what you were looking for? Suggest an improvement
/v1/goldprice GETPremium Only
https://api.api-ninjas.com/v1/goldprice
Returns the current gold futures price in USD. Premium members have access to live prices, while free users only have access to 15-minute delayed data. For historical gold futures prices, see /v1/goldpricehistorical.
Parameters
currencyoptional premium onlyISO 4217 currency code to convert the price into (e.g.
EUR,GBP). Defaults to USD.unitoptional premium onlyTarget unit to convert the price into. One of
troy_ounce(default),g,kg,oz,lb,metric_ton,short_ton, orhundredweight.
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.
priceThe current gold futures price (in USD per troy ounce by default; see the
currencyandunitparameters).unitThe quote unit (
troy_ounceby default; changes when theunitparameter is used).currency_unitThe price currency (
USDby default; changes when thecurrencyparameter is used).timestampThe timestamp of the gold futures price in Unix format (in seconds).
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/goldpriceHeaders
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/goldprice" \
-H "X-Api-Key: YOUR_API_KEY"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.
/v1/goldpricehistorical GETPremium Only
https://api.api-ninjas.com/v1/goldpricehistorical
Returns historical gold futures price data in OHLCV (Open, High, Low, Close, Volume) format. The data is returned in descending order (most recent first), and all prices are in USD.
Parameters
periodoptionalTime interval between data points. Valid values are:
1m,5m,15m,30m,1h,4h,1d. Default is1h.startoptionalStart timestamp in Unix format. If not provided, defaults to 24 hours ago.
endoptionalEnd timestamp in Unix format. If not provided, defaults to current time.
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.
openThe opening price for this time period in USD.
lowThe lowest price during this time period in USD.
highThe highest price during this time period in USD.
closeThe closing price for this time period in USD.
volumeThe trading volume during this time period.
timeThe timestamp for this data point in Unix format (in seconds).
Historical Price 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/goldpricehistorical?period=1hHeaders
X-Api-KeyLog in or sign up to get your API KeyHistorical Price Sample Response
Frequently Asked Questions
Can I use the Gold Price API for commercial purposes?
Yes, but you must have a premium subscription. Commercial use of the Gold 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 Gold 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 Gold 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 endpoints does the Gold Price API offer?
The Gold Price API has two endpoints:/v1/goldpricereturns the current gold futures price in USD, and/v1/goldpricehistoricalreturns historical gold futures prices in OHLCV format. For other commodities, see the Commodity Price API.How fresh is the gold price data, and what determines whether I get live prices?
Premium members have access to live gold futures prices, while free users only have access to 15-minute delayed data, so your access tier set on the pricing page determines freshness.How do I request historical gold prices for a specific time range and interval?
Call/v1/goldpricehistoricalwith the optionalperiodparameter (valid values1m,5m,15m,30m,1h,4h,1d; default1h) plusstartandendUnix timestamps; if omitted,startdefaults to 24 hours ago andendto the current time. You can try it live after you register.What fields does the historical endpoint response include?
Each data point returnsopen,high,low, andcloseprices in USD, along withvolumeand atimeUnix timestamp, ordered most recent first; a failed request instead returns an error.