NewConnect Claude, Gemini, ChatGPT, and other AI agents to API Ninjas via our MCP server

Gold Price API

The Gold Price API provides access to current and historical gold prices.

Available endpoints:

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.

(4.7)

From 4,675 users

3,400+

Applications using this API

API Status

Online - All Systems Operational

API Response Times

Average
P50
P75
P90
P95
269ms298ms357ms720ms1033ms

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

  • currency  optional premium only

    ISO 4217 currency code to convert the price into (e.g. EUR, GBP). Defaults to USD.

  • unit  optional premium only

    Target unit to convert the price into. One of troy_ounce (default), g, kg, oz, lb, metric_ton, short_ton, or hundredweight.

Headers

  • X-Api-Key  required

    API Key associated with your account.

Response

A JSON object with the following fields or an error if the request is unsuccessful.

  • price

    The current gold futures price (in USD per troy ounce by default; see the currency and unitparameters).

  • unit

    The quote unit (troy_ounce by default; changes when the unit parameter is used).

  • currency_unit

    The price currency (USD by default; changes when the currency parameter is used).

  • timestamp

    The 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/goldprice

Headers

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

Sample Response

JSON
{
    price:2310.1,
    unit:"troy_ounce",
    currency_unit:"USD",
    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

A JSON object with the following fields or an error if the request is unsuccessful.

  • 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 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=1h

Headers

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

Historical Price Sample Response

JSON
[
    {
      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
    },
    "..."
]

Frequently Asked Questions

  • 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.
  • Sign up for a free account to instantly get your API key, then pass it in the X-Api-Key header on every request. The documentation above includes ready-to-run examples in cURL, Python, JavaScript, Node.js, and more.
  • 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.
  • 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.
  • The Gold Price API has two endpoints: /v1/goldprice returns the current gold futures price in USD, and /v1/goldpricehistorical returns historical gold futures prices in OHLCV format. For other commodities, see the Commodity Price API.
  • 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.
  • Call /v1/goldpricehistorical with the optional period parameter (valid values 1m, 5m, 15m, 30m, 1h, 4h, 1d; default 1h) plus start and end Unix timestamps; if omitted, start defaults to 24 hours ago and end to the current time. You can try it live after you register.
  • Each data point returns open, high, low, and close prices in USD, along with volume and a time Unix timestamp, ordered most recent first; a failed request instead returns an error.