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: the live gold spot price (XAU/USD) with bid and ask, and the COMEX gold futures price and contract, in USD or any other currency, per troy ounce, gram, or kilogram.

Available endpoints:

For silver, platinum, palladium, and copper, see the Metals Price API; for other commodity prices, please check out our Commodity Price API.

Premium members get the live price; free users get the last completed daily settlement.

Online
(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

3 endpoints

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

Returns the current gold futures price in USD. Premium members get the live price; free users get the last completed daily settlement. For the gold spot price, see /v1/goldspot; for historical gold futures prices, see /v1/goldpricehistorical.

Parameters

  • currency  optional

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

  • unit  optional

    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

The /v1/goldprice endpoint returns 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).

  • updated

    The timestamp at which the gold futures price was last updated, in Unix format (in seconds).

  • futures_contract

    The COMEX contract price is quoted for (e.g. GCZ26, December 2026).

  • futures_contract_month

    The contract's delivery month (YYYY-MM).

Live Demo

Live demo · no API key required
Query parameters

Get a free API key to get started — no credit card required.

Headers
X-Api-KeyLog in or sign up to get your API key
GET
https://api.api-ninjas.com/v1/goldprice
Sample response
{
"price": 4305.6,
"unit": "troy_ounce",
"currency_unit": "USD",
"updated": 1786044078,
"futures_contract": "GCZ26",
"futures_contract_month": "2026-12"
}

Code Examples

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.

Premium only

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

Returns the gold spot price (XAU/USD), the price of gold for immediate delivery, with bid and ask. Gold futures normally trade slightly above spot; for the futures price, see /v1/goldprice.

Update frequency: every minute on Developer plans and about every 10 seconds on Business plans and above.

Parameters

  • currency  optional

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

  • unit  optional

    Target unit: 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

The /v1/goldspot endpoint returns a JSON object with the following fields, or an error if the request is unsuccessful.

  • price

    The gold spot price (XAU/USD), in USD per troy ounce by default.

  • bid

    The spot bid price.

  • ask

    The spot ask price.

  • spot_type

    How the spot price is produced: composite (a live spot price).

  • previous_close

    The previous session's closing spot price.

  • change_24h

    The change versus the previous close.

  • change_24h_percent

    The percent change versus the previous close.

  • high_24h

    The session's high price.

  • low_24h

    The session's low price.

  • market_status

    open or closed. Gold trades from Sunday 6 PM to Friday 5 PM ET, with a daily break from 5 to 6 PM ET.

  • updated

    The Unix timestamp (in seconds) of the spot price.

  • unit

    The quote unit (changes when the unit parameter is used).

  • currency_unit

    The price currency (USD by default).

Live Demo

Live demo
Query parameters
unit
currency

Get a free API key to get started — no credit card required.

Headers
X-Api-KeyLog in or sign up to get your API key
GET
https://api.api-ninjas.com/v1/goldspot
Sample response
{
"price": 4278.35,
"bid": 4278.1,
"ask": 4278.6,
"spot_type": "composite",
"previous_close": 4261.9,
"change_24h": 16.45,
"change_24h_percent": 0.386,
"high_24h": 4284,
"low_24h": 4255.2,
"market_status": "open",
"updated": 1786044080,
"unit": "troy_ounce",
"currency_unit": "USD"
}

Code Examples

curl -X GET "https://api.api-ninjas.com/v1/goldspot" \ -H "X-Api-Key: YOUR_API_KEY"

Premium 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

The /v1/goldpricehistorical endpoint returns a JSON array of objects, each 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).

Live Demo

Live demo
Query parameters
period
start
end

Get a free API key to get started — no credit card required.

Headers
X-Api-KeyLog in or sign up to get your API key
GET
https://api.api-ninjas.com/v1/goldpricehistorical?period=1h
Sample response
[
{
"open": 4302.1,
"low": 4301.8,
"high": 4309.7,
"close": 4306.2,
"volume": 898,
"time": 1786028400
},
{
"open": 4306,
"low": 4299.5,
"high": 4308,
"close": 4302,
"volume": 2215,
"time": 1786024800
},
"..."
]

Code Examples

curl -X GET "https://api.api-ninjas.com/v1/goldpricehistorical?period=1h" \ -H "X-Api-Key: YOUR_API_KEY"

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 three endpoints: /v1/goldprice returns the current gold futures price in USD and the contract it is quoted for, /v1/goldspot returns the gold spot price (XAU/USD, with bid and ask; premium plans only), and /v1/goldpricehistorical returns historical gold futures prices in OHLCV format. For silver, platinum, palladium, and copper, see the Metals Price API; for other commodities, see the Commodity Price API.
  • /v1/goldprice returns the COMEX gold futures price for the contract named in futures_contract (e.g. GCZ26, December 2026). /v1/goldspot returns the price of gold for immediate delivery (XAU/USD), with bid and ask; futures normally trade slightly above spot. Both accept currency and unit, for example gold per gram in EUR.
  • Premium members get live gold futures prices from /v1/goldprice and live spot prices from /v1/goldspot (refreshed every minute on Developer plans and about every 10 seconds on Business plans and above). Free users receive the last completed daily futures settlement from /v1/goldprice; /v1/goldspot is premium only. The updated field always carries the timestamp of the price itself, so you can tell exactly which session a quote belongs to. See the pricing page for the plans that unlock live prices.
  • 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.