Holiday Sale! Get over 30% off when you subscribe to an annual plan!

Gold Price API

The Gold Price API provides access to real-time gold futures price in the Chicago Mercantile Exchange (CME).

Available endpoints:

For other commodity prices, please check out our Commodity Price API.

API Status

Online - All Systems Operational

API Response Times

Average
P50
P75
P90
P95
219ms269ms284ms655ms951ms

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. For historical gold futures prices, see /v1/goldpricehistorical.

Parameters

None.

Headers

  • X-Api-Key  required

    API Key associated with your account.

Response

  • price

    The current gold futures price in USD.

  • timestamp

    The timestamp of the gold futures price in Unix format (in seconds).

Sample Request Live Demo!

Try this API endpoint with all available parameters in our API playground

https://api.api-ninjas.com/v1/goldprice

Headers

X-Api-KeyLog in or sign up to get your API Key

Sample Response

JSON
1 2 3 4 { "price": 2310.1, "updated": 1714769998 }

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

  • period  optional

    Time interval between data points. Valid values are: 1m, 5m, 15m, 30m, 1h, 4h, 1d. Default is 1h.

  • start  optional

    Start timestamp in Unix format. If not provided, defaults to 24 hours ago.

  • end  optional

    End timestamp in Unix format. If not provided, defaults to current time.

Headers

  • X-Api-Key  required

    API Key associated with your account.

Response

  • open

    The opening price for this time period in USD.

  • low

    The lowest price during this time period in USD.

  • high

    The highest price during this time period in USD.

  • close

    The closing price for this time period in USD.

  • volume

    The trading volume during this time period.

  • time

    The timestamp for this data point in Unix format (in seconds).

Historical Price Sample Request Live Demo!

period
start
end

Try this API endpoint with all available parameters in our API playground

https://api.api-ninjas.com/v1/goldpricehistorical?period=1h

Headers

X-Api-KeyLog in or sign up to get your API Key

Historical Price Sample Response

JSON
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 [ { "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 }, "..." ]