API Reference

Documentation

Everything you need to integrate with Chand.API. Three GET endpoints expose live‑scraped Iranian currency, gold coin, and bullion rates as structured JSON. No keys, no auth, no signup.

CORS enabled 60s cache No auth required Free with attribution

Quick start

Every endpoint is a plain GET request that returns application/json. The relative paths below resolve against the base URL .

cURL
curl -s /api
curl -s /api/fiat
curl -s /api/fiat/usd
curl -s /api/usd
JavaScript
const res = await fetch("/api");

if (!res.ok) {
  throw new Error(`Chand.API returned ${res.status}`);
}

const data = await res.json();

console.log(data.updated);         // "August 14, 2025 09:30"
console.log(data.updated_iso);     // "2025-08-14T09:30Z"
console.log(data.now_iso);         // "2026-10-12T18:48:36Z"
console.log(data.fiat.USD.sell);   // 92500
console.log(data.gold.azadi.sell); // 54320000
Python
import requests

res = requests.get("/api", timeout=10)
res.raise_for_status()
data = res.json()

print(data["fiat"]["USD"]["sell"])
print(data["gold"]["emami"]["sell"])
Values are in Iranian Toman. All prices are returned as plain numbers with no separators or currency symbols — for example 92500 means 92,500 Toman — small currencies may include decimals.

Endpoints

All three endpoints scrape the same upstream feed and differ only in how they shape the response. Pick the schema that matches your integration.

Endpoint Status Response shape
/api Recommended { sell, buy, icon } objects with SVG icons
/legacy Supported Objects for fiat & coins, scalars for bullion
/deprecated Deprecated Scalars only, no icon assets
New integrations should use /api. /legacy and /deprecated exist only for older clients and may be removed in a future major version.
GET

/api

Recommended

The primary endpoint. Returns every currency bonbast quotes, plus gold coins and bullion as { sell, buy, icon } objects, a crypto and market entry, and Telegram Stars & Premium prices scraped from Fragment.

200 OK · response (truncated)
{
  "_comment": "Chand.API v1.1.0 — Homepage:  — Cache: 60s — Free to use with attribution.",
  "success": true,
  "updated": "August 14, 2025 09:30",
"updated_iso": "2025-08-14T09:30Z",
  "now": "October 12, 2026 18:48:36",
  "now_iso": "2026-10-12T18:48:36Z",
  "fiat": {
    "USD": {
      "en": "US Dollar",
      "fa": "دلار آمریکا",
      "sell": 92500,
      "buy": 92100,
      "icon": "https://raw.githubusercontent.com/.../flags/us.svg"
    },
    "GEL": {
      "en": "Georgian Lari",
      "fa": "لاری گرجستان",
      "sell": 32000,
      "buy": 32000,
      "icon": "https://raw.githubusercontent.com/.../flags/ge.svg"
    }
  },
  "gold": {
    "azadi": {
      "en": "Azadi Gold Coin",
      "fa": "سکه بهار آزادی",
      "sell": 54320000,
      "buy": 54100000,
      "icon": "https://platform.tgju.org/files/images/gold-1697963734.png"
    },
    "gram18": {
      "en": "18k Gold per Gram",
      "fa": "طلای ۱۸ عیار",
      "sell": 7460000,
      "icon": "https://platform.tgju.org/files/images/gold-bar-1-1622253841.png"
    }
  },
  "crypto": {
    "bitcoin": {
      "en": "Bitcoin",
      "fa": "بیت‌کوین",
      "sell": 6421000000000,
      "icon": "https://alanchand.com/assets/img/crypto/BTC.svg"
    }
  },
  "market": {
    "bourse": {
      "en": "Tehran Stock Exchange (TEDPIX)",
      "fa": "شاخص کل بورس تهران",
      "sell": 2105000,
      "icon": "https://static.tgju.org/images/no-icon.png"
    }
  },
  "telegram": {
    "stars": { "en": "Telegram Stars", "fa": "استارز تلگرام", "usd": 0.015, "ton": 0.0108918, "toman": 1388 },
    "premium": {
      "en": "Telegram Premium",
      "fa": "تلگرام پرمیوم",
      "months": {
        "3":  { "stars": 800,  "ton": 8.7,   "usd": 11.99, "toman": 1109075 },
        "6":  { "stars": 1066, "ton": 11.6,  "usd": 15.99, "toman": 1479075 },
        "12": { "stars": 1933, "ton": 21.04, "usd": 28.99, "toman": 2681575 }
      }
    }
  }
}
GET

