Hi, नमस्ते, 你好, مرحبا     GoldAPI.io WebSockets

Stream Real-Time Metal Prices and FX Rates with GoldAPI.io WS

Connect once and receive structured gold, silver, platinum, palladium, and foreign-exchange price updates without repeatedly polling the REST API.

Show All 72 Currencies →🇦🇪 AED, 🇦🇷 ARS, 🇦🇺 AUD, 🇧🇩 BDT, 🇧🇬 BGN, 🇧🇭 BHD, 🇧🇴 BOB, 🇧🇷 BRL, ₿ BTC, 🇨🇦 CAD, 🇨🇭 CHF, 🇨🇱 CLP, 🇨🇳 CNY, 🇨🇴 COP, 🇨🇿 CZK, 🇩🇰 DKK, 🇩🇴 DOP, 🇩🇿 DZD, 🇪🇬 EGP, 🇪🇺 EUR, 🇫🇯 FJD, 🇬🇧 GBP, 🇬🇭 GHS, 🇬🇹 GTQ, 🇭🇰 HKD, 🇮🇩 IDR, 🇮🇱 ILS, 🇮🇳 INR, 🇮🇶 IQD, 🇮🇷 IRR, 🇮🇸 ISK, 🇯🇴 JOD, 🇯🇵 JPY, 🇰🇪 KES, 🇰🇭 KHR, 🇰🇷 KRW, 🇰🇼 KWD, 🇱🇦 LAK, 🇱🇧 LBP, 🇱🇰 LKR, 🇲🇦 MAD, 🇲🇲 MMK, 🇲🇽 MXN, 🇲🇾 MYR, 🇳🇬 NGN, 🇳🇴 NOK, 🇳🇵 NPR, 🇳🇿 NZD, 🇴🇲 OMR, 🇵🇪 PEN, 🇵🇭 PHP, 🇵🇰 PKR, 🇵🇱 PLN, 🇵🇾 PYG, 🇶🇦 QAR, 🇷🇴 RON, 🇷🇺 RUB, 🇸🇦 SAR, 🇸🇪 SEK, 🇸🇬 SGD, 🇸🇾 SYP, 🇹🇭 THB, 🇹🇷 TRY, 🇹🇼 TWD, 🇺🇦 UAH, 🇺🇸 USD, 🇺🇾 UYU, 🇺🇿 UZS, 🇻🇳 VND, Ag XAG, 🇾🇪 YER, 🇿🇦 ZAR
Real-time WebSocket endpointwss://ws.goldapi.io/v1

Free Plan evaluation included · Unlimited access with Business Plan

WebSocket Output

Latest WebSocket messages.

Inspect the latest 10 messages, newest first. Select a message to view its complete JSON.

