Gold Price API (XAU): Live USD Rate from JSON
A gold price API is a REST endpoint that returns the spot rate for gold as JSON. On Metals-API the ISO 4217 metal code is XAU (one troy ounce of gold). Call GET /api/latest with base=USD and symbols=XAU: rates.XAU is ounces per 1 USD; rates.USDXAU is already USD per ounce.
Do not mix that with the homepage ticker. The widget’s LBMA Gold Pm symbol is USDLBXAUPM (16 Sep 2026 it printed 4296.1500). That is a London Bullion Market Association PM fix, not the ISO XAU field below. Docs: metals-api.com/documentation. Copper Monthly starts at $19.99/mo (2,500 calls, 10-minute updates, 10 symbols per request).
Request: latest gold (XAU) in USD
curl "https://metals-api.com/api/latest?access_key=YOUR_KEY&base=USD&symbols=XAU,XAG,XPD"
Query params from the docs: access_key (required), base (optional, default USD), symbols (required, comma-separated). Optional unit: Pound, Ounce, Troy Ounce, Gram, KG, Ton. Update cadence is 60 minutes, 10 minutes, or 60 seconds depending on the plan. LBMA fields, when you request them, are the previous day’s close — not a live tick.
Response: XAU plus USDXAU
Envelope from the official Latest Rates docs (sample date 2018-09-10 — copy the curl with your key for today’s rate). Trailing commas from the doc page are removed so this is valid JSON:
{
"success": true,
"timestamp": 1519296206,
"base": "USD",
"date": "2018-09-10",
"rates": {
"USD": 1,
"XAG": 0.041405839732253,
"XAU": 0.0004831705,
"XPD": 0.00084781687155574,
"USDXAG": 24.151182694673185,
"USDXAU": 2069.6627794950227,
"USDXPD": 1179.5000000000057
}
}
timestamp is UNIX time of the quote. To display “gold in USD”, prefer rates.USDXAU (~2069.66 in this sample). The FAQ invert matches: 1 / 0.0004831705 ≈ 2069.66. Same rule the docs give with a rounded example: 1 / 0.00049817281835633 = 2007.33 USD per ounce.
Request: historical gold by calendar date
Most currency/metal history on this endpoint starts in 2019. LBMA gold history goes back to 1968 (silver 2010; palladium and platinum 1990) on the dedicated LBMA historical endpoint. Dated URL — this is the docs example:
curl "https://metals-api.com/api/2013-12-24?access_key=YOUR_KEY&base=EUR&symbols=XAU,XAG,XPD"
The path is /api/YYYY-MM-DD. The JSON adds "historical": true and a date field. EOD prints become available at 00:05 GMT for the previous day. Time-series end_date cannot be today — use a prior day, and use /api/latest for the last print.
Go live with XAU
1. Register and pick a monthly plan (Copper Monthly is $19.99).
2. Confirm XAU vs LBMA symbols on the symbols page.
3. Call https://metals-api.com/api/latest?access_key=YOUR_KEY&base=USD&symbols=XAU
4. Render rates.USDXAU. Cache to the plan interval (10 minutes on Copper Monthly) so a dashboard refresh does not burn the 2,500 calls.
Support: [email protected], Monday–Friday 7am–4pm EST.
FAQ: gold price API (XAU)
What is XAU?
XAU is the ISO 4217 code for one troy ounce of gold. Metals-API also exposes LBMA AM/PM gold as USDLBXAUAM / USDLBXAUPM and India city gold on a dedicated endpoint. Use the symbol you actually need.
How do I get the gold price in USD from the JSON?
Read rates.USDXAU when base=USD. If you only have rates.XAU, invert: usd_per_ounce = 1 / rates.XAU.
Is the docs sample today’s gold price?
No. The Latest Rates sample is dated 2018-09-10 with USDXAU ≈ 2069.66. Live LBMA PM on the homepage (16 Sep 2026) was a different symbol and a different number. Always hit /api/latest with your key.
Copper Monthly vs Gold Monthly?
Copper Monthly is $19.99/mo, 2,500 calls, 10-minute updates. Gold Monthly is $149.99/mo (higher quota and 60-second updates on the Gold tier). Both can request XAU — the difference is volume and freshness, not the metal code.