Skip to documentation
API reference · OpenAPI 3.1.0

GoldAPI.io API Documentation

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

NameLocationTypeDescription
metalrequiredpathMetalSymbolPrecious metal symbol.
currencyrequiredpathCurrencyCodeCurrency code used to quote the metal price.
melt_pricequerybooleanInclude melt prices per gram by karat.
currency_infoquerybooleanInclude currency name and symbol information.
purityquerybooleanInclude purity ratios by karat.
arrayquerystringPresence 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/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

NameLocationTypeDescription
metalrequiredpathMetalSymbolPrecious metal symbol.
currencyrequiredpathCurrencyCodeCurrency code used to quote the metal price.
daterequiredpathDateInputHistorical date in preferred YYYY-MM-DD format. YYYYMMDD remains supported.
melt_pricequerybooleanInclude melt prices per gram by karat.
currency_infoquerybooleanInclude currency name and symbol information.
purityquerybooleanInclude purity ratios by karat.
arrayquerystringPresence 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/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

NameLocationTypeDescription
metalrequiredpathMetalSymbolPrecious metal symbol.
currencyrequiredpathCurrencyCodeCurrency code used to quote the metal price.
fromrequiredqueryDateInputInclusive range start in preferred YYYY-MM-DD format. YYYYMMDD remains supported.
torequiredqueryDateInputInclusive 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'

Example response

{
  "metal": "XAU",
  "currency": "USD",
  "from": "2025-01-01",
  "to": "2025-01-03",
  "prices": [
    {
      "date": "2025-01-02",
      "price": 2658.12
    },
    {
      "date": "2025-01-03",
      "price": 2640.45
    }
  ]
}

Responses

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/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

NameLocationTypeDescription
metalrequiredpathMetalSymbolPrecious metal symbol.
melt_pricequerybooleanInclude melt prices per gram by karat.
currency_infoquerybooleanInclude currency name and symbol information.
purityquerybooleanInclude purity ratios by karat.
arrayquerystringPresence 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.
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

NameLocationTypeDescription
baserequiredpathCurrencyCodeCurrency code to convert from.
quoterequiredpathCurrencyCodeCurrency 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'

Example response

{
  "timestamp": 1735689600,
  "base": "USD",
  "quote": "EUR",
  "exchange": "GAPI:USDEUR",
  "symbol": "GAPI:USDEUR",
  "price": 0.963245,
  "bid": 0.9631,
  "ask": 0.9634
}

Responses

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.
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

NameLocationTypeDescription
metalrequiredpathMetalSymbolPrecious metal symbol.
daterequiredpathDateInputHistorical 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'

Example response

{
  "timestamp": 1735689600000,
  "date": "2025-01-01",
  "metal": "XAU",
  "currency": "USD",
  "exchange": "LBMA",
  "am": 2624.5,
  "pm": 2627.25
}

Responses

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.
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'

Example response

{
  "requests_today": 125,
  "requests_yesterday": 98,
  "requests_month": 2437,
  "requests_last_month": 5184
}

Responses

200 Request usage totals.401 Invalid or missing API key.429 Rate limit exceeded.500 Unexpected server error.
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.
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'

Example response

{
  "token": "string",
  "tokenType": "Bearer",
  "expiresIn": 1735689600,
  "expiresAt": "2025-01-01T12:00:00.000Z",
  "websocketUrl": "wss://ws.goldapi.io/v1",
  "allowedChannels": [
    "string"
  ],
  "maxConnections": 1735689600,
  "maxChannelsPerConnection": 1735689600,
  "wsAuthUsage": {
    "used": 1735689600,
    "limit": 1735689600,
    "remaining": 1735689600,
    "resetsAt": "2025-01-01T12:00:00.000Z"
  }
}

Responses

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.

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.

Client sends
{
  "type": "auth",
  "token": "GOLD_WS_SESSION_TOKEN",
  "requestId": "xauusd-auth"
}
Server responds
{
  "type": "authenticated",
  "requestId": "xauusd-auth",
  "allowedChannels": [
    "metals:*",
    "fx:*"
  ],
  "maxConnections": 1,
  "maxChannelsPerConnection": 10,
  "expiresAt": "2026-10-22T12:15:00.000Z"
}

