The Gold Price API provides access to real-time gold futures price in the Chicago Mercantile Exchange (CME).
For other commodity prices, please check out our Commodity Price API.
https://api.api-ninjas.com/v1/goldprice
Returns the current gold futures price in USD. For historical gold futures prices, see /v1/goldpricehistorical.
None
X-Api-Key requiredAPI Key associated with your account.
priceThe current gold futures price in USD.
timestampThe timestamp of the gold futures price in Unix format (in seconds).
https://api.api-ninjas.com/v1/goldpriceHeaders
X-Api-KeyLog in or sign up to get your API Key1
2
3
4
{
"price": 2310.1,
"updated": 1714769998
}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.
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.
period optionalTime interval between data points. Valid values are: 1m, 5m, 15m, 30m, 1h, 4h, 1d. Default is 1h.
start optionalStart timestamp in Unix format. If not provided, defaults to 24 hours ago.
end optionalEnd timestamp in Unix format. If not provided, defaults to current time.
X-Api-Key requiredAPI Key associated with your account.
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).
https://api.api-ninjas.com/v1/goldpricehistorical?period=1h&start=1706000000&end=17063028011
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
[
{
"open": 2624.7,
"low": 2621.4,
"high": 2626.3,
"close": 2622.3,
"volume": 1640,
"time": 1732582800
},
{
"open": 2626.5,
"low": 2617.1,
"high": 2626.5,
"close": 2624.7,
"volume": 2986,
"time": 1732579200
},
{
"open": 2630.2,
"low": 2625.2,
"high": 2631.6,
"close": 2626.6,
"volume": 1191,
"time": 1732575600
},
"..."
]