A gold buyer or pawn shop quotes scrap by melt value, which is the weight in grams times the market price per gram for that karat, then pays a percentage of it. The scrap gold price API call for that is GET /v1/carat. It returns the gram price for eight karats with no key, so the quote needs one request and one multiplication. The example below ran against the live API on 2 November 2026.
- Melt value is weight times the karat's gram price. The payout percentage is your policy and stays in your own data.
- Keep prices as
Decimalstrings and round once, at the end. - Dealer buyback prices from the
/v1/physicalendpoint, with a country code in the path, on Basic and above show what the market pays, which is a check on your own percentages.
Get the rates
curl "https://api.goldprice.dev/v1/carat?currency=USD"The response carries a timestamp and price_gram_24k down to price_gram_10k. The Free plan and keyless callers get prices 15 minutes late, and paid plans get live prices.
Quote the customer
The script fetches the rates once and prints the melt value and the offer for three items. The percentages are examples. Use your own by karat.
import jsonfrom decimal import Decimal, ROUND_HALF_UPfrom urllib.request import urlopenAPI = "https://api.goldprice.dev"cents = lambda d: d.quantize(Decimal("0.01"), rounding=ROUND_HALF_UP)with urlopen(f"{API}/v1/carat?currency=USD", timeout=10) as r: rates = json.load(r)PAYOUT = {"24": "0.95", "18": "0.85", "14": "0.75", "10": "0.65"} # the buyer's own policydef melt_value(karat, grams): return Decimal(grams) * Decimal(rates[f"price_gram_{karat}k"])def offer(karat, grams): return cents(melt_value(karat, grams) * Decimal(PAYOUT[karat]))print("Rates at", rates["timestamp"])for karat, grams in [("18", "7.4"), ("14", "12.0"), ("10", "3.1")]: print(f"{karat}K {grams:>5} g melt {cents(melt_value(karat, grams)):>8} offer {offer(karat, grams):>8} ({PAYOUT[karat]})")Run on 2 November 2026:
Rates at 2026-11-02T11:24:01.256873Z18K 7.4 g melt 696.27 offer 591.83 (0.85)14K 12.0 g melt 878.16 offer 658.62 (0.75)10K 3.1 g melt 162.04 offer 105.32 (0.65)For the 18K item, 7.4 g × 94.09 per gram is a melt value of 696.27, and the offer at 85% is 591.83.
What to put on the receipt
Print the weight, the karat you tested, the gram price, the percentage and the time of the rate. Hold the quote for the minutes your policy allows, and re-quote if the customer returns after the window. A shop that locks quotes should use a paid key, because the rate it locks is then live and not 15 minutes old.
Check your percentages against dealer buyback prices
On Basic and above, GET /v1/physical/ID returns dealer quotes with a sell price, a buyback price and the premium over spot. A 1 g Antam bar from the 2 November 2026 response:
{"brand":"Antam","product":"bar","denomination_grams":"1","price_basis":"per_bar","currency":"IDR","premium_over_spot_bps":1042,"sell":"2515000","buyback":"2400000"}The same response put spot at 2,277,632.59 rupiah per gram, so this dealer's buyback for a 1 g bar was about 5.4% above spot and the sell price about 10.4% above. Bars are not scrap, and the figures belong to one dealer in one country. They show how wide a dealer's own buy-sell gap is. Dealer quotes exist only for the countries in the /v1/physical index.
Edge cases
- Karat from your own test. Use the purity you measured. A mismatch of one karat changes the price by several percent.
- Stones and solder. When stones are set, weigh the gold without them.