Access token
Sent with every request in the Authorization header as Bearer TOKEN. Tokens are issued manually after a conversation.
One clear API, request the price whenever you want, or receive it the instant it changes over the live stream, and every price arrives with its explicit state and within a stable data contract.
Tokens are issued after a conversation that understands your need, not by self-signup, governed by scopes and rate limits. You get a token with only the permissions you need.
A single call to the API returns the latest price for the metals in the currency you choose within a stable contract, with the gold karats and the state of each price.
Before you build a decision on the price, check the state attached to it, live, market closed, or stale. That way you never adopt a dead price.
Every request carries an access token in the Authorization header. Some endpoints require an additional permission scope.
Sent with every request in the Authorization header as Bearer TOKEN. Tokens are issued manually after a conversation.
Each token carries its own scopes, base prices are always available, while daily statistics and live streaming each need a dedicated scope.
Your token is allowed more than one request per second, and every successful response carries headers telling you your limit and how much of the current window remains.
default
Live prices with their state and karats, plus metals, currencies, status and your token details. Available to every token.
daily_stats
Today statistics, open, high, low, close and change, plus the /daily-stats endpoint.
instant_change
The instant rate of change for each metal, attached to its price inside /prices.
live_stream
Authentication for the real-time streaming channel over WebSocket.
Read these headers to pace your requests without overrunning, and build your retry logic with confidence.
X-RateLimit-Limit
The maximum requests your token is allowed in the window.
X-RateLimit-Remaining
What remains for you in the current window.
X-RateLimit-Window
The length of the window, its value is one second.
Retry-After
Appears with a 429 when you overrun, the number of seconds before you retry.
Try the response shape before your tokens are issued. Send the literal token test and the response arrives in its full shape with all numeric values zeroed, so you build your integration on the real structure without live data.
https://barqmetal.com/api/v1
Every request needs an access token. Endpoints marked with a scope require an additional permission.
/prices
Live prices for the metals, in the requested currency, with state and karats.
default
/daily-stats
Today statistics for each metal.
daily_stats
/metals
The list of available metals and their symbols.
default
/currencies
The supported currencies and their exchange rates.
default
/status
The current service status and last update.
default
/token
Your token details, its scopes, limits and usage.
default
/websocket/auth
Authentication for the real-time streaming channel.
live_stream
/websocket/info
Connection details for the live stream and its event shape.
default
A fixed shape for every response. Any change is coordinated with consuming systems in advance, so your integration never breaks suddenly.
This is a base response. With the instant_change scope an instant-change field is added to each metal, and with the daily_stats scope a today-statistics field. See the endpoint reference below for every field by type.
Per-gram prices arrive with four decimals, per-ounce and karat prices with two. The values in the example are illustrative, so read the precision from the field reference, not from the example.
When you request a single metal via symbol, the data field returns a single object, not an array. Without symbol it returns an array of every metal.
{
"success": true,
"currency": "SAR",
"request_time": "2026-08-14T11:42:05.417+03:00",
"system": { "is_running": true, "last_update": "2026-08-14T11:42:05.417+03:00", "server_time": "2026-08-14T11:42:05.417+03:00" },
"data": [
{
"metal": { "id": 1, "symbol": "XAU", "name_ar": "الذهب", "name_en": "Gold" },
"state": "live",
"prices": {
"buy_per_ounce": 12545.60,
"sell_per_ounce": 12551.20,
"buy_per_gram": 403.20,
"sell_per_gram": 403.50,
"fetched_at": "2026-08-14T11:42:05.417+03:00",
"last_success_at": "2026-08-14T11:42:07.912+03:00",
"price_changed_at": "2026-08-14T11:40:11.005+03:00"
},
"karats": {
"24": { "sell_per_gram": 403.50 },
"22": { "sell_per_gram": 369.88 },
"21": { "sell_per_gram": 353.06 },
"18": { "sell_per_gram": 302.63 }
}
}
]
}
Each endpoint with its params and response fields by type and meaning, so you integrate against this page alone, no conversation needed.
/prices
Live prices for the metals with state and karats.
symbol
string
A single metal symbol to filter the result, e.g. XAU. Letters and digits up to ten. With no value all metals are returned.
currency
string
The currency code, letters up to ten. Defaults to USD, and an unsupported currency returns in USD.
include_daily_stats
0 or 1
Include today statistics for each metal. Enabled unless you send 0.
currency
string
The resolved currency for this response.
request_time
string
The moment the request was processed, ISO8601.
system.is_running
bool
Whether the feed is live now.
system.last_update
string
The moment of the feed last update, ISO8601 with millisecond precision.
system.server_time
string
The live system clock, advancing every second even when the source dries up, ISO8601 with millisecond precision.
data[].metal
object
The metal, its id, symbol and name in Arabic and English.
data[].state
string
The price state, one of live, market_closed or stale.
data[].prices.buy_per_ounce
number
Buy price per ounce, two decimals.
data[].prices.sell_per_ounce
number
Sell price per ounce, two decimals.
data[].prices.buy_per_gram
number
Buy price per gram, four decimals.
data[].prices.sell_per_gram
number
Sell price per gram, four decimals.
data[].prices.fetched_at
string
The moment of the last accepted fetch for this price (the freshness gate), ISO8601 with millisecond precision.
data[].prices.last_success_at
string
The moment of the last successful fetch even when the value was rejected, ISO8601 with millisecond precision.
data[].prices.price_changed_at
string
The moment of the last real price change, ISO8601 with millisecond precision, null before the first change.
data[].karats
object
Per-karat sell price per gram for 24, 22, 21 and 18, two decimals, gold only.
data[].instant_change
object
The instant change, buy and sell amount and percent with an up, down or stable direction.instant_change
data[].daily_stats
object
Today statistics for this metal, open, high, low, close, change, range and update count.daily_stats
/daily-stats
Today statistics for each metal.
symbol
string
Filter by a single metal, e.g. XAU.
currency
string
The currency code, defaults to USD.
currency
string
The resolved currency.
date
string
The statistics day, year-month-day.
data[].metal
object
The metal, its id, symbol and Arabic name.
data[].sell
object
The sell statistics, open, high, low, close, change and percent.
data[].buy
object
The buy statistics, with the same fields.
data[].direction
string
The day direction, up, down or stable.
data[].range
number
The day range, the difference between high and low.
data[].update_count
int
The number of updates recorded today.
/metals
The available metals and their symbols.
count
int
The number of metals.
data[].symbol
string
The metal symbol, e.g. XAU.
data[].name_ar
string
The Arabic name.
data[].name_en
string
The English name.
data[].gram_per_base_unit
number
Grams in the base measurement unit.
/currencies
The supported currencies and their exchange rates.
base_currency
string
The base currency, always the US Dollar.
data[].code
string
The currency code, e.g. SAR.
data[].symbol
string
The display symbol.
data[].exchange_rate
number
How many units of this currency equal one US Dollar.
data[].is_default
bool
Whether it is the default currency.
/status
The current service status and last update.
data.is_running
bool
Whether the feed is live now.
data.last_update
string
The moment of the last update.
/token
Your token details, its scopes, limits and usage.
data.abilities
array
The scopes, each with its name and whether it is granted to your token.
data.rate_limit
object
Your limit, requests per second and its label.
data.usage
object
Your usage, total requests and last use.
data.expires_at
string
The token expiry if any.
/websocket/info
Connection details for the live stream and its event shape.
data.connection
object
The server details, host, port, key and scheme.
data.auth
object
The auth endpoint, its method, headers and params.
data.channels
array
The channels, their events and the event data shape.
/websocket/auth
Authenticate the private live-stream channel.
socket_id
string
The connection id, your stream client gives it to you automatically. Required.
channel_name
string
The private channel name to subscribe to. Required.
auth
string
The auth signature your stream client passes to the channel.
Every error returns one fixed shape, a status code and an object explaining the cause, so your system builds its retry logic with confidence.
{
"success": false,
"error": "...",
"status": 404,
"request_time": "2026-08-14T11:42:05+03:00"
}
An errors field is attached with a 422 only, carrying the details of the invalid param. And with a 429 you may receive a Retry-After header telling you when to retry.
Instead of repeated polling, subscribe once and every update reaches you at the same instant. Two steps, authenticate the channel, then connect.
Copy and start. Replace TOKEN with your access token.
curl -H "Authorization: Bearer TOKEN" \
"https://barqmetal.com/api/v1/prices?currency=SAR"
const res = await fetch(
"https://barqmetal.com/api/v1/prices?currency=SAR",
{ headers: { Authorization: "Bearer TOKEN" } }
);
const { data } = await res.json();
console.log(data[0].state, data[0].prices.sell_per_gram);
// npm install pusher-js
// GET /websocket/info returns host, port, key, scheme and the channel name
import Pusher from "pusher-js";
const pusher = new Pusher("YOUR_APP_KEY", {
wsHost: "YOUR_HOST",
wsPort: YOUR_PORT,
forceTLS: false,
enabledTransports: ["ws", "wss"],
authEndpoint: "https://barqmetal.com/api/v1/websocket/auth",
auth: { headers: { Authorization: "Bearer TOKEN" } }
});
// the client POSTs socket_id + channel_name to the auth endpoint for you
const channel = pusher.subscribe("private-prices");
channel.bind("price.updated", (p) => {
console.log(p.metal.symbol, p.prices.sell_per_gram, p.state);
});
Choose an endpoint and press Run for a live response straight from the API, alongside a ready cURL command and JavaScript code to copy.
A real live call. With no token the demo mode is used, the same response shape with zeroed values. With your token you get the real values.
The documentation is complete in front of you, the endpoints with their params, fields and errors. No self-signup today, tell us about your system and your need and we will arrange the right access with the scopes you require.