/legacy

Supported

Backward‑compatible schema. Fiat currencies and gold coins keep their sell/buy/icon objects, but gram18, mithqal, ounce, bitcoin, and bourse are returned as raw scalars instead of objects. Includes the same telegram section as /api.

200 OK · response (truncated)
{
  "_comment": "Chand.API v1.1.0 — Homepage:  — Cache: 60s — Free to use with attribution.",
  "success": true,
  "updated": "August 14, 2025 09:30",
  "updated_iso": "2025-08-14T09:30Z",
  "now": "October 12, 2026 18:48:36",
  "now_iso": "2026-10-12T18:48:36Z",
  "fiat": {
    "USD": { "sell": 92500, "buy": 92100, "icon": "https://.../us.svg" }
  },
  "gold": {
    "azadi":  { "sell": 54320000, "buy": 54100000, "icon": "https://.../gold.png" },
    "gram18": 7460000,
    "mithqal": 32000000,
    "ounce": 2105000
  },
  "crypto": { "bitcoin": 6421000000000 },
  "market": { "bourse": 2105000 },
  "telegram": {
    "stars": { "en": "Telegram Stars", "fa": "استارز تلگرام", "usd": 0.015, "ton": 0.0108918, "toman": 1388 },
    "premium": {
      "en": "Telegram Premium",
      "fa": "تلگرام پرمیوم",
      "months": {
        "3":  { "stars": 800,  "ton": 8.7,   "usd": 11.99, "toman": 1109075 },
        "6":  { "stars": 1066, "ton": 11.6,  "usd": 15.99, "toman": 1479075 },
        "12": { "stars": 1933, "ton": 21.04, "usd": 28.99, "toman": 2681575 }
      }
    }
  }
}
GET

/deprecated

Deprecated

The original minimal schema. Every value is a scalar and no icon fields are emitted at all, which keeps payloads small for older clients that never rendered flags or coin artwork. Includes the same telegram section as /api.

200 OK · response (truncated)
{
  "_comment": "Chand.API v1.1.0 — Homepage:  — Cache: 60s — Free to use with attribution.",
  "success": true,
  "updated": "August 14, 2025 09:30",
  "updated_iso": "2025-08-14T09:30Z",
  "now": "October 12, 2026 18:48:36",
  "now_iso": "2026-10-12T18:48:36Z",
  "fiat": {
    "USD": { "sell": 92500, "buy": 92100 }
  },
  "gold": {
    "azadi":   { "sell": 54320000, "buy": 54100000 },
    "gram18":  7460000,
    "mithqal": 32000000,
    "ounce":   2105000
  },
  "crypto": { "bitcoin": 6421000000000 },
  "market": { "bourse": 2105000 },
  "telegram": {
    "stars": { "en": "Telegram Stars", "fa": "استارز تلگرام", "usd": 0.015, "ton": 0.0108918, "toman": 1388 },
    "premium": {
      "en": "Telegram Premium",
      "fa": "تلگرام پرمیوم",
      "months": {
        "3":  { "stars": 800,  "ton": 8.7,   "usd": 11.99, "toman": 1109075 },
        "6":  { "stars": 1066, "ton": 11.6,  "usd": 15.99, "toman": 1479075 },
        "12": { "stars": 1933, "ton": 21.04, "usd": 28.99, "toman": 2681575 }
      }
    }
  }
}
GET