3. Subscribe to XAUUSD

Subscribe only after the authenticated response is received.

Client sends
{
  "type": "subscribe",
  "channels": [
    "metals:XAUUSD"
  ],
  "requestId": "xauusd-subscribe"
}
Server responds
{
  "type": "subscribed",
  "requestId": "xauusd-subscribe",
  "channels": [
    "metals:XAUUSD"
  ]
}

4. Maintain the heartbeat

Send an application ping every 25 seconds and match the pong by requestId. The timestamp is a whole-second Unix timestamp.

Client sends
{
  "type": "ping",
  "requestId": "xauusd-ping-1"
}
Server responds
{
  "type": "pong",
  "requestId": "xauusd-ping-1",
  "timestamp": 1792651200
}

5. Process XAUUSD updates

Each update identifies its subscribed channel and contains the normalized REST-compatible metal price in data.

Server responds
{
  "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
  }
}

6. Process protocol errors

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.

Server responds
{
  "type": "error",
  "channel": "metals:XAUUSD",
  "code": "PRICE_UNAVAILABLE",
  "message": "No valid cached quote available."
}
Error handling

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 ws
const WebSocket = require('ws');

const wsApiKey = "GOLD_WS_API_KEY";
const channels = ["metals:XAUUSD"];
let heartbeatTimer;

function startHeartbeat(socket) {
  const ping = () => {
    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);
}

async function getWebSocketSession() {
  const response = await fetch('https://www.goldapi.io/api/ws/token', {
    method: 'POST',
    headers: {
      'x-ws-api-key': wsApiKey
    }
  });
  const session = await response.json();

  if (!response.ok) {
    throw new Error(session.error || 'Token request failed');
  }
  return session;
}

