GoldAPI.io Alternative for Real-Time Gold and Silver Prices
Symbol: Gold price API
You need dependable, real-time gold (XAU) and silver (XAG) prices you can drop into a pricing engine, trading signal, or chart. In this guide, you’ll pull live XAU/XAG from Metals-API, compute USD-per-ounce for display, and backfill a short time series—so you can replace or compare an existing GoldAPI.io integration without breaking production.
What you can build quickly with Metals-API (XAU/XAG focus)
Metals-API delivers live and historical precious metals rates via simple JSON endpoints. For gold and silver use cases, three endpoints cover most needs:
- Latest Rates: fetch the current XAU and XAG ticks you can display or store.
- Time-series: backfill daily XAU/XAG for charts and model inputs.
- Bid/Ask: access the spread when you need executable-style pricing or to calibrate slippage.
Metals-API rates are by default relative to USD and quoted per troy ounce. Symbols: XAU for gold and XAG for silver. Confirm symbols anytime at the Symbols page.
Metals-API vs GoldAPI.io: using the right tool for XAU/XAG
GoldAPI.io is a known provider for gold and silver quotes. If you are evaluating an alternative, here’s how Metals-API typically fits XAU/XAG workflows:
- Coverage that includes real-time, historical, and time-series endpoints you can query consistently for gold and silver.
- Update cadence tuned by plan (e.g., intraday refresh), with a JSON schema that surfaces timestamps, base currency, and units per troy ounce for predictable math.
- Support for bid/ask, OHLC, and LME/LBMA-aligned data structures where relevant to downstream analytics and reconciliation flows.
When specifics like plan tiers, update intervals, and symbol availability determine your choice, compare the two services on your actual workload: number of symbols (XAU, XAG), intraday frequency you need, history window, and whether you require bid/ask or OHLC. You’ll find Metals-API endpoints and parameters straightforward to automate for both real-time dashboards and backtests. See the Documentation for full endpoint details.
How Metals-API expresses gold and silver prices
Metals-API responses default to base USD and quote rates as metal per USD, per troy ounce. That is:
- rates.XAU means ounces of gold per 1 USD.
- To get the more familiar USD per ounce price, invert it: USDXAU ≈ 1 / rates.XAU.
Some responses also include convenience fields like USDXAU (USD per XAU) alongside base USD. Always check the unit field; for XAU and XAG the unit is per troy ounce. 1 troy ounce = 31.1034768 grams. If you price in grams, convert after you compute the USD-per-ounce figure.
Live XAU/XAG in one request
Use the Latest Rates endpoint to retrieve live gold and silver. The example below filters to XAU and XAG. Replace YOUR_API_KEY with your key.
curl -s "https://metals-api.com/api/latest?access_key=YOUR_API_KEY&symbols=XAU,XAG"
Here is an official sample JSON response from Metals-API for latest rates (base USD):
{"success":true,"timestamp":1795039740,"date":"2026-11-18","base":"USD","rates":{"XAU":0.00026852125345721,"USD":1,"USDXAU":3724.100000000016}}
What you will use from this payload:
- timestamp: Unix time for this tick. Store it to align charts and cache results.
- date: Trading date for the data point (ISO format).
- base: USD means rates are expressed relative to 1 USD.
- rates.XAU: ounces of gold per USD. Invert to get USD per ounce if USDXAU is not already present.
- rates.USDXAU: USD per troy ounce for gold (a convenience field you can use directly).
Parse and display USD per ounce in Python
import requests
from datetime import datetime
API_URL = "https://metals-api.com/api/latest"
params = {
"access_key": "YOUR_API_KEY",
"symbols": "XAU,XAG" # add XAG for silver alongside gold
}
r = requests.get(API_URL, params=params, timeout=10)
r.raise_for_status()
data = r.json()
if not data.get("success", False):
raise SystemExit(f"API error: {data}")
ts = data.get("timestamp")
as_of = datetime.utcfromtimestamp(ts).isoformat() + "Z" if ts else data.get("date")
rates = data.get("rates", {})
# Gold: use USDXAU if present, else invert XAU
gold_usd_per_oz = rates.get("USDXAU") or (1.0 / rates["XAU"] if "XAU" in rates and rates["XAU"] else None)
# Silver: may not include USDXAG, so invert XAG when available
silver_usd_per_oz = rates.get("USDXAG") or (1.0 / rates["XAG"] if "XAG" in rates and rates["XAG"] else None)
print(f"As of {as_of}")
print(f"Gold (XAU): {gold_usd_per_oz:.2f} USD/oz" if gold_usd_per_oz else "Gold: n/a")
print(f"Silver (XAG): {silver_usd_per_oz:.4f} USD/oz" if silver_usd_per_oz else "Silver: n/a")
# Optional: convert to grams
TROY_OUNCE_IN_GRAMS = 31.1034768
if gold_usd_per_oz:
print(f"Gold (XAU): {gold_usd_per_oz / TROY_OUNCE_IN_GRAMS:.2f} USD/gram")
if silver_usd_per_oz:
print(f"Silver (XAG): {silver_usd_per_oz / TROY_OUNCE_IN_GRAMS:.4f} USD/gram")
Notes:
- If USDXAU (or USDXAG) is present, prefer it. Otherwise invert XAU or XAG.
- Use UTC for all timestamps you store; the timestamp field is Unix seconds.
- Cache the full JSON payload keyed by timestamp to avoid unnecessary re-fetches within the same bar.
Backfill XAU/XAG charts with the Time-series endpoint
For line charts, return attribution, or model feature engineering, the Time-series endpoint retrieves daily XAU/XAG between two dates. This is ideal when migrating from GoldAPI.io to Metals-API and you need continuity in your historical panels.
{
"success": true,
"timeseries": true,
"start_date": "2026-11-11",
"end_date": "2026-11-18",
"base": "USD",
"rates": {
"2026-11-11": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915
},
"2026-11-13": {
"XAU": 0.000483,
"XAG": 0.0382,
"XPT": 0.000913
},
"2026-11-18": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912
}
},
"unit": "per troy ounce"
}
How to use it:
- Iterate dates in rates and, for each day, invert XAU and XAG to chart USD/oz.
- If your front end stores ms since epoch, parse the date keys and convert to UTC epoch milliseconds.
- Handle weekends/holidays: not all dates will appear. Do not forward-fill silently unless your UI clearly indicates non-trading days.
See endpoint parameters and limits in the Documentation.
Get executable-style color with Bid/Ask
If your workflow needs spread-aware logic (e.g., best-effort execution estimates or alert confirmation), fetch bid/ask for XAU and XAG.
{
"success": true,
"timestamp": 1795039823,
"base": "USD",
"date": "2026-11-18",
"rates": {
"XAU": {
"bid": 0.000481,
"ask": 0.000483,
"spread": 2.0e-6
},
"XAG": {
"bid": 0.0381,
"ask": 0.0382,
"spread": 0.0001
},
"XPT": {
"bid": 0.000911,
"ask": 0.000913,
"spread": 2.0e-6
}
},
"unit": "per troy ounce"
}
Interpretation tips:
- bid/ask are still quoted as metal per USD when base is USD. For USD per ounce, invert bid and ask separately: USD/oz bid ≈ 1/ask (conservative), USD/oz ask ≈ 1/bid.
- Use the spread to set alert thresholds or throttle re-pricing in e-commerce to reduce churn.
Operational notes that save time in production
- Units: Metals are per troy ounce. Convert with 1 troy ounce = 31.1034768 grams, 32.1507466 troy ounces per kilogram.
- Base currency: Default base is USD. If you convert to other currencies, do the currency conversion after computing the USD/oz price, or use the Convert endpoint. Refer to the Documentation for conversion examples.
- Timestamps: Use timestamp for storage and reconciliation; the date field is useful for human-readable labeling. Treat timestamp as Unix seconds.
- Caching and polling: Depending on your plan, latest updates arrive on a defined cadence (e.g., intraday minutes). Cache by timestamp and avoid polling faster than the update cadence.
- Weekends and holidays: Expect gaps in precious metals trading around market closures. Don’t assume continuous daily bars.
- Normalization: If you’re migrating from GoldAPI.io and used USD-per-ounce directly, prefer USDXAU/USDXAG if present; otherwise standardize by inverting rates.XAU and rates.XAG across your historical store.
LBMA and LME alignment, OHLC, and research
Many reconciliation and reporting workflows rely on benchmark-aligned data. Metals-API exposes structures that fit those needs, such as daily OHLC and a Historical LME endpoint for relevant symbols. When working with XAU and XAG specifically, daily OHLC can help your analysts compute volatility, drawdowns, and discrete event reactions in a way that’s consistent with desk conventions.
{
"success": true,
"timestamp": 1795039823,
"base": "USD",
"date": "2026-11-18",
"rates": {
"XAU": {
"open": 0.000485,
"high": 0.000487,
"low": 0.000481,
"close": 0.000482
},
"XAG": {
"open": 0.03825,
"high": 0.0383,
"low": 0.0381,
"close": 0.03815
},
"XPT": {
"open": 0.000915,
"high": 0.000918,
"low": 0.00091,
"close": 0.000912
}
},
"unit": "per troy ounce"
}
If you operate in an environment that must reference LBMA/LME methodology or specific symbol families, review the endpoint lineup and symbol catalog first: start with Symbols, then go deeper in the Documentation. For market consolidation and methodology resources, also see MCP.
Pricing gold and silver inside your stack
XAU/XAG often sit at the junction of trading, treasury, and commerce. Below are practical integration patterns we see teams implement with Metals-API data:
- Real-time product pricing: poll Latest Rates on your plan cadence, compute USD/oz and local currency equivalents, then apply margins and taxes. Use thresholding based on Bid/Ask spread to suppress trivial price changes.
- Trading and risk: ingest Latest and OHLC into your models; compute rolling volatility and Sharpe on inverted USD-per-oz series; align timestamps to UTC and store both the raw metal-per-USD and the inverted USD-per-oz series for auditability.
- ERP and procurement: backfill Time-series for period-end valuation and reconcile with internal positions; store the timestamped JSON plus normalized bars for reporting.
- Alerts: trigger on percentage moves in inverted prices (e.g., compute returns from time-series XAU, XAG) and include bid/ask-aware thresholds to reduce noise.
From live price to insight: analytics on XAU
Gold is not just a spot price; it’s often a macro signal. Treat Metals-API data as a substrate for analytics:
- Innovation in price discovery: combine Bid/Ask and OHLC to quantify intraday liquidity and slippage risk for gold.
- Technology integration: push normalized USD-per-oz series into your feature store; compute rolling z-scores and cointegration with related assets.
- Digital asset solutions: build tokenized gold NAVs using USDXAU where available, with deterministic conversion to grams or kilograms for custody statements.
- Market insights: leverage Time-series for event studies and attribution. Keep raw and inverted series side by side to avoid double inversions in downstream models.
When you need to validate symbol coverage or fine-tune parameters around update frequency, refer to the Documentation and confirm XAU/XAG specifics under Symbols.
Practical checklist for a clean cutover from GoldAPI.io
- Schema mapping: create a mapping layer that inverts XAU and XAG when necessary to preserve USD/oz expectations in your UI and reports.
- Timestamps: standardize on UTC, store the Metals-API timestamp and date; during cutover keep both providers side-by-side for a short window for reconciliation.
- Cache strategy: dedupe requests on the Metals-API timestamp and your plan’s update cadence. Keep a small local cache keyed by symbols and date.
- Backfill: fetch Time-series for at least the comparison window you’ll display to users. Normalize units to troy ounces across your entire historical store.
- Spread sensitivity: if you previously ignored spread, evaluate Bid/Ask and pick a policy (mid, bid, ask, or conservative inversion) for alerts and indicative pricing.
FAQ
What symbols should I request for gold and silver?
Use XAU for gold and XAG for silver. Confirm exact codes on the Symbols page.
Why does rates.XAU look so small?
The base is USD, and rates.XAU is ounces per USD. Invert it to get USD per ounce (or use USDXAU when present). Apply the same logic to XAG/USDXAG.
How often should I poll for latest prices?
Match your polling to your plan’s update cadence and cache by timestamp. Polling faster than the update window increases load without fresher data.
How do I handle weekends and holidays?
Expect gaps in Time-series and Historical endpoints around non-trading days. Do not forward-fill unless your UI labels the synthetic bar clearly.
Can I price in grams or kilograms?
Yes. Compute USD/oz first, then divide by 31.1034768 for USD/gram or multiply by 32.1507466 for USD/kg.
Get your key and ship it
Spin up your XAU/XAG integration in minutes: review the endpoint parameters in the Documentation, verify codes on Symbols, and create your credentials here: Register. For methodology context and market consolidation references, see MCP.