connection.closecode 1000 · GoldAPI.io WS Token expired
{
"type":
"connection.close"
"payload":{
"code":
1000
"reason":
"GoldAPI.io WS Token expired"
"intentional":
true
}
"receivedAt":
"2026-11-06T08:05:18.000Z"
}
price.updatefx:USDEUR
{
"type":
"price.update"
"channel":
"fx:USDEUR"
"payload":{
"type":
"price.update"
"channel":
"fx:USDEUR"
"publishedAt":
1793951105
"data":{
"timestamp":
1793951105
"base":
"USD"
"quote":
"EUR"
"rate":
0.8674
"bid":
0.8673
"ask":
0.8675
}
}
"receivedAt":
"2026-11-06T08:05:16.000Z"
}
price.updatemetals:XAGUSD · price 50.06
{
"type":
"price.update"
"channel":
"metals:XAGUSD"
"payload":{
"type":
"price.update"
"channel":
"metals:XAGUSD"
"publishedAt":
1793951103
"data":{
"timestamp":
1793951103
"datetime":
"2026-11-06T08:05:03.000Z"
"metal":
"XAG"
"currency":
"USD"
"exchange":
"FOREXCOM"
"symbol":
"FOREXCOM:XAGUSD"
"price":
50.06
"bid":
50.02
"ask":
50.1
"change":
0.31
"change_percent":
0.62
"unit":
"troy_ounce"
}
}
"receivedAt":
"2026-11-06T08:05:14.000Z"
}
price.updatemetals:XAUUSD · price 4175.12
{
"type":
"price.update"
"channel":
"metals:XAUUSD"
"payload":{
"type":
"price.update"
"channel":
"metals:XAUUSD"
"publishedAt":
1792651200
"data":{
"timestamp":
1792651200
"datetime":
"2026-10-22T06:40:00.000Z"
"metal":
"XAU"
"currency":
"USD"
"exchange":
"FOREXCOM"
"symbol":
"FOREXCOM:XAUUSD"
"open_time":
1792627200
"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":
0.71
"range":
24.115
}
}
"receivedAt":
"2026-11-06T08:05:12.000Z"
}
pongrequest prices-ping-1793951100000
{
"type":
"pong"
"payload":{
"type":
"pong"
"requestId":
"prices-ping-1793951100000"
"timestamp":
1793951100
}
"receivedAt":
"2026-11-06T08:05:10.000Z"
}
pingrequest prices-ping-1793951100000
{
"type":
"ping"
"payload":{
"type":
"ping"
"requestId":
"prices-ping-1793951100000"
}
"receivedAt":
"2026-11-06T08:05:08.000Z"
}
subscribedmetals:XAUUSD · request prices-subscribe · metals:XAUUSD, metals:XAGUSD, fx:USDEUR
{
"type":
"subscribed"
"channel":
"metals:XAUUSD"
"payload":{
"type":
"subscribed"
"requestId":
"prices-subscribe"
"channels":[
0
:
"metals:XAUUSD"
1
:
"metals:XAGUSD"
2
:
"fx:USDEUR"
]
}
"receivedAt":
"2026-11-06T08:05:06.000Z"
}
authenticatedrequest prices-auth
{
"type":
"authenticated"
"payload":{
"type":
"authenticated"
"requestId":
"prices-auth"
"allowedChannels":[
0
:
"metals:*"
1
:
"fx:*"
]
"maxConnections":
5
"maxChannelsPerConnection":
20
"expiresAt":
"2026-11-06T08:15:00.000Z"
}
"receivedAt":
"2026-11-06T08:05:04.000Z"
}
welcomeNo additional details
{
"type":
"welcome"
"payload":{
"type":
"welcome"
"protocolVersion":
1
}
"receivedAt":
"2026-11-06T08:05:02.000Z"
}
connection.openNo additional details
{
"type":
"connection.open"
"payload":{
"url":
"wss://ws.goldapi.io/v1"
"protocol":
"GoldAPI WebSocket JSON protocol"
}
"receivedAt":
"2026-11-06T08:05:00.000Z"
}
Live GoldAPI.io Metal Prices Experience

Gold Market Moves. Your Screen Stays Updated.

Use one persistent GoldAPI.io WebSockets connection to deliver current precious-metals and FX data wherever users expect prices to update automatically.

Live precious-metal price chart

Live metal price widgets

Display continuously updated gold and silver prices on websites, customer portals, and mobile applications.

metals:XAUUSD · metals:XAGUSD
Bullion dealer dashboard

Bullion dealer dashboards

Keep buy, sell, and inventory screens synchronized with current spot, bid, and ask data.

Pricing and inventory workflows
Trading and market monitor

Trading and market monitors

Power real-time watchlists, charts, alerts, and internal market-data tools without REST polling loops.

Push-based market updates
Currency exchange pricing

Currency-aware pricing

Combine precious-metal and FX channels for localized prices and multi-currency customer experiences.

metals:XAGEUR · fx:USDEUR
Jewelry and precious-metal refining

Jewelry and refining tools

Feed current market prices into valuation, melt-value, and operational workflows.

XAU · XAG · XPT · XPD
Precious-metal investment portfolio

Portfolio applications

Update precious-metal holdings and market values as normalized prices are published.