async function connect() {
  const session = await getWebSocketSession();
  const socket = new WebSocket(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.

Remote endpointhttps://mcp.goldapi.io/mcpTransport: Streamable HTTP

Authentication and client configuration

OAuth (recommended)

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.

{
  "mcpServers": {
    "goldapi": {
      "url": "https://mcp.goldapi.io/mcp"
    }
  }
}

API key header

For controlled server-side clients, send your GoldAPI key in the x-access-token header. Store the value in an environment variable or secret manager.

{
  "mcpServers": {
    "goldapi": {
      "url": "https://mcp.goldapi.io/mcp",
      "headers": {
        "x-access-token": "${GOLDAPI_API_KEY}"
      }
    }
  }
}

Available tools

ToolDescriptionGoldAPI request cost
get_current_metal_priceReturn the current GoldAPI price for a supported metal and currency.1 price request
get_historical_metal_priceReturn the GoldAPI price for one historical calendar date.1 price request
get_metal_price_historyReturn ordered daily prices for an inclusive range of up to 90 days.1 history request
get_currency_rateReturn a current currency conversion rate with bid and ask values.1 rates request
convert_currencyConvert an amount using the current GoldAPI currency rate.1 rates request
get_lbma_benchmarkReturn an LBMA benchmark for a supported metal and date.1 LBMA request
convert_metal_weightConvert precious-metal weight between nine supported units.No price request
calculate_metal_valueCalculate live or historical melt value by weight and purity.1 price request
calculate_dealer_quoteCreate a nonbinding dealer buy or sell estimate from melt value.1 price request
compare_karat_valuesCompare common karat values using one GoldAPI price.1 price request
analyze_metal_performanceCalculate descriptive statistics for a history range without forecasting.1 history request
value_metal_holdingsValue 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.

Values: AEDARSAUDBDTBGNBHDBOBBRLBTCCADCHFCLPCNYCOPCZKDKKDOPDZDEGPEURFJDGBPGHSGTQHKDIDRILSINRIQDIRRISKJODJPYKESKHRKRWKWDLAKLBPLKRMADMMKMXNMYRNGNNOKNPRNZDOMRPENPHPPKRPLNPYGQARRONRUBSARSEKSGDSYPTHBTRYTWDUAHUSDUYUUZSVNDXAGYERZAR

DateInput

A calendar date. YYYY-MM-DD is preferred; YYYYMMDD is accepted for backward compatibility.

LivePriceResponse

Normalized live precious metal spot price response. Primary numeric values are rounded to four decimal places.

PropertyTypeDescription
timestamprequiredinteger or nullWhole-second Unix timestamp for the returned price.
datetimerequiredstring or nullISO 8601 datetime derived from timestamp.
metalrequiredMetalSymbol—
currencyrequiredCurrencyCode—
exchangerequiredstring or nullExchange or data-source identifier.
symbolrequiredstring or nullSource market symbol. Null when the provider does not supply one.
open_timerequiredinteger or nullWhole-second Unix timestamp for the session open time.
open_pricerequirednumber or nullSession open price.
prev_close_pricerequirednumber or nullPrevious close price.
low_pricerequirednumber or nullSession low price.
high_pricerequirednumber or nullSession high price.
pricerequirednumber or nullLatest spot price per troy ounce.
unitrequiredstringAlways troy_ounce.
changerequirednumber or nullAbsolute price change.
change_percentrequirednumber or nullPercentage price change.
askrequirednumber or nullCurrent ask price.
bidrequirednumber or nullCurrent bid price.
spreadrequiredValueAndPercentage—
rangerequiredValueAndPercentage—
price_per_unitrequiredPricePerUnit or null—
melt_price_per_gramMeltPricePerGram—
purityPurityRatios—
currency_infoCurrencyInfo—

HistoricalPriceResponse

Normalized historical precious metal price response. The requested date is represented by timestamp and datetime.

Extends LivePriceResponse

HistoricalPricePoint

PropertyTypeDescription
daterequiredstringPrice date normalized to YYYY-MM-DD.
pricerequirednumberDaily metal price in the requested currency.

MetalHistoryResponse

PropertyTypeDescription
metalrequiredMetalSymbol—
currencyrequiredCurrencyCode—
fromrequiredstringNormalized inclusive range start.
torequiredstringNormalized inclusive range end.
pricesrequiredarray<HistoricalPricePoint>Ordered daily prices. Missing dates are omitted.

RateResponse

PropertyTypeDescription
timestamprequiredintegerUnix timestamp in seconds for the oldest source quote used.
baserequiredCurrencyCode—
quoterequiredCurrencyCode—
exchangerequiredstringGoldAPI rate identifier.
symbolrequiredstringGoldAPI rate symbol.
pricerequirednumberConversion rate from base to quote.
bidrequirednumber—
askrequirednumber—

LbmaResponse

PropertyTypeDescription
timestamprequiredintegerUnix timestamp in milliseconds for the stored LBMA history record.
daterequiredstring—
metalrequiredMetalSymbol—
currencyrequiredstringAlways USD.
exchangerequiredstringAlways LBMA.
amnumber or nullAM fixing for gold, platinum, or palladium.
pmnumber or nullPM fixing for gold, platinum, or palladium.
pricenumber or nullSingle daily silver benchmark price.

RequestStatisticsResponse

PropertyTypeDescription
requests_todayrequiredintegerRequests made today.
requests_yesterdayrequiredintegerRequests made yesterday.
requests_monthrequiredintegerRequests made during the current calendar month.
requests_last_monthrequiredintegerRequests made during the previous calendar month.

StatusResponse

API status or account/request information response.

PropertyTypeDescription
resultbooleanWhether the status check succeeded.

ErrorResponse

Error response.

PropertyTypeDescription
errorstringError name or category.
messagestringHuman-readable error message.
statusCodeintegerHTTP status code.

ValueAndPercentage

PropertyTypeDescription
valuerequirednumber—
percentagerequirednumber—

PricePerUnit

PropertyTypeDescription
troy_ouncerequirednumber—
avoirdupois_ouncerequirednumber—
gramrequirednumber—
kilogramrequirednumber—
grainrequirednumber—
pennyweightrequirednumber—
tolarequirednumber—
taelrequirednumber—
bahtrequirednumber—

MeltPricePerGram

Melt prices per gram keyed by karat.

PropertyTypeDescription
24krequirednumber—
23krequirednumber—
22krequirednumber—
21krequirednumber—
20krequirednumber—
18krequirednumber—
16krequirednumber—
14krequirednumber—
12krequirednumber—
10krequirednumber—
9krequirednumber—
8krequirednumber—

PurityRatios

Purity ratios keyed by karat.

PropertyTypeDescription
24knumber—
23knumber—
22knumber—
21knumber—
20knumber—
18knumber—
16knumber—
14knumber—
12knumber—
10knumber—
9knumber—
8knumber—

CurrencyInfo

PropertyTypeDescription
coderequiredstring—
namerequiredstring—
symbolrequiredstring—

PriceArrayResponse

PropertyTypeDescription
resultsrequiredarray<LivePriceResponse>—

WebSocketAuthUsage

PropertyTypeDescription
usedrequiredinteger or null—
limitrequiredintegerConfigured monthly request limit, or -1 for a paid plan with unlimited REST requests.
remainingrequiredinteger or null—
resetsAtrequiredstring or null—

WebSocketAllowance

PropertyTypeDescription
idrequiredstring—
activerequiredboolean—
wsApiKeyrequiredstringDedicated WebSocket API key. Treat this value as a credential.
defaultChannelsrequiredarray<string>—
allowedChannelsrequiredarray<string>—
effectiveChannelsrequiredarray<string>—
tokenTtlSecondsrequiredinteger—
maxConnectionsrequiredinteger—
maxChannelsPerConnectionrequiredinteger—
allowanceVersionrequiredinteger—
wsKeyVersionrequiredinteger—
keyCreatedAtstring or null—
keyRotatedAtstring or null—
lastTokenIssuedAtstring or null—
lastConnectionAtstring or null—
createdAtstring or null—
updatedAtstring or null—
wsAuthUsagerequiredWebSocketAuthUsage—

WebSocketAllowanceProvisionResponse

PropertyTypeDescription
allowancerequiredWebSocketAllowance—
createdrequiredboolean—

WebSocketTokenResponse

PropertyTypeDescription
tokenrequiredstringShort-lived WebSocket JWT.
tokenTyperequiredstringAlways Bearer.
expiresInrequiredinteger—
expiresAtrequiredstring—
websocketUrlrequiredstring—
allowedChannelsrequiredarray<string>—
maxConnectionsrequiredinteger—
maxChannelsPerConnectionrequiredinteger—
wsAuthUsagerequiredWebSocketAuthUsage—

WebSocketPriceUpdate

PropertyTypeDescription
typerequiredstringAlways price.update.
channelrequiredstring—
publishedAtrequiredintegerWhole-second server publication time.
datarequiredLivePriceResponse or RateResponse—

WebSocketProtocolError

PropertyTypeDescription
typerequiredstringAlways error.
channelstring—
coderequiredstring—
messagerequiredstring—

Errors

Errors are returned as JSON with a suitable HTTP status code.

ErrorDescription
BadRequestInvalid request parameters.
UnauthorizedInvalid or missing API key.
NotFoundRequested resource was not found.
TooManyRequestsRate limit exceeded.
InternalServerErrorUnexpected server error.
ServiceUnavailableCurrent source data is unavailable or stale.
ForbiddenMissing or invalid API key, or monthly API quota exceeded.
WebSocketsDisabledWebSocket functionality is disabled.
WebSocketUnauthorizedInvalid or unavailable dedicated WebSocket API key.
DashboardUnauthorizedMissing 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

PlanMonthly REST allowanceBurst limits
Free150 shared REST and successful WebSocket-token requests per calendar month5 requests/second per API key and 10 requests/second per source IP
ProUnlimited REST requests5 requests/second per API key and 10 requests/second per source IP
BusinessUnlimited REST requests5 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

Additional resources

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