DocsCommodities

Commodities

Indicative reference prices for precious and industrial metals, energy benchmarks, and agricultural contracts—normalized for dashboards, research tooling, and cross-asset displays. Not a claim about physical delivery, warehouse stocks, or venue-listed futures.

Commodity routes follow the same REST patterns as other asset classes where coverage is enabled for your key.

Authx-api-key headerBase path/commoditiesWebSocketcommodities.quotes · commodities.tradesSymbolsXAUUSD · WTIUSD

Overview

Commodity coverage is organized into three groups: metals, energy, and agriculture. Each symbol encodes a reference pair or contract-style identifier (typically against USD) suitable for application development, analytics, and indicative displays.

Data is consolidated and indicative—it may differ materially from any single venue or official settlement print. Use snapshots for a combined latest view, aggregates for historical context, and the quote endpoint for the latest consolidated bid/ask view when available.

Symbol groups

Metals

Precious and industrial metals vs USD.

XAUUSDXAGUSDXPTUSDXPDUSDCOPPERUSD

Energy

Oil and gas benchmarks.

WTIUSDBRENTUSDNGASUSD

Agriculture

Grains and softs. SUGARUSD values are cents per pound.

WHEATUSDCORNUSDSOYBEANUSDSUGARUSD
GET/commodities/quote/:symbol

Latest quote

Bid, ask, and consolidated price from the aggregated commodity quote view when present. Timestamps are Unix milliseconds.

ParameterTypeDescription
symbolreqstringEnabled commodity symbol (e.g. XAUUSD, WTIUSD). Trimmed and uppercased before lookup. Discover tickers with GET /commodities/symbols.
curl -sS "https://api.tickerlayer.com/commodities/quote/XAUUSD" \
  -H "x-api-key: <YOUR_API_KEY>"

Send runs against the live API with your account key (never exposed in the browser).

Response 200 OK

JSON
{
  "symbol": "XAUUSD",
  "price": 2318.42,
  "bid": 2318.10,
  "ask": 2318.74,
  "timestamp": 1743512400000
}
Energy example: GET /commodities/quote/WTIUSD returns the same keys with values scaled for the instrument—for example "price": 82.41, "bid": 82.38, "ask": 82.45. 404 unknown symbol when the symbol is not enabled for your key.
GET/commodities/trade/last/:symbol

Last trade

Most recent trade-like price for the symbol when present; otherwise a deterministic midpoint derived from the consolidated quote. Timestamps are Unix milliseconds.

ParameterTypeDescription
symbolreqstringEnabled commodity symbol (e.g. XAUUSD, WTIUSD). Trimmed and uppercased before lookup. Discover tickers with GET /commodities/symbols.
curl -sS "https://api.tickerlayer.com/commodities/trade/last/XAUUSD" \
  -H "x-api-key: <YOUR_API_KEY>"

Send runs against the live API with your account key (never exposed in the browser).

Response 200 OK

JSON
{
  "symbol": "XAUUSD",
  "price": 2318.42,
  "size": 42,
  "timestamp": 1743512400000
}
Energy example: GET /commodities/trade/last/WTIUSD returns the same keys with values scaled for the instrument. 404 unknown symbol when the symbol is not enabled for your key; 404 no fresh trade available when no quote can be resolved.
GET/commodities/snapshot/:symbol

Market snapshot

Combined bid/ask, last price, previous daily close, and derived change metrics in one normalized commodity snapshot.

ParameterTypeDescription
symbolreqstringEnabled commodity symbol (e.g. XAUUSD, WTIUSD). Trimmed and uppercased before lookup. Discover tickers with GET /commodities/symbols.
curl -sS "https://api.tickerlayer.com/commodities/snapshot/WTIUSD" \
  -H "x-api-key: <YOUR_API_KEY>"

Send runs against the live API with your account key (never exposed in the browser).

Response 200 OK

JSON
{
  "symbol": "WTIUSD",
  "bid": 71.22,
  "ask": 71.25,
  "bid_size": 58,
  "ask_size": 55,
  "last_price": 71.235,
  "last_timestamp": 1743512400000,
  "prev_close": 70.90,
  "change": 0.335,
  "change_percent": 0.472
}
last_size appears when a trade size is available in the consolidated snapshot; otherwise it is omitted from the payload. change_percent is null when prev_close is zero or unavailable. An all-null snapshot returns 404.
GET/commodities/agg/:symbol/:multiplier/:timespan/:from/:to