REST-compatible data models
Connect in Four Steps

Integrate with GoldAPI.io WebSockets in 30 Seconds

GoldAPI.io separates the long-lived WebSocket credential from short-lived connection tokens, keeping credentials out of URLs and WebSocket messages for max security.

01

Get your WebSocket API key

Sign in to the GoldAPI dashboard and copy your dedicated WebSocket API key. It is separate from your REST API key.

02

Request a short-lived token

Exchange the dedicated key from a trusted backend. The response includes a 15-minute token, WebSocket URL, permitted channels, and limits.

POST https://www.goldapi.io/api/ws/token
x-ws-api-key: YOUR_GOLDAPI_WEBSOCKET_KEY
Token endpoint reference →
03

Connect and authenticate

Open wss://ws.goldapi.io/v1, then authenticate before subscribing. requestId correlates each command with its response.

{
  "type": "auth",
  "token": "YOUR_SHORT_LIVED_WS_TOKEN",
  "requestId": "prices-auth"
}
04

Subscribe to price channels

After the authenticated response, subscribe to one or more concrete metal or FX channels.

{
  "type": "subscribe",
  "channels": [
    "metals:XAUUSD",
    "metals:XAGUSD",
    "fx:USDEUR"
  ],
  "requestId": "prices-subscribe"
}
Keep the dedicated WebSocket key server-side. Browser and mobile clients should receive only a short-lived connection token from your backend.
Precious Metals and Foreign Exchange

Get Only Prices You Need

Stream Gold, Silver, Platinum, and Palladium prices in any of 72 supported currencies, plus every supported FX-rate combination. Simply choose the exact metal and currency pairs your application needs.

Example channels

metals:XAUUSDGold priced in US dollars
metals:XAGEURSilver priced in euros
metals:XPTUSDPlatinum priced in US dollars
metals:XPDAUDPalladium priced in Australian dollars
fx:USDEURUS dollar to euro
fx:GBPAUDBritish pound to Australian dollar
Price update message
{
  "type": "price.update",
  "channel": "metals:XAUUSD",
  "publishedAt": 1792651200,
  "data": {
    "timestamp": 1792651200,
    "datetime": "2026-10-22T06:40:00.000Z",
    "metal": "XAU",
    "currency": "USD",
    "exchange": "FOREXCOM",
    "symbol": "FOREXCOM:XAUUSD",
    "open_time": 1792627200,
    "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": 0.71,
    "range": 24.115
  }
}

The normalized payload includes timestamps, exchange and symbol information, open and previous-close prices, daily high and low, spread, and trading range.

GoldAPI.io ws client

GoldAPI.io WebSockets Node.js Client Example

Build real-time price update workflows for your business. Request a secure session, subscribe to the markets you need, and start processing normalized, REST API compatible GoldAPI.io price updates.Read the WebSocket docs →

Node.js
// Node.js 18+ · npm install ws
const WebSocket = require('ws');

async function connect() {
  const response = await fetch('https://www.goldapi.io/api/ws/token', {
    method: 'POST',
    headers: { 'x-ws-api-key': process.env.GOLDAPI_WS_API_KEY }
  });
  if (!response.ok) throw new Error('Unable to issue WebSocket token');

  const session = await response.json();
  const socket = new WebSocket(session.websocketUrl);

  socket.on('open', () => socket.send(JSON.stringify({
    type: 'auth', token: session.token, requestId: 'prices-auth'
  })));

  socket.on('message', raw => {
    const message = JSON.parse(raw.toString());
    if (message.type === 'authenticated') {
      socket.send(JSON.stringify({
        type: 'subscribe',
        channels: ['metals:XAUUSD', 'metals:XAGUSD'],
        requestId: 'prices-subscribe'
      }));
    }
    if (message.type === 'price.update') console.log(message);
    if (message.type === 'error') console.error(message.code, message.message);
  });

  const heartbeat = setInterval(() => {
    if (socket.readyState === WebSocket.OPEN) socket.send(JSON.stringify({
      type: 'ping', requestId: 'ping-' + Date.now()
    }));
  }, 25000);
  socket.on('close', () => clearInterval(heartbeat));
}

