Quick guide to get LME Nickel (LME-NI) prices using this API
Gold (XAU) remains one of the most actively monitored assets in global finance, and developers increasingly need precise, real-time access to its pricing to power trading systems, risk dashboards, treasury tools, and analytics pipelines. In this comprehensive guide, we explain how to query Gold (XAU) markets programmatically, how the Metals-API works from authentication to response parsing, and how to incorporate it into resilient, scalable architectures. Along the way, we cover advanced concepts like latency-aware design, data normalization, caching, rate limiting, and security hardening, so you can build production-grade solutions for gold pricing, benchmarking, and analytics. While the focus is on Gold (XAU), we’ll also touch on related metals like LME Nickel (LME-NI) and Nickel (XNI) where useful, as both are supported symbols alongside gold and can provide contextual market insights.
Why developers care about Gold (XAU) data and how Metals-API makes it actionable
Accurate Gold (XAU) pricing underpins portfolio valuation, hedging, pricing of gold-backed products, cross-metal arbitrage, collateral management, and even consumer applications like jewelry pricing by carat. Metals-API brings together real-time and historical metals exchange rates, bid/ask, OHLC, fluctuations, time-series, intraday snapshots, and a carat-based view for gold—exposed through a straightforward, reliable JSON interface. By placing low-latency, normalized data behind a stable set of endpoints, it enables developers to rapidly assemble end-to-end solutions that ingest, analyze, and distribute gold price intelligence.
Gold (XAU) in modern markets: liquidity, venues, and data nuances
Gold trades across spot OTC markets, futures venues, and derivative platforms. Liquidity pools in hubs like London and New York, with price discovery influenced by macroeconomic signals, monetary policy expectations, ETF flows, and physical demand from jewelry and technology. Developers must reconcile slightly different quoting conventions (per troy ounce, per gram, or per kilogram), currency bases (USD or cross-currency), and timestamps (exchange or consolidated). Metals-API normalizes much of this complexity by returning consistent, machine-readable JSON with clear base currency and unit designations, reducing custom data wrangling.
Getting started with Metals-API for Gold (XAU)
Metals-API is a JSON-based service for metals pricing and currency conversion. It provides endpoints for latest rates, historical data, time-series windows, intraday snapshots, fluctuation analysis, bid/ask, OHLC, and even specialized features such as gold-by-carat. You can explore the complete set of capabilities on the Metals-API Website, review request/response formats in the Metals-API Documentation, and confirm symbol coverage on the Metals-API Supported Symbols page. For broader market context, many teams also triangulate with reference sources like the LBMA prices and data, futures markets at CME Group Gold contracts, or economic indicators from the Federal Reserve Economic Data (FRED).
Core concepts: symbols, base currency, units, and timestamps
Before digging into endpoints, align your data model with these conventions:
- Symbol taxonomy: XAU for Gold, XAG for Silver, XPT for Platinum, XPD for Palladium, XCU for Copper, XAL for Aluminum, XNI for Nickel, XZN for Zinc, and so on. LME-specific symbols (like LME-NI for LME Nickel) are also available via specialized endpoints.
- Base currency: By default, Metals-API uses USD as the base currency for exchange rates. You can convert to other currencies using dedicated conversion endpoints.
- Units: Rates typically denote “per troy ounce.” The API explicitly returns the unit in each response so your application can display or convert correctly.
- Timestamps and dates: Responses include epoch timestamps and ISO dates. Always store both where available; timestamps are vital for latency tracking and reconciliation, while dates aid reporting and aggregation.
Authentication, authorization, and API keys
Authentication is handled via an API key passed as an access_key parameter. Treat this key as a secret. Restrict its visibility to server-side contexts, never exposing it in client-side code or public repositories.
- Key placement: Include access_key in the query string for each request. If your stack supports secure parameter handling, encapsulate it server-side and proxy client requests through your backend.
- Rotation: Regularly rotate access keys. Implement a dual-key rotation strategy where both old and new keys coexist temporarily to avoid downtime.
- Storage: Use a secret manager (e.g., environment variables managed by a vault) and limit access via IAM policies aligned with least privilege.
Rate limiting and quota management for production stability
Metals-API plans enforce rate limits and data granularity. Engineering for quotas is essential:
- Batching: Prefer endpoints that return multiple symbols in one call (e.g., latest rates for all metals) rather than many single-symbol calls.
- Caching: Apply layered caching (in-memory + distributed). TTL should reflect your plan’s refresh frequency (e.g., 60 minutes or 10 minutes).
- Backoff: Implement exponential backoff with jitter on 429 or 5xx errors.
- Idempotency: For retries, cache successful responses by timestamp to avoid unnecessary duplicate fetches.
Data validation, sanitization, and schema contracts
Metals-API returns predictable JSON structures, but robust clients still validate types, required fields, and value ranges:
- Schema checking: Validate presence of success, base, date, timestamp (where present), and unit fields.
- Type normalization: Parse numeric fields as decimals where financial precision matters. Avoid binary floating-point for portfolio valuation.
- Outlier detection: If a value deviates beyond configured thresholds compared to last known price or a median of recent points, quarantine it and trigger a secondary data check.
Working with Gold (XAU) using Metals-API: a detailed walk-through
This section integrates every major feature you’ll use to power Gold (XAU) flows—from real-time ticks to time series analytics—while also showing how to pull complementary metals like XNI or LME-NI if you need cross-metal modeling.
Latest rates: real-time Gold (XAU) price retrieval
The latest rates endpoint returns real-time exchange data updated at intervals depending on your plan. Use this for dashboards, price tickers, and immediate quotes. For multi-symbol UIs, fetch a basket including XAU, XAG, XPT, and XNI together to minimize round trips.
Representative JSON:
{
"success": true,
"timestamp": 1789345257,
"base": "USD",
"date": "2026-09-14",
"rates": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912,
"XPD": 0.000744,
"XCU": 0.294118,
"XAL": 0.434783,
"XNI": 0.142857,
"XZN": 0.344828
},
"unit": "per troy ounce"
}
Key fields:
- success: Boolean indicating request outcome.
- timestamp: Epoch time for rate capture; crucial for latency monitoring and cache versioning.
- base: Base currency (USD by default).
- date: Calendar date associated with rates; useful for human-facing UIs and reports.
- rates: Object mapping symbols to their rates relative to base.
- unit: Unit of measure; store alongside the value.
Common pitfalls and tips:
- Don’t assume every symbol will always be present. Validate existence before display.
- For XAU-only widgets, still consider fetching a small set of metals to future-proof your UI without extra network calls.
- Set cache TTL to match your plan’s update frequency to avoid redundant calls.
Historical rates: pricing context for Gold (XAU)
Historical context is critical for trend analysis, backtesting, and compliance. Use the historical endpoint to load prior snapshots for specific dates.
Example JSON:
{
"success": true,
"timestamp": 1789258857,
"base": "USD",
"date": "2026-09-13",
"rates": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915,
"XPD": 0.000748
},
"unit": "per troy ounce"
}
Usage notes:
- Combine historical points with latest data to compute rolling averages, volatility, and momentum indicators for Gold (XAU).
- Always persist the date and timestamp for reproducibility.
- Be mindful of holidays and weekends where markets may be thin or closed; behavior should be documented and handled gracefully.
Time-series: multi-day windows for analytics and charting
The time-series feature returns daily rates between a start and end date, ideal for building charts, computing rolling statistics, or running factor analysis on Gold (XAU) relative to other metals.
Example window:
{
"success": true,
"timeseries": true,
"start_date": "2026-09-07",
"end_date": "2026-09-14",
"base": "USD",
"rates": {
"2026-09-07": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915
},
"2026-09-09": {
"XAU": 0.000483,
"XAG": 0.0382,
"XPT": 0.000913
},
"2026-09-14": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912
}
},
"unit": "per troy ounce"
}
Best practices:
- Resample into uniform business-day calendars in your analytics layer.
- Check for missing dates and interpolate only if your use case can tolerate it; don’t interpolate for P&L or risk books without governance.
- Cache entire windows to reduce repeated historical lookups.
Convert: quoting Gold (XAU) in different currencies or units
The convert feature returns the result of converting an amount from one symbol or currency to another. It’s useful for client-facing interfaces that allow denominating Gold (XAU) in local currencies or for internal valuations in a multi-currency portfolio.
Example conversion from USD to XAU:
{
"success": true,
"query": {
"from": "USD",
"to": "XAU",
"amount": 1000
},
"info": {
"timestamp": 1789345257,
"rate": 0.000482
},
"result": 0.482,
"unit": "troy ounces"
}
Implementation guidance:
- Display both the rate and the result to increase transparency in UIs.
- Preserve the timestamp; conversion may later require audit trails.
- If you need grams or kilograms, apply post-processing unit conversions consistent with your app’s standards.
Fluctuation: day-over-day changes for Gold (XAU)
Fluctuation calculations provide start and end rates, absolute change, and percentage change. It’s ideal for notifications, alerting, and daily summary dashboards.
Example snapshot:
{
"success": true,
"fluctuation": true,
"start_date": "2026-09-07",
"end_date": "2026-09-14",
"base": "USD",
"rates": {
"XAU": {
"start_rate": 0.000485,
"end_rate": 0.000482,
"change": -3.0e-6,
"change_pct": -0.62
},
"XAG": {
"start_rate": 0.03825,
"end_rate": 0.03815,
"change": -0.0001,
"change_pct": -0.26
},
"XPT": {
"start_rate": 0.000915,
"end_rate": 0.000912,
"change": -3.0e-6,
"change_pct": -0.33
}
},
"unit": "per troy ounce"
}
Tips:
- Alerting thresholds should account for volatility regimes; a -0.62% move in Gold (XAU) may be material in low-volatility periods but routine during stress.
- Store both absolute and percentage changes to enable flexible reporting.
OHLC (Open/High/Low/Close): intraday structure for Gold (XAU)
OHLC provides a compact summary of price action for a given period. It’s essential for charting candlesticks, computing range-based indicators, and understanding volatility.
Example:
{
"success": true,
"timestamp": 1789345257,
"base": "USD",
"date": "2026-09-14",
"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"
}
Design considerations:
- Ensure period alignment across your system; mixing different session definitions can corrupt technical studies.
- Render OHLC alongside volume, if available from other sources, to enrich interpretation.
Bid/Ask: spreads and executable context for Gold (XAU)
Bid/Ask data offers insight into liquidity and transaction costs. For Gold (XAU), monitoring spread dynamics can inform execution strategies and slippage modeling.
Example:
{
"success": true,
"timestamp": 1789345257,
"base": "USD",
"date": "2026-09-14",
"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"
}
Usage tips:
- Compute percentage spread as spread/((bid+ask)/2) for normalized comparison across symbols.
- Use spread changes to trigger execution logic (e.g., avoid entries during transient spread widening).
Lowest/Highest price: range detection for Gold (XAU)
Range data helps contextualize the current price against extremes. It’s useful for breakout strategies, risk gating, and setting dynamic confidence intervals around the mid price.
Illustrative JSON for a given date:
{
"success": true,
"base": "USD",
"date": "2026-09-14",
"symbol": "XAU",
"lowest": 0.000481,
"highest": 0.000487,
"unit": "per troy ounce",
"metadata": {
"session": "24h",
"observations": 1440
}
}
Notes:
- If your plan or session definition differs, confirm how the range is calculated (rolling 24h vs session-based).
- Use metadata fields to inform sampling density and data confidence.
Open/High/Low/Close (OHLC) for specific dates via endpoint path
When retrieving OHLC for a specific date, verify that the date corresponds to the market session you track. Discrepancies may arise if your application uses region-specific calendars.
Example for a specific date path:
{
"success": true,
"base": "USD",
"date": "2026-09-10",
"rates": {
"XAU": {
"open": 0.000486,
"high": 0.00049,
"low": 0.000482,
"close": 0.000485
}
},
"unit": "per troy ounce"
}
Intraday: granular snapshots for Gold (XAU)
Intraday snapshots enable near real-time analytics without overwhelming your rate limits. They’re ideal for responsive UIs and for sampling-based backtesting models that do not require tick-level data.
Example intraday response:
{
"success": true,
"base": "USD",
"symbol": "XAU",
"interval": "10min",
"start_time": "2026-09-14T00:00:00Z",
"end_time": "2026-09-14T23:59:59Z",
"points": [
{ "timestamp": 1789341600, "price": 0.000484 },
{ "timestamp": 1789342200, "price": 0.000485 },
{ "timestamp": 1789342800, "price": 0.000483 }
],
"unit": "per troy ounce"
}
Considerations:
- Sample frequency depends on your plan; tune cache TTL accordingly.
- For latency-sensitive trading, combine intraday snapshots with bid/ask to reduce execution risk.
Carat: consumer-facing gold pricing by purity
For retail apps or jewelry pricing tools, the carat feature maps XAU rates to purity-adjusted gold prices. This bridges institutional-grade data with consumer-friendly outputs.
Example with purity breakdown:
{
"success": true,
"base": "USD",
"date": "2026-09-14",
"xau_rate_per_ounce": 0.000482,
"carat": {
"24k": { "purity": 0.999, "price_factor": 1.0, "price_per_ounce": 0.000482 },
"22k": { "purity": 0.916, "price_factor": 0.916, "price_per_ounce": 0.000441 },
"18k": { "purity": 0.750, "price_factor": 0.75, "price_per_ounce": 0.000362 },
"14k": { "purity": 0.585, "price_factor": 0.585, "price_per_ounce": 0.000282 }
},
"unit": "per troy ounce"
}
Implementation details:
- Surface purity percentages and explain the mapping to consumer users.
- Optionally convert to per gram/kilogram and local currency after retrieving the per-ounce rates.
Historical LME data and related symbols for context
Although this article focuses on Gold (XAU), institutional users often combine precious and base metals data to understand cross-asset flows. For example, comparing Gold (XAU) with Nickel (XNI) or LME Nickel (LME-NI) can reveal macro risk sentiment shifts.
Illustrative historical LME response:
{
"success": true,
"lme": true,
"base": "USD",
"symbol": "LME-NI",
"start_date": "2026-08-01",
"end_date": "2026-09-14",
"rates": {
"2026-08-01": { "official": 20000.0, "cash": 19980.0, "3m": 20120.0 },
"2026-08-02": { "official": 20110.0, "cash": 20090.0, "3m": 20190.0 }
},
"unit": "USD per metric ton"
}
Why it matters:
- Comparative analytics: Relate gold’s safe-haven dynamics to industrial metals behavior.
- Macro overlays: Integrate with macro time series to test multi-factor signals.
Supported symbols discovery
To confirm symbol names, query the supported symbols feature. This ensures your system uses canonical identifiers and remains compatible as coverage expands. See the authoritative list on the Metals-API Supported Symbols page.
Illustrative response:
{
"success": true,
"count": 120,
"symbols": [
{ "symbol": "XAU", "name": "Gold", "unit": "per troy ounce" },
{ "symbol": "XAG", "name": "Silver", "unit": "per troy ounce" },
{ "symbol": "XNI", "name": "Nickel", "unit": "per troy ounce" }
]
}
API response conventions and error handling
Metals-API responses include a success field. Always handle unsuccessful outcomes with retries and fallbacks, and log detailed error information for diagnostics.
Success example:
{
"success": true,
"timestamp": 1789345257,
"base": "USD",
"date": "2026-09-14",
"rates": { "XAU": 0.000482 },
"unit": "per troy ounce"
}
Typical error example (invalid key):
{
"success": false,
"error": {
"code": 101,
"type": "invalid_access_key",
"info": "You have not supplied a valid API Access Key."
}
}
Typical error example (rate limit):
{
"success": false,
"error": {
"code": 429,
"type": "rate_limit_exceeded",
"info": "You have exceeded your request limit. Please upgrade your plan or wait."
}
}
Error-handling strategies:
- Retry transient failures with exponential backoff and jitter.
- For authentication errors, halt retries and surface actionable messages to ops teams.
- Fail gracefully in UIs by showing last known good data with a timestamp.
Advanced use cases for Gold (XAU) with Metals-API
Real-time dashboards and alerts
Combine Latest, Bid/Ask, and Intraday to render responsive charts and send alerts on threshold breaches (e.g., spread widens beyond set basis points). Rate-limiting awareness is paramount: throttle polling to your plan’s data refresh cadence, and integrate server-side broadcast from a cached source.
Backtesting and research
Backtest strategies using Historical, Time-series, OHLC, and Fluctuation. Validate against multiple lookback windows and stress scenarios. Avoid data snooping by anchoring your tests to the timestamps provided and simulating realistic latencies.
Multi-currency display and settlement
Leverage Convert to show Gold (XAU) prices in the user’s local currency and to compute settlement values across portfolios. Ensure consistent rounding and precision, and maintain audit trails by preserving conversion timestamps.
Consumer apps with carat-based pricing
In jewelry or retail apps, connect Carat with Convert to offer local-currency pricing for different purities. To enhance UX, display purity percentages and provide an educational tooltip explaining how carat affects price.
Performance engineering for low-latency Gold (XAU) integrations
- Caching tiers: Use an in-memory cache for hot paths (e.g., latest XAU) and a distributed cache for historical/time-series windows. Key using symbol+date or symbol+timestamp.
- Batch requests: Favor endpoints that return multiple symbols to reduce overhead.
- Compression and headers: Enable HTTP compression and respect cache-control semantics you define internally.
- Decoupled architectures: Separate data ingestion, storage, and serving layers. Use queues for async processing of analytics.
Scaling strategies as usage grows
- Shard by symbol and date-window for parallel processing.
- Precompute aggregates nightly for fast daytime query speeds.
- Apply circuit breakers so UI remains stable even if upstream ingestion slows.
Security best practices when calling Metals-API
- Key confidentiality: Keep access_key on the server; never embed in client-side code or mobile binaries.
- Network security: Restrict egress routes and use TLS termination managed by hardened load balancers.
- Secrets lifecycle: Rotate access keys regularly and log all use. Alert on anomalous volumes or IPs.
- Least privilege: If you proxy requests, isolate that service with minimal permissions in your infrastructure.
Data governance, provenance, and audit trails
For regulated workflows, log every Metals-API call including parameters, timestamps, and checksums of the response body. Store both raw JSON and normalized records. For reproducibility, archive daily snapshots of XAU rates used for valuation and reporting.
Troubleshooting guide for common developer issues
Symptoms: Empty rates for XAU
Checklist:
- Confirm that XAU is a supported symbol (see the supported symbols list).
- Verify plan entitlements for the endpoint used.
- Check date ranges: ensure the requested date is within supported historical bounds.
Symptoms: Inconsistent values across endpoints
- Check unit fields and ensure your app doesn’t mix per-ounce with per-gram results.
- Confirm timestamp granularity; “latest” may reflect more recent updates than a daily historical snapshot.
Symptoms: Frequent 429 errors
- Implement a server-side cache; reduce polling frequency to match your plan’s refresh rate.
- Batch symbol requests rather than calling for one symbol at a time.
Symptoms: Precision loss in calculations
- Use fixed-precision decimals rather than binary floats; define and document rounding rules.
- Normalize all calculations to consistent base units before conversions.
Implementation checklists for production readiness
Backend
- Server-side proxy that injects access_key and enforces caching and rate limiting.
- Retry logic with exponential backoff for transient failures.
- Observability: request logging, metrics (latency, success rate), and alerting on error spikes.
Data layer
- Schema versioning for JSON normalization.
- Immutable storage of raw responses for audits.
- Indexing by symbol, date, and timestamp for efficient queries.
Frontend
- UI fallbacks to last known good XAU price with visible “as of” timestamp.
- Graceful degradation when certain fields (e.g., bid/ask) are temporarily unavailable.
Deep-dive: Response field semantics for Gold (XAU)
- success: Do not process financial calculations if false.
- timestamp: Anchor for latency tracking, cache keys, and backtesting time alignment.
- base: Essential for understanding the value domain; do not assume USD in derived metrics.
- unit: Prevents unit confusion and mispricing; always persist it.
- rates: Treat as a mapping from symbol to numeric values; validate symbol presence explicitly.
Innovative applications: analytics and smart technology integration
- Smart alerts: Use fluctuation and intraday to drive ML-based anomaly detection for Gold (XAU) moves.
- Portfolio insights: Correlate XAU time-series with macro indices and base metals like XNI to detect regime shifts.
- Digital transformation: Embed Metals-API into ERP and treasury tools for automated hedging and procurement planning.
End-to-end example scenarios with JSON
Scenario: Daily XAU pricing snapshot with historical context
Step 1: Fetch latest XAU and base peers.
{
"success": true,
"timestamp": 1789345257,
"base": "USD",
"date": "2026-09-14",
"rates": { "XAU": 0.000482, "XAG": 0.03815, "XPT": 0.000912 },
"unit": "per troy ounce"
}
Step 2: Fetch prior-day historical for comparison.
{
"success": true,
"timestamp": 1789258857,
"base": "USD",
"date": "2026-09-13",
"rates": { "XAU": 0.000485 },
"unit": "per troy ounce"
}
Step 3: Compute change and render to UI with timestamps noted.
Scenario: Pricing jewelry with 18k and 22k using carat
Fetch carat mapping and then convert to local currency:
{
"success": true,
"base": "USD",
"date": "2026-09-14",
"xau_rate_per_ounce": 0.000482,
"carat": {
"22k": { "purity": 0.916, "price_per_ounce": 0.000441 },
"18k": { "purity": 0.75, "price_per_ounce": 0.000362 }
},
"unit": "per troy ounce"
}
Scenario: Alert on spread widening for execution risk
Poll Bid/Ask and alert when spread exceeds threshold:
{
"success": true,
"timestamp": 1789345257,
"base": "USD",
"date": "2026-09-14",
"rates": {
"XAU": { "bid": 0.000481, "ask": 0.000483, "spread": 0.000002 }
},
"unit": "per troy ounce"
}
Caching and performance optimization: practical patterns
- Keying strategy: latest:XAU for the latest snapshot, hist:XAU:2026-09-14 for daily historical, ts:XAU:20260907-20260914 for windows.
- Stale-while-revalidate: Serve cached data immediately, refresh asynchronously, then update subscribers.
- Pre-warm caches at market open for faster page loads.
Architectural considerations for resilient deployments
- Stateless microservices that call Metals-API and publish normalized messages to a message bus for downstream consumers.
- Dedicated persistence service storing raw JSON and curated aggregates.
- Edge caches/CDNs for high-traffic public dashboards (with server-side key management).
Quality assurance and testing strategies
- Contract tests against recorded fixtures for each endpoint.
- Fuzz testing around date ranges and symbol inputs.
- Load tests with synthetic throttling to validate backoff logic.
Compliance, audit, and reproducibility in financial systems
- Immutable logs of every input that influenced pricing decisions.
- Versioned calculation logic with change control.
- Time-aligned datasets for audits (timestamp + date).
Developer resources and documentation
For precise parameter names, authentication details, plan limits, and endpoint paths, use the official Metals-API Documentation. You can also browse the latest coverage on the Metals-API Supported Symbols page and sign up for access at the Metals-API Website. For macro overlays and market context, consider sources like IMF Data and OECD statistics, and for futures term structure analysis see CME Gold contracts.
Image-based context and visualizations
When presenting Gold (XAU) insights, visuals improve comprehension. You can embed a representative image or infographic relevant to metals data.