Aggregates — OHLCV range

Historical bars between two UTC calendar dates. Same interval rules and pagination as other asset classes.

ParameterTypeDescription
symbolreqstringEnabled commodity symbol (e.g. XAUUSD, CORNUSD). Trimmed and uppercased before lookup.
multiplierreqnumberInterval multiplier. Valid pairs: 1, 5, 15 with minute; 1, 4 with hour; 1 with day.
timespanreqstringminute · hour · day — case-insensitive. Other values return 400.
fromreqstringUTC date start, inclusive. Format: YYYY-MM-DD.
toreqstringUTC date end, inclusive. Format: YYYY-MM-DD. Must be ≥ from.
ParameterTypeDescription
limitnumberPage size. Default 500, max 5000.
offsetnumberZero-based row offset applied after sort. Default 0.
sortstringSort bars by timestamp t before pagination. asc or desc (default desc).
curl -sS "https://api.tickerlayer.com/commodities/agg/XAUUSD/1/day/2025-11-01/2025-11-30?sort=desc&limit=2" \
  -H "x-api-key: <YOUR_API_KEY>"

Response 200 OK

JSON
{
  "symbol": "XAUUSD",
  "results_count": 2,
  "results": [
    { "o": 2295.10, "h": 2325.40, "l": 2288.20, "c": 2318.42, "v": 0, "t": 1733011200000 },
    { "o": 2270.50, "h": 2305.00, "l": 2265.00, "c": 2295.10, "v": 0, "t": 1732924800000 }
  ],
  "next_offset": 2
}
  • Energy and agriculture bars use the same schema; volume may be 0 or null when not published for that interval.
  • Valid pairs: 1, 5, 15 / minute; 1, 4 / hour; 1 / day.
GET/commodities/agg/:symbol/prev

Previous completed daily bar

Single most-recently completed UTC daily candle for the symbol.

ParameterTypeDescription
symbolreqstringEnabled commodity symbol (e.g. XAUUSD, WTIUSD). Trimmed and uppercased before lookup. Discover tickers with GET /commodities/symbols.
ParameterTypeDescription
intervalstringOptional. 1m · 5m · 15m · 1h · 4h · 1d. Returns the most recently settled bar at that interval instead of the previous daily bar, and adds interval, bar_start, bar_end and as_of to the response. Omit for the daily bar.
curl -sS "https://api.tickerlayer.com/commodities/agg/XAUUSD/prev" \
  -H "x-api-key: <YOUR_API_KEY>"

Response 200 OK

JSON
{
  "symbol": "XAUUSD",
  "result": {
    "o": 2295.10,
    "h": 2325.40,
    "l": 2288.20,
    "c": 2318.42,
    "v": 0,
    "t": 1733011200000
  }
}
404 no bar available when the daily bar cannot be resolved yet. Pass ?interval= (1m, 5m, 15m, 1h, 4h, 1d) for the most recently settled bar at that interval instead; the response then also carries interval, bar_start, bar_end and as_of. While the market is closed the last real bar is returned, still labelled with its own bar_start.

WebSocket Streaming

Stream live quotes and trades for this asset class over the public WebSocket.

Connect
wss://stream.tickerlayer.com/?apiKey=<YOUR_API_KEY>

Available channels

Quotescommodities.quotesTradescommodities.trades

Subscribe example

After the connection is ready, send a JSON text frame:

Subscribe
{
  "action": "subscribe",
  "channels": [
    "commodities.quotes",
    "commodities.trades"
  ],
  "symbols": [
    "XAUUSD",
    "WTIUSD"
  ]
}

Example message

commodities.quotes
{
  "type": "quote",
  "channel": "commodities.quotes",
  "asset": "commodities",
  "symbol": "XAUUSD",
  "bid": 2318.1,
  "ask": 2318.74,
  "bid_size": 58,
  "ask_size": 48,
  "ts": 1743512400000,
  "timestamp": 1743512400000
}

General WebSocket documentation

For authentication, subscribe/unsubscribe lifecycle, errors, limits, and heartbeats, see the WebSocket overview and Subscriptions.