connect().catch(console.error);
Simple, Worry-free, Flat Pricing With No Surprises

Start Today and Test for Free

No card required. Upgrade to Pro for unlimited REST or Business for unlimited REST, WebSockets, and MCP Server access. 30-day money-back guarantee.

Real-Time Gold & Silver Prices JSON API
Get Started

Free Plan

Free
API RequestsUp to 150/month
MetalsXAU, XAG, XPT, XPD
Currencies72 incl. USD, EUR, INR, AED, KWD, QAR, IDR🇦🇪 AED, 🇦🇷 ARS, 🇦🇺 AUD, 🇧🇩 BDT, 🇧🇬 BGN, 🇧🇭 BHD, 🇧🇴 BOB, 🇧🇷 BRL, ₿ BTC, 🇨🇦 CAD, 🇨🇭 CHF, 🇨🇱 CLP, 🇨🇳 CNY, 🇨🇴 COP, 🇨🇿 CZK, 🇩🇰 DKK, 🇩🇴 DOP, 🇩🇿 DZD, 🇪🇬 EGP, 🇪🇺 EUR, 🇫🇯 FJD, 🇬🇧 GBP, 🇬🇭 GHS, 🇬🇹 GTQ, 🇭🇰 HKD, 🇮🇩 IDR, 🇮🇱 ILS, 🇮🇳 INR, 🇮🇶 IQD, 🇮🇷 IRR, 🇮🇸 ISK, 🇯🇴 JOD, 🇯🇵 JPY, 🇰🇪 KES, 🇰🇭 KHR, 🇰🇷 KRW, 🇰🇼 KWD, 🇱🇦 LAK, 🇱🇧 LBP, 🇱🇰 LKR, 🇲🇦 MAD, 🇲🇲 MMK, 🇲🇽 MXN, 🇲🇾 MYR, 🇳🇬 NGN, 🇳🇴 NOK, 🇳🇵 NPR, 🇳🇿 NZD, 🇴🇲 OMR, 🇵🇪 PEN, 🇵🇭 PHP, 🇵🇰 PKR, 🇵🇱 PLN, 🇵🇾 PYG, 🇶🇦 QAR, 🇷🇴 RON, 🇷🇺 RUB, 🇸🇦 SAR, 🇸🇪 SEK, 🇸🇬 SGD, 🇸🇾 SYP, 🇹🇭 THB, 🇹🇷 TRY, 🇹🇼 TWD, 🇺🇦 UAH, 🇺🇸 USD, 🇺🇾 UYU, 🇺🇿 UZS, 🇻🇳 VND, Ag XAG, 🇾🇪 YER, 🇿🇦 ZAR
Karats24k, 22k, 21k, 20k, 18k, 16k, 14k, 10k
HistoricalDaily prices
Updates2 sec interval
WebSockets1 connection, 10 channels
MCP ServerOAuth + API key
SupportLimited
Historical & Real-Time Gold & Silver Prices RESTful API
Unlimited REST

Pro Plan

