DocsDocs

Convert between metal and currency

GET /v1/convert: convert metal to currency by ounce, gram or kilogram

20 Oct 2026 · 1 min read

GET /v1/convert?from=XAU&to=INR&amount=10&unit=gram gives the value of 10 grams of gold in rupees. Convert metal to currency or currency to metal using ounces, grams or kilograms. A key is optional. Free and keyless prices are delayed by 15 minutes.

Make a request

Set from and to to a metal (XAU, XAG) or a currency. The unit parameter controls the metal unit, with troy ounces as the default.

Shell
curl "https://api.goldprice.dev/v1/convert?from=XAU&to=INR&amount=10&unit=gram" \  -H "Authorization: Bearer $GOLDPRICE_API_KEY"
JavaScript
const res = await fetch("https://api.goldprice.dev/v1/convert?from=XAU&to=INR&amount=10&unit=gram", {  headers: { Authorization: `Bearer ${process.env.GOLDPRICE_API_KEY}` },})const data = await res.json()if (!res.ok) throw new Error(data.error)
Python
import os, requestsres = requests.get(    "https://api.goldprice.dev/v1/convert?from=XAU&to=INR&amount=10&unit=gram",    headers={"Authorization": f"Bearer {os.environ['GOLDPRICE_API_KEY']}"},    timeout=10,)res.raise_for_status()data = res.json()

Request parameters

NameLocationRequiredDescription
fromqueryYesSource metal or currency
toqueryYesTarget metal or currency
amountqueryNo (1)Amount for conversion
unitqueryNo (oz)Metal unit: oz, gram or kg

Read the response

This example response was recorded without a key on 19 Oct 2026. rate retains full precision, while result is rounded.

Response example (19 Oct 2026)
{  "from": "XAU",  "to": "INR",  "amount": "10.0",  "rate": "12705.74376559729168283849219",  "result": "127057.44",  "unit": "gram",  "timestamp": "2026-10-19T12:45:06.720397Z"}
FieldDescription
from, toConversion source and target
amountSubmitted amount
rateFull-precision value of one unit
resultRounded conversion result
unitMetal unit used
timestampSpot price observation time (UTC)

API errors

StatuserrorCause
400unsupported_unitUnit must be oz, gram or kg
429rate_limitedKeyless IP exceeded 100 requests in the hour
429rate_limit_exceededMinute limit exceeded for the plan, or per IP without a key
429quota_exceededPlan's monthly request quota exceeded
Error response example
{  "error": "unsupported_unit",  "message": "Unsupported unit"}

Request and data limits

Free and keyless prices are delayed by 15 minutes. Without a key, you get 10 requests a minute per IP. A free key includes 5,000 requests a month. Paid plans provide live prices. See free plan limits for all plan limits.

Questions

How can I convert gold in grams to a currency?

Call /v1/convert?from=XAU&to=INR&amount=10&unit=gram. Read result for the value of 10 grams.

Can I convert a currency amount to gold?

Yes. Reverse the sides: /v1/convert?from=USD&to=XAU&amount=1000 returns the gold that $1,000 buys, in troy ounces unless you set unit.

Which units are supported?

oz is the default. You can also use gram or kg. Other units return 400 unsupported_unit.

Keep reading

Give /v1/convert requests their own quota

Use a free key to move this request off the shared per-IP limit.

Get a free key