Metals Price API
The Metals Price API returns live spot prices for gold (XAU), silver (XAG), platinum (XPT), and palladium (XPD), plus copper and aluminum, with the matching futures price and contract in the same response. Prices can be returned per troy ounce, gram, kilogram, or pound, in any major currency.
Available endpoints:
- /v1/metalsprice - Access the current spot and futures price for a metal
Spot vs. futures. The spot price is what a metal costs for immediate delivery; futures are agreed today for delivery on a later date and usually trade a little above spot. Gold, silver, platinum, and palladium spot prices are blended from multiple independent live market quotes and cross-checked against futures. Copper and aluminum have no public live spot market, so their spot price is the most actively traded COMEX futures contract, as on most price sites; spot_type tells you which method was used.
For gold alone, see the Gold Price API; for energy, grains, and 25+ other commodities, see the Commodity Price API.
Supported metals (sample prices):
From 2,715 users
Applications using this API
API Status
API Response Times
Average | P50 | P75 | P90 | P95 |
|---|---|---|---|---|
| 247ms | 266ms | 293ms | 532ms | 1079ms |
Didn't find what you were looking for? Suggest an improvement
https://api.api-ninjas.com/v1/metalsprice
Returns the current spot price of a metal, with its futures price and contract. Free accounts receive the last daily closing price for every metal; premium members get live prices. Developer plans get a spot price refreshed every minute, and Business plans and above get the live spot price, updated about every 10 seconds.
Parameters
metaloptionalThe metal to return:
gold(default),silver,platinum,palladium,copper, oraluminum. Currency codesxau,xag,xpt, andxpdare also accepted.currencyoptionalISO 4217 currency code to convert prices into (e.g.
EUR,GBP,INR). Defaults to USD.unitoptionalTarget weight unit:
troy_ounce,g,kg,oz,lb,metric_ton,short_ton, orhundredweight. Defaults to the metal's native unit (troy ounce for precious metals, pound for copper, metric ton for aluminum).metalsoptional Business tier and above, or any annual planComma-separated list of metals for a batch request (e.g.
gold,silver,platinum). Returns an array.
Headers
X-Api-KeyrequiredAPI Key associated with your account.
Response
A JSON object with the following fields or an error if the request is unsuccessful.
metalThe requested metal (e.g.
gold).nameThe display name of the metal.
priceThe spot price: live on premium plans, the last daily close on the free plan.
bidPremium onlyThe spot bid price. Gold, silver, platinum, and palladium only.
askPremium onlyThe spot ask price. Gold, silver, platinum, and palladium only.
spot_typeHow the spot price is produced:
composite(blended live market quotes, for precious metals) orfutures_based(the most actively traded futures contract, for copper and aluminum).previous_closeThe previous session's closing spot price.
change_24hThe change versus the previous close.
change_24h_percentThe percent change versus the previous close.
high_24hThe session's high price.
low_24hThe session's low price.
futures_priceThe price of the futures contract below.
futures_contractThe futures contract symbol (e.g.
GCZ26is the December 2026 gold contract).futures_contract_monthThe contract's delivery month (
YYYY-MM).futures_exchangeThe exchange the contract trades on (COMEX or NYMEX).
unitThe weight unit prices are quoted in.
currency_unitThe price currency (
USDby default).market_statusopenorclosed. Metals trade from Sunday 6 PM to Friday 5 PM ET, with a daily break from 5 to 6 PM ET.updatedThe Unix timestamp (in seconds) of the spot price.
Live Demo
Code Examples
curl -X GET "https://api.api-ninjas.com/v1/metalsprice?metal=gold" \
-H "X-Api-Key: YOUR_API_KEY"If your programming language is not listed in the Code Example above, you can still make API calls by using a HTTP request library written in your programming language and following the above documentation.
Frequently Asked Questions
Can I use the Metals Price API for commercial purposes?
Yes, but you must have a premium subscription. Commercial use of the Metals Price API is not permitted on the free tier. See our pricing page to choose a plan that fits your needs.How do I get an API key and start using the Metals Price API?
Sign up for a free account to instantly get your API key, then pass it in theX-Api-Keyheader on every request. The documentation above includes ready-to-run examples in cURL, Python, JavaScript, Node.js, and more.What happens if I exceed my quota for the month?
Your API requests will simply be denied once you hit your monthly quota — you will never be charged more than the plan you signed up for. To increase your quota, you can upgrade your plan any time on our pricing page.What happens if a request to the Metals Price API fails?
The API responds with a standard HTTP status code and a JSON error message describing the problem. See our error codes reference for the full list of codes and how to resolve each one, or contact support if you need help.Which metals does the Metals Price API cover?
The Metals Price API returns spot and futures prices for gold (metal=goldorxau), silver (xag), platinum (xpt), palladium (xpd), copper, and aluminum. For energy, grains, and other commodities, see the Commodity Price API.Is there a free metals price API?
Yes. Create a free account for an instant API key. The free tier returns the last daily closing spot price and futures settlement for every metal, including currency and unit conversion (for example, gold per gram in EUR). Premium plans unlock live prices with bid and ask: the spot price refreshes every minute on Developer plans and about every 10 seconds on Business plans and above, which also unlock themetalsbatch parameter.How is the spot price calculated?
For gold, silver, platinum, and palladium, the spot price (spot_typecomposite) is blended from multiple independent live market quotes and cross-checked against futures prices; outlying quotes are discarded. Copper and aluminum have no public live spot market, so their spot price (spot_typefutures_based) is the most actively traded COMEX futures contract, the convention used by most price sites. Every response also returns the futures price, contract symbol, and delivery month, so you can see both.How do I get the gold price per gram or kilogram in my currency?
Add theunitparameter (g,kg,troy_ounce,oz,lb,metric_ton) and thecurrencyparameter (an ISO 4217 code likeEUR,GBP, orINR), for example/v1/metalsprice?metal=gold&unit=g¤cy=EUR. Spot, bid, ask, and futures prices all convert together.When are metal prices updated?
Metals trade nearly 24 hours a day, from Sunday 6 PM to Friday 5 PM US Eastern time, with a daily break from 5 to 6 PM. Themarket_statusfield reportsopenorclosed; while the market is closed, the API returns the last traded price, andupdatedshows when it was set.
Explore API integration use cases for recommended APIs and workflow examples.