$99USD / month
API RequestsUnlimited/month
MetalsXAU, XAG, XPT, XPD
Currencies72 incl. USD, EUR, INR, AED, KWD, QAR, IDR🇦🇪 AED, 🇦🇷 ARS, 🇦🇺 AUD, 🇧🇩 BDT, 🇧🇬 BGN, 🇧🇭 BHD, 🇧🇴 BOB, 🇧🇷 BRL, ₿ BTC, 🇨🇦 CAD, 🇨🇭 CHF, 🇨🇱 CLP, 🇨🇳 CNY, 🇨🇴 COP, 🇨🇿 CZK, 🇩🇰 DKK, 🇩🇴 DOP, 🇩🇿 DZD, 🇪🇬 EGP, 🇪🇺 EUR, 🇫🇯 FJD, 🇬🇧 GBP, 🇬🇭 GHS, 🇬🇹 GTQ, 🇭🇰 HKD, 🇮🇩 IDR, 🇮🇱 ILS, 🇮🇳 INR, 🇮🇶 IQD, 🇮🇷 IRR, 🇮🇸 ISK, 🇯🇴 JOD, 🇯🇵 JPY, 🇰🇪 KES, 🇰🇭 KHR, 🇰🇷 KRW, 🇰🇼 KWD, 🇱🇦 LAK, 🇱🇧 LBP, 🇱🇰 LKR, 🇲🇦 MAD, 🇲🇲 MMK, 🇲🇽 MXN, 🇲🇾 MYR, 🇳🇬 NGN, 🇳🇴 NOK, 🇳🇵 NPR, 🇳🇿 NZD, 🇴🇲 OMR, 🇵🇪 PEN, 🇵🇭 PHP, 🇵🇰 PKR, 🇵🇱 PLN, 🇵🇾 PYG, 🇶🇦 QAR, 🇷🇴 RON, 🇷🇺 RUB, 🇸🇦 SAR, 🇸🇪 SEK, 🇸🇬 SGD, 🇸🇾 SYP, 🇹🇭 THB, 🇹🇷 TRY, 🇹🇼 TWD, 🇺🇦 UAH, 🇺🇸 USD, 🇺🇾 UYU, 🇺🇿 UZS, 🇻🇳 VND, Ag XAG, 🇾🇪 YER, 🇿🇦 ZAR
Karats24k, 22k, 21k, 20k, 18k, 16k, 14k, 10k
HistoricalDaily prices
UpdatesReal-time
WebSocketsNot included
MCP ServerNot included
SupportStandard
Free usage: issuing a WebSocket token counts as one shared monthly request. Connections and price-update messages do not increment the monthly request count.

GoldAPI.io WebSocket API FAQ

Channels, authentication, connection lifecycle, plans, and request accounting.

What is the GoldAPI WebSocket API?

The GoldAPI WebSocket API provides a persistent, push-based connection for receiving real-time precious-metals and foreign-exchange price updates without repeatedly polling REST endpoints.

Which precious metals are supported?

GoldAPI supports gold (XAU), silver (XAG), platinum (XPT), and palladium (XPD) across supported quote currencies.

Which channels can I subscribe to?

Precious-metal channels use the metals: prefix, such as metals:XAUUSD. Foreign-exchange channels use the fx: prefix, such as fx:USDEUR. Your connection token identifies the channel families available to your account.

Can I subscribe to metals:* directly?

No. Wildcards describe the channel families your token is permitted to access. Clients subscribe to concrete channels such as metals:XAUUSD or metals:XAGEUR.

Is the WebSocket API key the same as my REST API key?

No. WebSocket access uses a dedicated WebSocket API key available in the GoldAPI dashboard. Keep it in a trusted backend or secret manager and exchange it for a short-lived WebSocket token.

How long does a WebSocket token last?

A WebSocket connection token currently lasts 15 minutes. When it expires, request a fresh token and reconnect.

Does every WebSocket price update count as an API request?

No. For Free accounts, successfully issuing a WebSocket token counts as one shared monthly request. Establishing the connection and receiving market-data messages do not increment that monthly request count.

Which plans include WebSocket access?

Free includes WebSocket evaluation with one connection and up to 10 channels. Business includes production access with up to five concurrent connections and 20 channels per connection. Pro does not include WebSocket access.

What happens when a token expires?

The server sends a TOKEN_EXPIRED error and closes the connection with code 4001. Request a new token and establish a fresh connection.

Can I rotate my WebSocket API key?

Yes. The old key immediately stops issuing new tokens, while connections using an existing short-lived token remain active until that token expires.

GoldAPI is a Free Gold Prices API and Silver Prices RESTful JSON API. 100% Real-Time Live Feed of Precious Metals Spot Prices.
© 2020-2026, GoldAPI.io