Add live and historical gold, silver, platinum, and palladium prices to market dashboards, research tools, alerts, and contract-design workflows through a straightforward JSON API.
Prediction-market APIs provide contracts, probabilities, and order books. MetalpriceAPI provides the underlying metals data that helps users understand those markets. Combine the two sources in your own application without treating a spot price and a contract probability as the same thing.
Retrieve current and historical metal prices in USD or more than 150 other currencies.
Read odds, contracts, and liquidity from the prediction-market venue you integrate.
Calculate distance to a strike, build alerts, visualize context, and run historical analysis.
Use historical ranges and OHLC observations to evaluate strike spacing, price buckets, and expiration windows before publishing a market.
Display the current metal price, the contract threshold, the absolute gap, and the percentage move required to reach it.
Notify users when gold or silver moves within a chosen percentage of a market threshold or crosses a monitored level.
Join historical metal observations with archived probability data to study reactions, divergence, and behavior near expiration.
Express precious-metal values in the currencies your audience uses while preserving the contract’s formal resolution denomination.
Use stored observations for monitoring and provisional checks while resolving every contract according to its published rules.
This example retrieves the current XAU rate, converts it to USD per troy ounce, and calculates how far the price is from an application-defined threshold.
success before using the responseconst threshold = 4100;
const url = new URL("https://api.metalpriceapi.com/v1/latest");
url.search = new URLSearchParams({
api_key: process.env.METALPRICEAPI_KEY,
base: "USD",
currencies: "XAU"
});
const response = await fetch(url);
const data = await response.json();
if (!data.success) {
throw new Error(data.error?.info || "Price request failed");
}
const goldUsd = 1 / data.rates.XAU;
const distance = threshold - goldUsd;
const moveRequired = (distance / goldUsd) * 100;
console.log({ goldUsd, threshold, distance, moveRequired });
| Job | MetalpriceAPI data | Use it for |
|---|---|---|
| Live context | Latest rates | Price displays, distance-to-threshold calculations, and alerts |
| Single past observation | Historical date | Outcome research and reproducible comparisons |
| Daily series | Timeframe | Charts, range analysis, and model inputs |
| Intraday analysis | Hourly data | Reaction studies and monitoring around market events |
| Daily range analysis | OHLC | Threshold design and high/low comparisons |
Review endpoint availability and plan limits in the API documentation.
Create a free API key and test a live price, historical date, or threshold-monitoring workflow.
Get a free API key Read the documentation