/api/fiat/usd

Narrowed

Every endpoint can be narrowed down. Add a section to get just that group, or a section and a key to get a single entry. Names are case‑insensitive, and the timestamp envelope is always kept, so the same parser works at every level.

Route Returns
/api Everything
/api/fiat One section (fiat, gold, crypto, market, telegram)
/api/fiat/usd One currency
/api/usd Shorthand for /api/fiat/usd
/api/gold/azadi One coin or bullion entry
/api/telegram/stars One Telegram entry

These work identically under /legacy and /deprecated. An unknown section or key returns 404 — JSON for curl and bots, the HTML page for browsers.

200 OK · /api/fiat/usd
{
  "_comment": "Chand.API v1.1.0 — Homepage:  — Cache: 60s — Free to use with attribution.",
  "success": true,
  "updated": "August 14, 2025 09:30",
  "updated_iso": "2025-08-14T09:30Z",
  "now": "October 12, 2026 18:48:36",
  "now_iso": "2026-10-12T18:48:36Z",
  "fiat": {
    "USD": {
      "en": "US Dollar",
      "fa": "دلار آمریکا",
      "sell": 92500,
      "buy": 92100,
      "icon": "https://raw.githubusercontent.com/.../flags/us.svg"
    }
  }
}

Response schema

Top‑level fields returned by /api. Object schemas below use TypeScript notation.

Field Type Description
_comment string Always the first key. Site information, source attribution, and cache notice.
success boolean true on success, false on failure.
updated string Upstream last‑modified time as "Month DD, YYYY HH:MM" in UTC. Empty string if unavailable.
updated_iso string Same instant as updated as "YYYY-MM-DDTHH:MMZ" in UTC. Empty string if unavailable.
now string When this response was generated, as "Month DD, YYYY HH:MM:SS" in UTC.
now_iso string Same instant as now as "YYYY-MM-DDTHH:MM:SSZ" in UTC.
fiat object Map of ISO currency code → rate object with localized en/fa names. Only codes present upstream are included.
gold object Gold coins plus bullion entries (gram18, mithqal, ounce).
crypto object Cryptocurrency rates. Currently exposes bitcoin.
market object Tehran Stock Exchange data. Currently exposes bourse (TEDPIX).
telegram object Telegram Stars and Premium prices scraped from fragment.com, /api only: stars carries the per‑star usd, ton, and toman rate; premium.months is keyed by duration ("3", "6", "12") with stars (USD ÷ per‑star rate, rounded up), ton, usd, and toman. toman derives from the live fiat.USD rate. The whole key is omitted when Fragment is unreachable.

Rate object

Fiat and gold‑coin entries share the same shape. Bullion, crypto, and market entries expose sell and icon only.

TypeScript
interface Rate {
  en?: string;   // English name, e.g. "US Dollar"
  fa?: string;   // Persian name, e.g. "دلار آمریکا"
  sell: number;   // selling price, Iranian Toman
  buy: number;    // buying price (fiat & coins only; falls back to `sell`)
  icon?: string;  // absolute URL — omitted on /deprecated
}

Gold entries

Key Type Description
azadi Rate Full Azadi gold coin (بهار آزادی).
emami Rate Emami gold coin (سکه امامی).
halfAzadi Rate Half Azadi coin (نیم سکه).
quarterAzadi Rate Quarter Azadi coin (ربع سکه).
gerami Rate One‑gram gold coin (سکه گرمی).
gram18 Rate 18‑karat gold per gram (طلای ۱۸ عیار).
mithqal Rate Gold mithqal (مثقال طلا).
ounce Rate Global gold ounce (انس طلا).
Keys are omitted entirely when the upstream feed has no value for them. Always guard with a check such as data.gold.ounce?.sell rather than assuming presence.

