GoldAPI.io provides real-time and historical gold, silver, platinum, and palladium prices across major global currencies through REST, WebSocket, and the GoldAPI MCP Server.
Build price widgets, bullion dealer tools, jewelry calculators, trading dashboards, portfolio applications, automation workflows, and AI agents with ChatGPT, Claude, Codex, and other MCP-compatible clients.
Free includes 150 shared REST, WebSocket token, and MCP market-data requests each calendar month. Pro provides unlimited REST without WebSocket or MCP access. Business adds production WebSockets and unlimited GoldAPI MCP Server access.
Base URLhttps://www.goldapi.ioVersion 3.1.0
Authentication
Send credentials through the header required by each endpoint. The examples use placeholders only.
x-access-tokenGoldAPI.io API key. Pass your key as the x-access-token request header.
x-ws-api-keyDedicated WebSocket API key shown in the GoldAPI dashboard.
Plans and quotas
Free accounts include 150 shared REST, WebSocket token, and MCP market-data requests per calendar month. Pro includes unlimited REST without WebSockets or MCP. Business includes unlimited REST, production WebSocket access, and unlimited remote MCP server usage.
Free150 shared monthly requestsMCP evaluation with OAuth or API key1 WebSocket connection10 channels per connection
ProUnlimited REST requestsNo WebSocket accessNo MCP Server access
BusinessUnlimited REST requests5 WebSocket connections20 channels per connectionMCP access with OAuth or API key
Endpoints
Prices
Live and historical precious metals prices
GET/api/price/{metal}/{currency}
Get live precious metal price
Returns the latest normalized spot price for a precious metal in the selected currency.
Authentication:x-access-token with GOLD_API_KEY
Parameters
Name
Location
Type
Description
metalrequired
path
MetalSymbol
Precious metal symbol.
currencyrequired
path
CurrencyCode
Currency code used to quote the metal price.
melt_price
query
boolean
Include melt prices per gram by karat.
currency_info
query
boolean
Include currency name and symbol information.
purity
query
boolean
Include purity ratios by karat.
array
query
string
Presence flag. When included, wraps the price object in a results array. Any supplied value enables wrapping.
Request
curl --request GET 'https://www.goldapi.io/api/price/XAU/AED'\
--header 'x-access-token: GOLD_API_KEY'\
--header 'Accept: application/json'
Example response
{"timestamp":1792376602,"datetime":"2026-10-19T01:03:22Z","metal":"XAU","currency":"USD","exchange":"FOREXCOM","symbol":"FOREXCOM:XAUUSD","open_time":1792368000,"open_price":4166.13,"prev_close_price":4166.13,"low_price":4163.755,"high_price":4187.87,"price":4175.12,"unit":"troy_ounce","change":8.99,"change_percent":0.22,"ask":4175.42,"bid":4174.71,"spread":{"value":0.71,"percentage":0.017},"range":{"value":24.115,"percentage":0.5788},"price_per_unit":{"troy_ounce":4175.12,"avoirdupois_ounce":3805.4479,"gram":134.2332,"kilogram":134233.225,"grain":8.6982,"pennyweight":208.756,"tola":1565.67,"tael":5073.9306,"baht":2046.2513},"melt_price_per_gram":{"24k":134.2332,"23k":128.6402,"22k":123.0471,"21k":117.4541,"20k":111.861,"18k":100.6749,"16k":89.4888,"14k":78.3027,"12k":67.1166,"10k":55.9305,"9k":50.3375,"8k":44.7444},"currency_info":{"code":"USD","name":"United States Dollar","symbol":"$"}}
Responses
200 Latest normalized precious metal spot price.400 Invalid request parameters.403 Missing or invalid API key, or monthly API quota exceeded.429 Rate limit exceeded.500 Unexpected server error.
Get API Key and Set Up In 30 Seconds. No Card Required.
GET/api/price/{metal}/{currency}/{date}
Get historical precious metal price
Returns the normalized historical spot price for a precious metal in the selected currency. The response uses the same field names as the live endpoint.
Authentication:x-access-token with GOLD_API_KEY
Parameters
Name
Location
Type
Description
metalrequired
path
MetalSymbol
Precious metal symbol.
currencyrequired
path
CurrencyCode
Currency code used to quote the metal price.
daterequired
path
DateInput
Historical date in preferred YYYY-MM-DD format. YYYYMMDD remains supported.
melt_price
query
boolean
Include melt prices per gram by karat.
currency_info
query
boolean
Include currency name and symbol information.
purity
query
boolean
Include purity ratios by karat.
array
query
string
Presence flag. When included, wraps the price object in a results array. Any supplied value enables wrapping.
Request
curl --request GET 'https://www.goldapi.io/api/price/XAU/AED/2025-01-01'\
--header 'x-access-token: GOLD_API_KEY'\
--header 'Accept: application/json'
Example response
{"timestamp":1735689600,"datetime":"2025-01-01T00:00:00Z","metal":"XAU","currency":"USD","exchange":"FOREXCOM","symbol":"FOREXCOM:XAUUSD","open_time":1792368000,"open_price":4166.13,"prev_close_price":4166.13,"low_price":4163.755,"high_price":4187.87,"price":4175.12,"unit":"troy_ounce","change":8.99,"change_percent":0.22,"ask":4175.42,"bid":4174.71,"spread":{"value":0.71,"percentage":0.017},"range":{"value":24.115,"percentage":0.5788},"price_per_unit":{"troy_ounce":4175.12,"avoirdupois_ounce":3805.4479,"gram":134.2332,"kilogram":134233.225,"grain":8.6982,"pennyweight":208.756,"tola":1565.67,"tael":5073.9306,"baht":2046.2513},"melt_price_per_gram":{"24k":134.2332,"23k":128.6402,"22k":123.0471,"21k":117.4541,"20k":111.861,"18k":100.6749,"16k":89.4888,"14k":78.3027,"12k":67.1166,"10k":55.9305,"9k":50.3375,"8k":44.7444},"currency_info":{"code":"USD","name":"United States Dollar","symbol":"$"}}
Responses
200 Normalized historical precious metal spot price.400 Invalid request parameters.403 Missing or invalid API key, or monthly API quota exceeded.429 Rate limit exceeded.500 Unexpected server error.
Get API Key and Set Up In 30 Seconds. No Card Required.
GET/api/history/{metal}/{currency}
Get a historical metal price range
Returns ordered daily prices for an inclusive date range of up to 90 days. Dates without stored metal or FX data are omitted.
Authentication:x-access-token with GOLD_API_KEY
Parameters
Name
Location
Type
Description
metalrequired
path
MetalSymbol
Precious metal symbol.
currencyrequired
path
CurrencyCode
Currency code used to quote the metal price.
fromrequired
query
DateInput
Inclusive range start in preferred YYYY-MM-DD format. YYYYMMDD remains supported.
torequired
query
DateInput
Inclusive range end in preferred YYYY-MM-DD format. YYYYMMDD remains supported. The inclusive range cannot exceed 90 days or include future dates.
Request
curl --request GET 'https://www.goldapi.io/api/history/XAU/AED?from=2025-01-01&to=2025-01-31'\
--header 'x-access-token: GOLD_API_KEY'\
--header 'Accept: application/json'
200 Ordered historical daily metal prices.400 Invalid request parameters.401 Invalid or missing API key.429 Rate limit exceeded.500 Unexpected server error.
Get API Key and Set Up In 30 Seconds. No Card Required.
GET/api/price/{metal}
Get live precious metal price in USD
Returns the latest normalized spot price for a precious metal quoted in USD.
Authentication:x-access-token with GOLD_API_KEY
Parameters
Name
Location
Type
Description
metalrequired
path
MetalSymbol
Precious metal symbol.
melt_price
query
boolean
Include melt prices per gram by karat.
currency_info
query
boolean
Include currency name and symbol information.
purity
query
boolean
Include purity ratios by karat.
array
query
string
Presence flag. When included, wraps the price object in a results array. Any supplied value enables wrapping.
Request
curl --request GET 'https://www.goldapi.io/api/price/XAU'\
--header 'x-access-token: GOLD_API_KEY'\
--header 'Accept: application/json'
Example response
{"timestamp":1792376602,"datetime":"2026-10-19T01:03:22Z","metal":"XAU","currency":"USD","exchange":"FOREXCOM","symbol":"FOREXCOM:XAUUSD","open_time":1792368000,"open_price":4166.13,"prev_close_price":4166.13,"low_price":4163.755,"high_price":4187.87,"price":4175.12,"unit":"troy_ounce","change":8.99,"change_percent":0.22,"ask":4175.42,"bid":4174.71,"spread":{"value":0.71,"percentage":0.017},"range":{"value":24.115,"percentage":0.5788},"price_per_unit":{"troy_ounce":4175.12,"avoirdupois_ounce":3805.4479,"gram":134.2332,"kilogram":134233.225,"grain":8.6982,"pennyweight":208.756,"tola":1565.67,"tael":5073.9306,"baht":2046.2513},"melt_price_per_gram":{"24k":134.2332,"23k":128.6402,"22k":123.0471,"21k":117.4541,"20k":111.861,"18k":100.6749,"16k":89.4888,"14k":78.3027,"12k":67.1166,"10k":55.9305,"9k":50.3375,"8k":44.7444},"currency_info":{"code":"USD","name":"United States Dollar","symbol":"$"}}
Responses
200 Latest precious metal spot price in USD.400 Invalid request parameters.403 Missing or invalid API key, or monthly API quota exceeded.429 Rate limit exceeded.500 Unexpected server error.
Get API Key and Set Up In 30 Seconds. No Card Required.
Endpoints
Rates
Current exchange rates between supported currencies
GET/api/rates/{base}/{quote}
Get a current currency exchange rate
Returns the current conversion price, bid, and ask between two supported currencies.
Authentication:x-access-token with GOLD_API_KEY
Parameters
Name
Location
Type
Description
baserequired
path
CurrencyCode
Currency code to convert from.
quoterequired
path
CurrencyCode
Currency code to convert to.
Request
curl --request GET 'https://www.goldapi.io/api/rates/USD/EUR'\
--header 'x-access-token: GOLD_API_KEY'\
--header 'Accept: application/json'
200 Current currency exchange rate.400 Invalid request parameters.401 Invalid or missing API key.429 Rate limit exceeded.500 Unexpected server error.503 Current source data is unavailable or stale.
Get API Key and Set Up In 30 Seconds. No Card Required.
Endpoints
LBMA
Historical LBMA precious-metal benchmark prices
GET/api/lbma/{metal}/{date}
Get an LBMA benchmark price by date
Returns USD-per-troy-ounce LBMA benchmark prices. Gold, platinum, and palladium expose AM and PM fixes; silver exposes its single daily price.
Authentication:x-access-token with GOLD_API_KEY
Parameters
Name
Location
Type
Description
metalrequired
path
MetalSymbol
Precious metal symbol.
daterequired
path
DateInput
Historical date in preferred YYYY-MM-DD format. YYYYMMDD remains supported.
Request
curl --request GET 'https://www.goldapi.io/api/lbma/XAU/2025-01-01'\
--header 'x-access-token: GOLD_API_KEY'\
--header 'Accept: application/json'
200 Historical LBMA benchmark price.400 Invalid request parameters.401 Invalid or missing API key.404 Requested resource was not found.429 Rate limit exceeded.500 Unexpected server error.
Get API Key and Set Up In 30 Seconds. No Card Required.
Endpoints
Statistics
Authenticated API request usage statistics
GET/api/stat
Get API request usage statistics
Returns request totals for today, yesterday, the current calendar month, and the previous calendar month for the authenticated API key.
Authentication:x-access-token with GOLD_API_KEY
Parameters
No parameters.
Request
curl --request GET 'https://www.goldapi.io/api/stat'\
--header 'x-access-token: GOLD_API_KEY'\
--header 'Accept: application/json'
200 Request usage totals.401 Invalid or missing API key.429 Rate limit exceeded.500 Unexpected server error.
Get API Key and Set Up In 30 Seconds. No Card Required.
Endpoints
Status
API status and account information
GET/api/status
Get API status
Returns API status or account/request information if available.
Authentication:x-access-token with GOLD_API_KEY
Parameters
No parameters.
Request
curl --request GET 'https://www.goldapi.io/api/status'\
--header 'x-access-token: GOLD_API_KEY'\
--header 'Accept: application/json'
Example response
{"result":true}
Responses
200 API status response.400 Invalid request parameters.401 Invalid or missing API key.404 Requested resource was not found.429 Rate limit exceeded.500 Unexpected server error.
Get API Key and Set Up In 30 Seconds. No Card Required.
Endpoints
WebSockets
Provision WebSocket access and issue short-lived connection tokens
POST/api/ws/token
Issue a short-lived WebSocket token
Authenticates a dedicated WebSocket API key and issues a short-lived JWT. Successful issuance counts as one shared monthly request for Free accounts.
Authentication:x-ws-api-key with GOLD_WS_API_KEY
Parameters
No parameters.
Request
curl --request POST 'https://www.goldapi.io/api/ws/token'\
--header 'x-ws-api-key: GOLD_WS_API_KEY'\
--header 'Accept: application/json'
200 WebSocket token issued.401 Invalid or unavailable dedicated WebSocket API key.404 WebSocket functionality is disabled.429 Rate limit exceeded.500 Unexpected server error.
Get API Key and Set Up In 30 Seconds. No Card Required.
WebSocket protocol
Obtain a short-lived JWT from POST /api/ws/token, connect, then send an auth message containing the token.
Endpointwss://ws.goldapi.io/v1
metals:XAUUSD for precious-metal updates.
fx:USDEUR for exchange-rate updates.
WebSocket payloads use the same normalized price and rate models documented below.
Connection and message flow
Request a short-lived token, connect to the returned WebSocket URL, authenticate, and subscribe to the concrete XAUUSD channel. Use a unique requestId to correlate each command with its response.
1. Connection established
The server confirms the protocol version after the WebSocket connection opens.
Server responds
{"type":"welcome","protocolVersion":1}
2. Authenticate
Send the short-lived token returned by POST /api/ws/token.
Error messages include a stable code and human-readable message. PRICE_UNAVAILABLE applies to the affected channel; TOKEN_EXPIRED is followed by close code 4001 and requires a fresh token and connection.
Handle type: error before processing normal messages. Log the code and message, keep the connection open for recoverable channel errors, and obtain a new token after TOKEN_EXPIRED or close code 4001.
Node.js example
This is the same connection pattern used in the Dashboard sample. It requests a token, connects, authenticates, subscribes to metals:XAUUSD, maintains ping/pong heartbeats, and processes protocol and connection errors.
// Requires Node.js 18+ and: npm install wsconst WebSocket =require('ws');const wsApiKey ="GOLD_WS_API_KEY";const channels =["metals:XAUUSD"];let heartbeatTimer;functionstartHeartbeat(socket){constping=()=>{if(socket.readyState !== WebSocket.OPEN)return;// type selects the heartbeat command; the unique requestId matches its pong.const requestId ="goldapi-xauusd-ping-"+ Date.now();
socket.send(JSON.stringify({ type:'ping', requestId }));};ping();
heartbeatTimer =setInterval(ping,25000);}asyncfunctiongetWebSocketSession(){const response =awaitfetch('https://www.goldapi.io/api/ws/token',{
method:'POST',
headers:{'x-ws-api-key': wsApiKey
}});const session =await response.json();if(!response.ok){thrownewError(session.error ||'Token request failed');}return session;}asyncfunctionconnect(){const session =awaitgetWebSocketSession();const socket =newWebSocket(session.websocketUrl);
socket.on('open',()=>{// type selects the auth command; token proves access; requestId is echoed// by the server so this command can be matched to its response.
socket.send(JSON.stringify({
type:'auth',
token: session.token,
requestId:"goldapi-xauusd-auth"}));});
socket.on('message',rawMessage=>{let message;try{
message =JSON.parse(rawMessage.toString());}catch(error){
console.error('Invalid WebSocket message:', error);return;}if(message.type ==='error'){
console.error('GoldAPI WebSocket error:', message.code, message.message);return;}if(message.type ==='authenticated'){// channels lists the feeds to join; requestId correlates the response.
socket.send(JSON.stringify({
type:'subscribe',
channels,
requestId:"goldapi-xauusd-subscribe"}));startHeartbeat(socket);}if(message.type ==='price.update'){
console.log(message);}if(message.type ==='pong'){
console.log('Heartbeat confirmed:', message.requestId);}});// Tokens last 15 minutes. Obtain a new token before reconnecting.
socket.on('close',()=>{clearInterval(heartbeatTimer);setTimeout(()=>connect().catch(console.error),1000);});
socket.on('error',error=> console.error('WebSocket connection error:', error));}connect().catch(console.error);
Model Context Protocol (MCP) server
Connect ChatGPT, Claude, Codex, and other MCP-compatible AI clients to GoldAPI through a remote Streamable HTTP MCP endpoint. Free accounts can evaluate MCP using their shared monthly allowance, while Business includes unlimited MCP usage. Pro does not include MCP access.
Configure the endpoint without a credential header. Compatible clients discover authorization metadata, open the GoldAPI login and consent flow, and manage access and refresh tokens.
Return the current GoldAPI price for a supported metal and currency.
1 price request
get_historical_metal_price
Return the GoldAPI price for one historical calendar date.
1 price request
get_metal_price_history
Return ordered daily prices for an inclusive range of up to 90 days.
1 history request
get_currency_rate
Return a current currency conversion rate with bid and ask values.
1 rates request
convert_currency
Convert an amount using the current GoldAPI currency rate.
1 rates request
get_lbma_benchmark
Return an LBMA benchmark for a supported metal and date.
1 LBMA request
convert_metal_weight
Convert precious-metal weight between nine supported units.
No price request
calculate_metal_value
Calculate live or historical melt value by weight and purity.
1 price request
calculate_dealer_quote
Create a nonbinding dealer buy or sell estimate from melt value.
1 price request
compare_karat_values
Compare common karat values using one GoldAPI price.
1 price request
analyze_metal_performance
Calculate descriptive statistics for a history range without forecasting.
1 history request
value_metal_holdings
Value up to 50 holdings using up to eight deduplicated price requests.
1–8 price requests
Example prompts
These prompts show how ChatGPT, Claude, Codex, and other MCP-compatible AI clients can select GoldAPI tools for common metals workflows.
“What is the current gold price in Australian dollars?”
Expected toolget_current_metal_price
“What was the silver price in USD on 2025-01-15?”
Expected toolget_historical_metal_price
“Show daily XAU/EUR prices from 2025-03-01 through 2025-03-14.”
Expected toolget_metal_price_history
“Convert 10,000 USD to AED using the current GoldAPI exchange rate.”
Expected toolconvert_currency
“Get the LBMA gold benchmark in USD for 2025-06-30.”
Expected toolget_lbma_benchmark
“What is the current melt value of 125 grams of 22k gold in AUD?”
Expected toolcalculate_metal_value
“Estimate a dealer buy quote for 50 troy ounces of silver at a 4% discount to melt value.”
Expected toolcalculate_dealer_quote
“Compare the current value per gram of 14k, 18k, 22k, and 24k gold in USD.”
Expected toolcompare_karat_values
“Analyze XAU/USD performance over the last 30 calendar days.”
Expected toolanalyze_metal_performance
“Value my holdings: 10 ounces of gold, 250 ounces of silver, and 5 ounces of platinum in USD.”
Expected toolvalue_metal_holdings
Credential priority and access checks
If both credentials are supplied, OAuth Bearer authentication takes priority. Each MCP request reloads the current GoldAPI user and verifies Free or Business plan access.
Authentication and access errors
401: no valid OAuth Bearer token or x-access-token API key was supplied.
403: the authenticated account is on a plan without MCP access, or a Free account has exhausted its shared monthly allowance.
429: the underlying GoldAPI per-second request rate was exceeded.
Reference
Data types
MetalSymbol
Precious metal symbol.
Values:XAUXAGXPTXPD
CurrencyCode
Supported quote currency. Availability can vary by metal; use /api/currencies and /api/metals for the current pair matrix.
Errors are returned as JSON with a suitable HTTP status code.
Error
Description
BadRequest
Invalid request parameters.
Unauthorized
Invalid or missing API key.
NotFound
Requested resource was not found.
TooManyRequests
Rate limit exceeded.
InternalServerError
Unexpected server error.
ServiceUnavailable
Current source data is unavailable or stale.
Forbidden
Missing or invalid API key, or monthly API quota exceeded.
WebSocketsDisabled
WebSocket functionality is disabled.
WebSocketUnauthorized
Invalid or unavailable dedicated WebSocket API key.
DashboardUnauthorized
Missing or invalid dashboard session JWT.
API throttling and rate limits
GoldAPI applies burst throttling independently by API key and source IP. Monthly allowances are separate from burst limits and depend on the account plan.
REST limits by plan
Plan
Monthly REST allowance
Burst limits
Free
150 shared REST and successful WebSocket-token requests per calendar month
5 requests/second per API key and 10 requests/second per source IP
Pro
Unlimited REST requests
5 requests/second per API key and 10 requests/second per source IP
Business
Unlimited REST requests
5 requests/second per API key and 10 requests/second per source IP
Per-key throttling
Each API key can make up to 5 requests per second. Exceeding this limit returns HTTP 429 with a JSON error response.
Per-IP throttling
Each source IP can make up to 10 requests per second across API keys. Exceeding this outer limit returns HTTP 429 and may use a plain-text response, so inspect Content-Type before parsing JSON.
Monthly allowance behavior
Pro and Business remove the monthly REST allowance but do not remove burst throttling. GET /api/stat does not consume or enforce the monthly allowance, although burst limits still apply. For Free accounts, each successfully issued WebSocket token consumes one request from the same monthly allowance as REST calls.
Throttling and quota responses
429 — Too Many Requests means a per-key or per-IP burst limit was exceeded. Pause before retrying.
403 — Forbidden with a monthly quota error means the Free allowance is exhausted until the next calendar-month reset. Do not automatically retry an unchanged request.
Recommended retry policy
Honor Retry-After when it is present. Otherwise use bounded exponential backoff with random jitter for 429 responses: begin at one second, double after each failed attempt, cap at 30 seconds, and stop after a small number of retries.
delay = min(30 seconds, 1 second × 2^attempt)
wait = random value between 50% and 100% of delay
retry: 429
do not retry unchanged: monthly-quota 403