Comprehensive endpoint scenarios and field-by-field clarifications
Latest rates nuances
Multiple scenario responses:
All symbols available:
{
"success": true,
"timestamp": 1789345257,
"base": "USD",
"date": "2026-09-14",
"rates": { "XAU": 0.000482, "XAG": 0.03815, "XPT": 0.000912, "XNI": 0.142857 },
"unit": "per troy ounce"
}
Partial symbol set due to plan limits or symbol availability:
{
"success": true,
"timestamp": 1789345257,
"base": "USD",
"date": "2026-09-14",
"rates": { "XAU": 0.000482 },
"unit": "per troy ounce",
"note": "Limited symbols returned under current plan"
}
Error on invalid base currency request:
{
"success": false,
"error": {
"code": 402,
"type": "invalid_base",
"info": "The specified base currency is not supported for this endpoint."
}
}
Historical rates edge cases
Holiday or non-trading day return:
{
"success": true,
"base": "USD",
"date": "2026-12-25",
"rates": { "XAU": 0.000490 },
"unit": "per troy ounce",
"metadata": { "note": "Holiday value; reduced liquidity" }
}
Out-of-range date:
{
"success": false,
"error": {
"code": 601,
"type": "date_out_of_range",
"info": "Requested date precedes earliest available historical data."
}
}
Time-series: varying date densities
Example with missing weekend entries:
{
"success": true,
"timeseries": true,
"start_date": "2026-09-01",
"end_date": "2026-09-07",
"base": "USD",
"rates": {
"2026-09-01": { "XAU": 0.000486 },
"2026-09-02": { "XAU": 0.000487 },
"2026-09-05": { "XAU": 0.000488 },
"2026-09-07": { "XAU": 0.000485 }
},
"unit": "per troy ounce"
}
Convert: multi-hop conversions and precision
In some systems, you may convert XAU to EUR by first converting USD to EUR and then applying the XAU rate. Prefer the direct convert endpoint to reduce rounding error and latency. Ensure final presentation uses a consistent decimal policy.
Error example for unsupported pair:
{
"success": false,
"error": {
"code": 702,
"type": "unsupported_pair",
"info": "Requested conversion pair is not supported for this plan."
}
}
Fluctuation: partial symbol sets
Example where only XAU requested:
{
"success": true,
"fluctuation": true,
"start_date": "2026-09-10",
"end_date": "2026-09-14",
"base": "USD",
"rates": {
"XAU": { "start_rate": 0.000486, "end_rate": 0.000482, "change": -0.000004, "change_pct": -0.82 }
},
"unit": "per troy ounce"
}
OHLC: multiple session definitions
If your analytics assume New York trading hours while the API defines a 24-hour window, document the discrepancy and adjust in post-processing where required. Always record the date and any session metadata you maintain internally.
Bid/Ask: sporadic liquidity
During illiquid hours, spreads may widen or bid/ask may briefly be unavailable for some symbols. Your UI should surface a clear “pricing delayed” or “liquidity thin” indicator.
Empty bid/ask example:
{
"success": true,
"timestamp": 1789345257,
"base": "USD",
"date": "2026-09-14",
"rates": {
"XAU": { "bid": null, "ask": null, "spread": null }
},
"unit": "per troy ounce",
"metadata": { "note": "No current quotes; retry shortly" }
}
Carat: user education and conversions
Document your conversion from per ounce to per gram for consumer contexts (1 troy ounce ≈ 31.1034768 grams). Store constants centrally and test precision regularly to avoid drift.
Historical LME: integrating base and precious metals
When correlating Gold (XAU) with LME-NI, normalize units (per ounce vs per metric ton) and currencies consistently. Store both raw values and normalized indices for robust analytics.
Operational excellence: monitoring and alerting
- SLIs/SLOs: Track success ratio, p95/p99 latencies, and data freshness (now - timestamp).
- Error budgets: Define tolerable downtime or stale windows and enforce them with circuit breakers.
- Synthetic probes: Schedule test calls to Metals-API endpoints and assert schema conformity.
Data lifecycle and retention
- Raw vs curated: Keep raw JSON indefinitely for audit; store curated aggregates for fast access with a retention policy aligned to business needs.
- Backup and recovery: Regularly back up data stores; test restores and reindexing procedures.
Privacy, compliance, and access control
- PII minimization: Metals-API calls generally don’t include PII, but your surrounding system might. Keep them separated to simplify compliance boundaries.
- Access control: Restrict who can view or export pricing data if your contracts require it.
Frequently asked questions for Gold (XAU) integrations
Q: Can I rely on Metals-API for intraday price-sensitive trading decisions?
A: Many do, but architect your system with caching, redundancy, and explicit handling for transient gaps. For execution, combine with bid/ask and your broker’s constraints.
Q: How do I handle weekends and holidays for XAU time series?
A: Decide on a canonical calendar and resample data accordingly. Do not backfill missing points unless your analytics explicitly allow it.
Q: What about unit conversions for retail apps?
A: Convert from per troy ounce to grams/kilograms as needed. Then apply carat purity and currency conversion. Surface methods and constants to auditors.
Putting it all together: a production blueprint
- Ingestion: A backend service fetches Latest XAU at your plan’s cadence, and Historical/Time-series overnight for analytics.
- Normalization: Validate schema, cast values to fixed-precision decimals, store unit and timestamps.
- Caching: Serve UIs from in-memory cache with stale-while-revalidate; batch refreshes server-side.
- Analytics: Compute rolling averages, volatility, and fluctuation metrics; enrich with OHLC and Bid/Ask.
- Distribution: Expose internal APIs for downstream apps; externalize only derived data if contractual terms allow.
- Observability: Monitor error rates, latencies, and data freshness; alert on anomalies.
Where to learn more and get started
For concrete parameters and endpoint paths, go to the Metals-API Documentation. To verify XAU, XNI, LME-NI, and other symbols, see the symbols directory. To sign up, compare plans, and review features, visit the Metals-API Website. For complementary market analysis, cross-check against LBMA data and futures terms on CME Group.
Conclusion: building robust Gold (XAU) applications with Metals-API
Gold (XAU) remains a cornerstone asset in global markets, and developers require accurate, resilient data access to power trading tools, analytics, and consumer apps. Metals-API provides a comprehensive, technically sound interface spanning Latest, Historical, Time-series, Intraday, Fluctuation, Bid/Ask, OHLC, Carat, and specialized historical LME data. By adhering to strong engineering practices—secure key management, rate-limit aware caching, detailed schema validation, fixed-precision math, robust error handling, and comprehensive observability—you can implement production-grade systems that transform real-time and historical gold data into actionable insights. Whether you’re building institutional dashboards, retail pricing tools, or research platforms, Metals-API offers the capabilities to integrate Gold (XAU) cleanly and scalably, with room to expand into related metals like Nickel (XNI) and LME-NI as your analytics deepen and your use cases evolve.