Gold Data API
Live gold spot, daily history and central-bank reserves as clean JSON, in 30+ currencies, plus silver, Bitcoin-vs-gold and market stats in the same response. Free to use, no API key, no rate limits for reasonable use.
?currency=?unit=, all in one request.Make your first request
curl https://xaus.com/api/v1/spot # With currency conversion curl "https://xaus.com/api/v1/spot?currency=EUR" # Price per gram in GBP curl "https://xaus.com/api/v1/spot?currency=GBP&unit=gram"
// Fetch live XAU spot price const res = await fetch('https://xaus.com/api/v1/spot'); const data = await res.json(); console.log(data.spot_usd_oz); // e.g. 3330.42 console.log(data.xau.price); // price in requested currency + unit // With options const res2 = await fetch( 'https://xaus.com/api/v1/spot?currency=EUR&unit=gram' ); const eurGram = await res2.json(); console.log(eurGram.xau.price); // EUR per gram
import requests # Basic request r = requests.get("https://xaus.com/api/v1/spot") data = r.json() print(data["spot_usd_oz"]) # 3330.42 print(data["per_gram_usd"]) # 107.0601 # Price per kg in JPY r2 = requests.get( "https://xaus.com/api/v1/spot", params={"currency": "JPY", "unit": "kg"} ) print(r2.json()["xau"]["price"]) # JPY per kg
<?php $response = file_get_contents( 'https://xaus.com/api/v1/spot?currency=EUR' ); $data = json_decode($response, true); echo $data['spot_usd_oz']; // 3330.42 echo $data['xau']['price']; // EUR/oz
Interactive explorer
Runs against the real API from your browser, no key, no setup. The response below is live.
Loading live response…
Example response
{
"xau": {
"price": 4007.20, // price in requested currency + unit
"currency": "USD",
"unit": "troy_oz"
},
"spot_usd_oz": 4007.20, // always USD/oz regardless of params
"per_gram_usd": 128.8344,
"per_kg_usd": 128834.37,
"silver_usd_oz": 48.27, // XAG/USD spot
"gold_silver_ratio": 83.02,
"xaut_gold_ratio": 1.0018, // tokenized gold vs spot (>1 = premium)
"paxg_gold_ratio": 0.9994,
"btc_usd": 104300,
"btc_gold_oz": 26.03, // oz of gold per 1 BTC
"gold_market_cap_usd": 28330000000000,
"gold_supply_tonnes": 219890,
"fx_rate": 1, // FX rate used (USD→requested currency)
"updated_at": "2026-07-02T09:00:00.000Z",
"source": "xaus.com",
"docs": "https://xaus.com/api"
// + tokenized-gold prices, BTC-vs-gold aggregates, central-bank
// reserve stats & full fx_rates table, see field reference below
}
| Field | Type | Description |
|---|---|---|
| xau.price | number | Gold price in the requested currency and unit |
| xau.currency | string | ISO 4217 currency code |
| xau.unit | string | Weight unit: troy_oz · gram · kg |
| spot_usd_oz | number | Raw XAU/USD spot price per troy ounce, always present regardless of params |
| per_gram_usd | number | Spot price per gram in USD |
| per_kg_usd | number | Spot price per kilogram in USD |
| fx_rate | number | FX rate applied (USD → requested currency) |
| fx_rates | object | Full table of live FX rates vs USD |
| silver_usd_oz | number | XAG/USD silver spot price per troy ounce |
| gold_silver_ratio | number | Gold price ÷ silver price (oz of silver per oz of gold) |
| xaut_usd / paxg_usd | number | Tether Gold (XAUT) and Pax Gold (PAXG) token prices in USD |
| xaut_gold_ratio / paxg_gold_ratio | number | Token price ÷ gold spot, above 1.0 = premium to physical gold |
| btc_usd | number | Bitcoin price in USD |
| btc_gold_oz / btc_gold_kg | number | Gold (troy oz / kg) that one Bitcoin buys at spot |
| btc_market_cap_usd | number | Bitcoin market capitalization in USD |
| gold_market_cap_usd | number | Gold market cap: spot × total above-ground ounces |
| btc_vs_gold_mcap_pct | number | Bitcoin market cap as % of gold market cap |
| bitcoin_gold_parity_usd | number | BTC price at which Bitcoin's market cap would equal gold's |
| gold_supply_tonnes | number | Total above-ground gold stock, tonnes (WGC, updated annually) |
| annual_production_tonnes | number | Annual gold mine production, tonnes (WGC) |
| underground_reserves_tonnes | number | Estimated mineable underground reserves, tonnes (USGS) |
| cb_reserves_tonnes | number | Total central-bank / official gold reserves, tonnes |
| cb_top_holder_usa_tonnes | number | Largest official holder (United States), tonnes |
| cb_net_purchases_tonnes | number | Latest full-year net central-bank purchases, tonnes |
| cb_reserves_pct_supply / cb_share_global_reserves_pct | number | Official reserves as % of above-ground supply / of global allocated FX reserves |
| price_source / fx_source / silver_source / token_source | string | Upstream source attribution per data group |
| data_state | object | Canonical state of the core gold price: { status: "fresh"|"stale"|"unavailable", as_of, source: "upstream"|"cache", age_seconds }. Present on every response including 503. |
| stale | boolean | True when serving the last known real price during an upstream outage, prices are never simulated |
| price_as_of | string | When the gold price was sourced (ISO 8601); differs from updated_at only when stale |
| fx_stale | boolean | True when FX comes from the static fallback table instead of the live feed |
| stats_as_of | string | Vintage date of the annual supply / reserve statistics |
| updated_at | string | ISO 8601 timestamp of the response |
Query parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
| currency | string | USD | ISO 4217 currency code to convert the XAU price into. See supported currencies below. |
| unit | string | oz | Weight unit for xau.price. One of: oz · gram · kg |
History & reserves
GET /api/v1/history, up to 5 years of daily XAU/USD candles plus computed statistics. Cached 6 hours.
{
"symbol": "XAUUSD",
"interval": "daily",
"points": [ { "d": "2026-07-01", "c": 4007.20, "h": 4021.10, "l": 3988.60 }, … ],
"high_52w": 4381.50,
"low_52w": 3312.40,
"ranges": { // true high/low per trailing window
"day": { "low": 3988.60, "high": 4021.10 },
"week": { … }, "month": { … }, "year": { … }
},
"return_ytd_pct": 12.4, // vs last close of previous year
"return_1y_pct": 35.3 // vs close ~365 days ago
}
GET /api/v1/reserves, central-bank gold holdings by country (119 countries), as shown on the reserves page.
GET /api/v1/intraday, XAUS's own recorded price series: the live gold-api quote sampled every 2 minutes by our infrastructure (gold and silver). Params: ?symbol=xau|xag, ?hours=1..48 (default 24). Returns points of {t, p} with a data_state block and coverage_seconds so consumers can judge series warmth. Retention: 14 days.
Error responses
All errors return JSON with an error field. There is currently no hard rate limit, see fair use below.
| Status | When | Example |
|---|---|---|
| 400 | Unsupported currency, response includes the full supported list | {"error":"Unsupported currency: XYZ","supported":["USD","EUR",…]} |
| 400 | Unsupported unit | {"error":"Unsupported unit: lb. Valid values: oz, gram, kg"} |
| 405 | Any method other than GET / OPTIONS | {"error":"Method not allowed"} |
| 503 | Upstream price source down with no cached price yet, retry shortly. If a recent real price exists, the API returns 200 with stale: true instead (never an invented price). | {"error":"Upstream price source unreachable…"} |
Data states & provenance
Every data group in the response is in exactly one of three states, always machine-detectable:
| State | Meaning | How to detect |
|---|---|---|
| fresh | Value sourced from the live upstream on this request (or within its cache TTL) | data_state.status: "fresh" · FX: fx_stale: false · group *_source names the upstream |
| stale | Last known real value served during an upstream outage, never invented | data_state.status: "stale" with as_of + age_seconds · FX: fx_stale: true |
| unavailable | No real value exists to serve | Group fields null + source "unavailable"; core gold price → HTTP 503 whose body carries data_state.status: "unavailable" |
The single canonical read is the data_state object, { status, as_of, source, age_seconds }, describing the core gold price on every response, including 503s. The flat stale and price_as_of fields are retained for backward compatibility.
AI agents & automated consumers
data_state describes freshness at the moment the response was generated. If your requests pass through a caching layer you do not control (AI assistant fetchers, corporate proxies, scraper infrastructure), you can receive an old copy that still reads status: "fresh", age_seconds: 0, because it was fresh when built. Two rules make any integration stale-proof:
1. Validate updated_at yourself. Every response carries a generation timestamp. Compare it to the current time; treat anything older than a few minutes (spot, intraday) or a day (history, reserves) as a cached copy, not a live reading.
Machine-readable resources: /api/openapi.json (OpenAPI 3.1 contract for all endpoints, importable into agent frameworks and API tooling) and /llms.txt (plain-text site and API map for AI crawlers). On /api/v1/spot, pass ?compact=1 to omit the ~160-entry FX table: the response shrinks by roughly 75%, which matters when an AI agent pays per token.
2. Cache-bust when freshness is critical. Append a throwaway unique query parameter, e.g. /api/v1/spot?fresh=1720000000 (any name, any changing value). Endpoints ignore unknown parameters, but caches key on the full URL, so a unique value bypasses every intermediary layer. Use this for freshness-critical calls only; default requests should let the CDN work.
Provenance. Each data group carries its own source attribution in the payload:
| Data group | Payload attribution | Cadence |
|---|---|---|
| Gold spot | price_source · price_as_of | Continuous, cached 30 s |
| Silver spot | silver_source | Continuous, per request |
| FX rates | fx_source · fx_stale | Cached 12 h; static table fallback flagged fx_stale: true |
| Crypto & tokenized gold | token_source | Cached 60 s |
| Supply & reserve statistics | stats_as_of | Annual (WGC / USGS figures); vintage date in payload |
Operational behaviour
| Property | Value |
|---|---|
| Debug mode | ?debug=1 appends a debug object: server uptime and per-cache ages in seconds (price_age_s, fx_cache_age_s, token_cache_age_s). Read-only; no secrets. |
| Update frequency | Spot: continuous upstream, cached 30 s (browser) / 30 s (CDN). History: cached 6 h. |
| Timestamps | ISO 8601, UTC. updated_at = response time; price_as_of = when the price was sourced (differs only when stale). |
| Precision | 2 decimals for oz prices, 4 for gram, 2 for kg. Ratios: 2–4 decimals as documented per field. |
| Staleness | stale: true appears when serving the last known real price during an upstream outage. Prices are never simulated. |
| CORS | Fully open (Access-Control-Allow-Origin: *), callable from browser JavaScript. |
| Compression | gzip / brotli via CDN content negotiation. |
| Versioning | Versioned path (/v1/). Changes within v1 are additive only, new fields may appear; existing fields are never renamed or removed. Breaking changes get a new version path and a changelog entry. |
| OpenAPI | openapi.json, OpenAPI 3.1, suitable for client generation. |
One feed, every channel
This API is the engine behind every XAUS surface, use it directly, or ship the same data through the channels below.
API changelog
| Version | Date | Changes |
|---|---|---|
| Platform | 2026-07 | Launched: Gold data widgets, embeddable live price, historical chart and converter modules at /widgets/price, /widgets/chart and /widgets/converter (dark/light themes, multi-currency), powered by this API. See /widgets/. |
| v1.5 | 2026-07 | Added: AI-consumer optimizations: ?compact=1 on /spot (omits the FX table), /api/openapi.json machine-readable spec, /llms.txt AI-crawler map, /api/v1/intraday first-party recorded series, and documented freshness-validation rules for automated consumers. |
| v1.4 | 2026-07 | Added: canonical data_state object (status / as_of / source / age_seconds) on every response including 503; removes any need to infer state from multiple fields. stale and price_as_of retained for backward compatibility. |
| v1.3 | 2026-07 | Added: formal data-state contract (fresh / stale / unavailable); fx_stale flag; stats_as_of vintage for annual statistics; ?debug=1 observability mode. No breaking changes. |
| v1.2 | 2026-07 | Changed: outage behaviour, the API now serves the last known real price with stale: true and price_as_of, or an honest 503; simulated fallback prices removed. Added: stale, price_as_of fields. |
| v1.1 | 2026-07 | Added: silver spot & gold/silver ratio; tokenized-gold prices & ratios (XAUT, PAXG); Bitcoin-vs-gold fields; gold market cap, supply & central-bank reserve stats. History: daily high/low per point, ranges, YTD & 1-year returns; price history source migrated to Yahoo Finance. |
| v1.0 | 2025 | Initial release, live XAU spot with currency & unit conversion, daily history, central-bank reserves. |
Rate limits & fair use
CORS is fully open, you can call this API directly from browser JavaScript. Prices are indicative mid-market rates, not tradable quotes. For settlement-grade rates refer to the LBMA benchmark.