Menu

Quickstart

Get a live XAU/USD price in a few minutes.

Before you begin

You need curl or any HTTP client, and a free API key. Sign up, confirm your email and copy the key from your account. Free includes 100 requests an hour.

Get a free key

Your first request

Send your key in the X-API-Key header. Keep it on your server, not in code that visitors can see.

curl --fail-with-body --max-time 10 "https://goldapi.dev/api/v1/price/XAU/USD" \  -H "X-API-Key: $API_KEY"

Reading the response

price is per the unit in the answer: a troy ounce, or a pound for copper. gram is the price of one gram at the karat in the answer, and updatedAt is when the answer was made.

Response 200

{
    "symbol": "XAU",
    "name": "Gold",
    "currency": "USD",
    "unit": "oz",
    "price": 4072.1,
    "gram": 130.921,
    "karat": 24,
    "updatedAt": "2026-11-07T01:58:16+02:00"
}

When things go wrong

Errors are JSON with an error field. The usual first ones are 401 api_key_required when the header is missing, 401 invalid_api_key when the key is wrong, and 403 email_not_verified until you confirm your email. Over the limit you get 429 rate_limit_exceeded with a Retry-After header.

Next steps