Endpoints
GET https://usgoldpricepergram.com/history.json
Both are plain static files (no server-side compute, no authentication) served the same way as any other page on this site — fetch them directly from client-side JS or a server.
gold-data.json — Current Price Snapshot
Overwritten on every update — always represents the latest known values, not a history.
| Field | Type | Description |
|---|---|---|
lastUpdated | string (ISO 8601) | Timestamp of the gold spot price currently shown. |
fxLastUpdated | string (ISO 8601) | Timestamp of the GBP→USD rate currently in use. |
isFallback | boolean | true if either the gold spot price or the FX rate is stale (upstream fetch failed this run). |
fallbackComponent | string | null | "gold", "fx", "both", or null — which component (if any) is stale. |
spotPricePerOzGBP | number | Spot price per troy oz, GBP. |
fxRateGBPtoUSD | number | GBP→USD rate in use. |
pricePerGram | object | USD price per gram, keyed "24k"/"22k"/"18k"/"14k"/"10k". |
cashPricePerGram | object | pricePerGram × the site's cash-for-gold discount factor, same keys. |
dayChange | object | null | Per-karat {abs, pct} change vs. ~24h ago (null if no data point fell in the 20-30h lookback window). Keyed same as pricePerGram. |
note | string | null | Human-readable explanation when isFallback is true. |
history.json — Time Series
A flat JSON array, oldest first, one entry per successful update (stale/fallback runs are never appended — see the price history page). Capped at the most recent 3,000 points (roughly 2.5 years at 3×/day).
| Field | Type | Description |
|---|---|---|
t | string (ISO 8601) | Timestamp of this data point. |
spotGBP | number | Spot price per troy oz, GBP (source feed currency, kept for provenance). |
fx | number | GBP→USD rate used at this point. |
g24k | number | 24K price per gram, USD. |
g22k | number | 22K price per gram, USD. |
g18k | number | 18K price per gram, USD. |
g14k | number | 14K price per gram, USD. |
g10k | number | 10K price per gram, USD. |
Update Cadence
Both files refresh on the same cron schedule as the rest of the site: 0 6,12,18 * * * (three times a day). This text is pulled directly from the site's own config at generation time, so it can't drift out of sync with the actual schedule.
License & Usage
Free to use, no API key, no signup, no rate limit beyond normal static-file hosting. Attribution with a link back to usgoldpricepergram.com is appreciated but not required. No uptime SLA — this is a static file on GitHub Pages, not a monitored production API. This is not a dealer quote or a regulated price feed; see the methodology page for the full calculation and its limitations.
Example
.then(r => r.json())
.then(data => console.log(data.pricePerGram['24k']));