XAU
---.--
--.--
XAG
---.--
--.--
XPT
---.--
--.--
XPD
---.--
--.--
HG
---.--
--.--
ALI
---.--
--.--
NI
---.--
--.--
ZN
---.--
--.--
PB
---.--
--.--
SN
---.--
--.--
JBP
---.--
--.--
LC
---.--
--.--
UXA
---.--
--.--
XAU
---.--
--.--
XAG
---.--
--.--
XPT
---.--
--.--
XPD
---.--
--.--
HG
---.--
--.--
ALI
---.--
--.--
NI
---.--
--.--
ZN
---.--
--.--
PB
---.--
--.--
SN
---.--
--.--
JBP
---.--
--.--
LC
---.--
--.--
UXA
---.--
--.--

Gold Price API

A REST API for live and historical gold prices, quoted in US dollars per troy ounce. Spot updates continuously, and the history endpoint returns 14,425 daily bars going back to October 1966. JSON over HTTPS, authenticated with a bearer token, no SDK required.

Get the live gold price

curl -H "Authorization: Bearer mc_live_YOUR_KEY" \
  "https://api.metalcharts.org/v1/prices"

Every tracked metal comes back in one response, so a dashboard showing several does not need several requests. The gold entry looks like this:

{
  "success": true,
  "data": {
    "XAU": {
      "symbol": "XAU",
      "price": 4380.04,
      "change24h": 2.87,
      "changePercent24h": 0.0655,
      "high24h": 4380.25,
      "low24h": 4377.84,
      "exchange": "SPOT",
      "timestamp": "2026-09-19T18:58:27.856Z"
    }
  }
}

Spot prices are on the free tier. You need an account and a key, but not a card.

Code examples

Each example fetches the live gold price and prints it. There is no SDK to install: the API is plain HTTPS returning JSON, so whatever HTTP client you already use will do.

Gold price in Python

import requests

res = requests.get(
    "https://api.metalcharts.org/v1/prices",
    headers={"Authorization": "Bearer mc_live_YOUR_KEY"},
    timeout=10,
)
res.raise_for_status()

price = res.json()["data"]["XAU"]["price"]
print(f"Gold: ${price}")

Uses requests. raise_for_status turns a 401 or 429 into an exception rather than letting a bad payload through.

Gold price in JavaScript

const res = await fetch(
  "https://api.metalcharts.org/v1/prices",
  { headers: { Authorization: "Bearer mc_live_YOUR_KEY" } },
);

if (!res.ok) throw new Error(`HTTP ${res.status}`);

const { data } = await res.json();
console.log(`Gold: ${data.XAU.price}`);

Native fetch, so it runs in Node 18 and above and in the browser. Never ship a key to the browser; proxy through your own server.

Gold price in PHP

<?php
$ch = curl_init("https://api.metalcharts.org/v1/prices");
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER => ["Authorization: Bearer mc_live_YOUR_KEY"],
    CURLOPT_TIMEOUT => 10,
]);

$body = curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);

if ($code !== 200) {
    throw new RuntimeException("MetalCharts API returned $code");
}

$data = json_decode($body, true);
echo "Gold: " . $data["data"]["XAU"]["price"];

Plain cURL with no dependencies. Checking the status code matters because a failed call still returns a parseable body.

Gold price in Go

req, _ := http.NewRequest(
    http.MethodGet, "https://api.metalcharts.org/v1/prices", nil,
)
req.Header.Set("Authorization", "Bearer mc_live_YOUR_KEY")

resp, err := http.DefaultClient.Do(req)
if err != nil {
    return err
}
defer resp.Body.Close()

var out struct {
    Data map[string]struct {
        Price float64 `json:"price"`
    } `json:"data"`
}
if err := json.NewDecoder(resp.Body).Decode(&out); err != nil {
    return err
}
fmt.Println("Gold:", out.Data["XAU"].Price)

Decoding into a narrow struct rather than a map keeps the compiler honest about the field you actually use.

Replace mc_live_YOUR_KEY with a key from the API console. The free tier needs an account but not a card.

Historical gold prices

curl -H "Authorization: Bearer mc_live_YOUR_KEY" \
  "https://api.metalcharts.org/v1/history/XAU?range=1Y&interval=1d"

14,425 daily bars are available, the oldest dated 1966-10-03. Set the window with range or explicit start and end dates, and the candle size with interval: 15m, 30m, 45m, 1h, 2h, 4h, 8h, 1d, 1w or 1M. Each point carries open, high, low, close and volume, so it drives a candlestick chart directly.

History depth is what separates the plans. Basic reaches back 1 year, Pro five, and Ultimate returns the full series.

The symbol is XAU. Passing the metal's name instead returns a 400, which is the single most common mistake on first use.

Endpoints carrying gold

EndpointReturnsPlan
/v1/pricesLive spot price, bid, ask, 24h change, high and low
Free
/v1/history/{symbol}Daily, weekly and monthly candles, plus 15m to 8h intraday
Basic
/v1/ath/{symbol}All-time high and the date it was set
Basic
/v1/instrumentsWhich symbol each endpoint expects
Free

Gold is the series most people integrate first, and the one where a stale quote is most obvious to an end user. Spot is served from cache and refreshes continuously, so a dashboard polling once a minute sees the same number a trader does.

Beyond price, gold also appears in:

EndpointReturnsPlan
/v1/comex/inventory?symbol=XAUCOMEX registered and eligible warehouse stocks
Pro
/v1/comex/delivery-notices?symbol=XAUDaily delivery notices by firm, with month and year to date totals
Pro
/v1/lbma/vault?metal=goldLBMA London vault holdings
Pro
/v1/sge/benchmark?metal=goldShanghai Gold Exchange benchmark fixings
Pro
/v1/cot?metal=XAUCFTC Commitments of Traders positioning
Pro

Plans

Rate limiting is by weight per minute, not a monthly request quota. Most endpoints cost 1 weight and history costs 2. Free is capped at 1,000 weight a month; no paid plan has a monthly ceiling.

Compare plans

Gold API questions

How far back does the gold price history go?

The API returns 14,425 daily bars starting in October 1966, which is close to sixty years. Basic plans get the most recent five years of that window and Ultimate returns all of it.

Is the gold price spot or futures?

/v1/prices and /v1/history/XAU return spot, quoted in US dollars per troy ounce. COMEX futures settlement is separate, under /v1/futures and /v1/comex, because a futures price and a spot price are different numbers and conflating them causes real errors.

Can I get gold prices in another currency?

Yes. /v1/currency returns live exchange rates on every plan including Free, so you can convert the dollar price yourself and control exactly which rate and timestamp you used.

What symbol do I use for gold?

XAU. Not GOLD, which returns a 400 on /v1/history because that name belongs to the 24/7 markets endpoint instead. Call /v1/instruments?search=gold if you are unsure which symbol a given endpoint wants.

Other metals