Currency codes

Every currency bonbast publishes is exposed under fiat, keyed by its standard ISO 4217 code — so data.fiat.EUR.sell works as‑is. The 28 main-table currencies below carry bonbast's own buy and sell quotes; every other code (GEL, HRK, ZAR, KRW, PLN, EGP, … — roughly 75 in total) comes from bonbast's converter and sets buy equal to sell.

Code Currency Code Currency
USD US Dollar AED UAE Dirham
EUR Euro JPY Japanese Yen
GBP British Pound TRY Turkish Lira
CHF Swiss Franc CNY Chinese Yuan
CAD Canadian Dollar SAR Saudi Riyal
AUD Australian Dollar INR Indian Rupee
SEK Swedish Krona MYR Malaysian Ringgit
NOK Norwegian Krone AFN Afghan Afghani
RUB Russian Ruble KWD Kuwaiti Dinar
THB Thai Baht IQD Iraqi Dinar
SGD Singapore Dollar BHD Bahraini Dinar
HKD Hong Kong Dollar OMR Omani Rial
AZN Azerbaijani Manat QAR Qatari Riyal
AMD Armenian Dram DKK Danish Krone
On /api and /legacy each fiat entry carries an icon URL pointing to an SVG circle flag. On /deprecated the icon field is absent.

Headers & caching

Every JSON response — including error responses — sends the following headers.

Header Value Notes
Content-Type application/json; charset=utf-8 Always UTF‑8 JSON.
Cache-Control public, max-age=60, s-maxage=60 Responses are cached for 60 seconds at the browser and edge.
Access-Control-Allow-Origin * CORS is fully open — call it from any origin, including the browser.
Access-Control-Expose-Headers Link Lets browser clients read the Link header.
Link </favicon.svg>; rel="icon"; type="image/svg+xml" Declares the site icon for responses that have no <head>.
Data refreshes every 60 seconds. The upstream feed is scraped on demand and the result is cached at the edge, so polling more often than once a minute returns identical data. Polling once per minute is plenty.

Errors

Errors keep the same envelope as success responses: the site comment is still present, but success is false and an error message is included. Always branch on success and the HTTP status.

502 Bad Gateway
{
  "_comment": "Chand.API v1.1.0 — Homepage:  — Cache: 60s — Free to use with attribution.",
  "success": false,
  "error": "Homepage returned status 522"
}
Status Meaning What to do
200 Success. Body contains success: true with rates. Read the payload.
404 Unknown section or entry on a narrowed route, such as /api/zzz or /api/gold/nope. Use a key from Narrowed routes. Browsers get the HTML page; curl and bots get JSON.
502 Upstream scrape failed — the source site was unreachable or returned no usable token. Retry with backoff; treat as a transient outage.
Recommended client handling
async function getRates() {
  const res = await fetch("/api");
  const data = await res.json();

  if (!res.ok || !data.success) {
    throw new Error(data.error || `Request failed (${res.status})`);
  }

  return data;
}

Notes

What does _comment do?

JSON has no comment syntax, so site information is delivered as a reserved _comment key that is always the first entry in the object. It is safe to ignore; if you map over the response, skip keys beginning with an underscore.

Where does the data come from?

Rates are scraped live from bonbast.com and re‑shaped into a stable schema. If the upstream feed is unavailable the API returns 502 rather than stale or empty data.

Which currency are prices in?

All values are Iranian Toman, returned as integers. There are no decimal places and no separators.

Can I use this in production?

Yes — the API is free to use with attribution to Chand.API. There is no key, no quota, and no registration. Please respect the 60‑second cache and avoid high‑frequency polling.

Where do the icons come from?

Flags are served as SVG circle flags, gold and bullion icons come from TGJU, and the Bitcoin icon from AlanChand. Icon URLs are absolute, so hot‑linking them works directly.

Ready to integrate?

Start with the recommended endpoint — it has everything.