Fin2Dev Blog / Financial API Guides / Gold Price API – Real-Time Gold Prices in JSON

Gold Price API – Real-Time Gold Prices in JSON

Gold price API showing XAU data and real-time JSON response
Gold Price API dashboard showing real-time XAU data, price chart, and JSON response for developers.

A gold price API provides structured access to real-time and historical gold price data, including spot prices, daily changes, and long-term trends. Gold (XAU) remains one of the most widely tracked commodities across global financial markets.

This guide explains how gold price data works, how it is structured in APIs, and how developers use it in trading systems, dashboards, and financial applications.

In practical applications, gold price data is used to monitor market movements, calculate portfolio exposure, build alerts, and support trading strategies based on commodity price fluctuations.


Typical XAU Data Structure

Gold price data is typically delivered as structured JSON objects, where each record represents a snapshot of the current or historical price.

A typical gold price response includes the following parameters:

  • commodity_name – commodity identifier (gold)
  • symbol – market symbol (XAU)
  • commodity_price – current price
  • price_change_day – daily price change
  • percentage_day – daily percentage change
  • datetime – timestamp of the price update

This structure allows developers to integrate gold price data into applications, compare price changes, and build real-time monitoring tools.


How Gold Price Data Is Used

Gold price data is widely used across financial systems and analytics platforms.

Trading Platforms

Gold is one of the most actively traded commodities. Real-time price data is used for order execution, charting, and automated trading strategies.

Portfolio Monitoring

Investment platforms use gold price data to track commodity exposure, hedge against inflation, and balance multi-asset portfolios.

Risk Management

Gold is often used as a safe-haven asset. Accurate price data helps measure risk and adjust positions during market volatility.

Financial Analytics

Historical gold price data is used for trend analysis, correlation studies, and macroeconomic research.


Example Gold Price Data Response

Below is an example of how gold price data may appear in JSON format.

{
  "commodity_name": "gold",
  "symbol": "XAU",
  "commodity_price": "2345.12",
  "price_change_day": "-12.45",
  "percentage_day": "-0.53%",
  "datetime": "2026-04-29T10:30:00"
}

Example Gold Data Request

To retrieve gold price data, you can send a simple API request:

https://apidata.fin2dev.com/v1/commodities?key=YOUR_API_KEY&commodity_name=gold

Example API Integration

The following examples show how developers can request gold price data using Python and PHP.

Python Example

import requests

url = "https://apidata.fin2dev.com/v1/commodities"
params = {"key":"YOUR_API_KEY","commodity_name":"gold"}

data = requests.get(url, params=params).json()

print(data["result"]["output"])

PHP Example

<?php

$url = "https://apidata.fin2dev.com/v1/commodities?key=YOUR_API_KEY&commodity_name=gold";

$response = file_get_contents($url);
$data = json_decode($response, true);

print_r($data["result"]["output"]);

?>

Live Gold Price Data Example

For example, the following JSON shows a compact gold price response using the output field from the API.

{
  "output": [
    {
      "commodity_name": "gold",
      "commodity_unit": "usd/t.oz",
      "commodity_price": "4662.57",
      "price_change_day": "-53.28",
      "percentage_day": "-1.13%",
      "percentage_week": "3.11%",
      "percentage_month": "-1.72%",
      "percentage_year": "44.09%",
      "datetime": "2026-05-11T10:46:00.000"
    }
  ]
}

Start Using Gold Price API

Gold Price API is included in all plans.
Gold is available through the Fin2Dev Commodity Prices API, together with Silver, Oil, Natural Gas, Copper, Lithium and more.

Start with a small plan for testing real-time and historical gold price data in JSON format.

Basic

Entry plan for testing and small projects
Intro offer
$9
  • Gold price data via API
  • 500 calls included
  • 10 calls per minute
Need more API calls? Compare all available plans on the pricing page.

Gold Market Data API vs Commodity Price API

A gold price API focuses specifically on gold (XAU), while a broader Commodity Price API provides access to multiple commodities including oil, silver, natural gas, and agricultural products.

For single-asset applications, a focused gold integration is sufficient. For multi-asset platforms, using a full commodity API is more efficient.


Related Commodity APIs

Gold price data is often used alongside other commodity APIs to build multi-asset trading systems, analytics platforms, and financial dashboards.


Frequently Asked Questions

What is the symbol for gold in APIs?

Gold is typically represented by the symbol XAU, which is widely used in commodity and financial data systems.

How often is gold price data updated?

Gold price data is usually updated every few minutes depending on the data source, with historical data refreshed periodically.

Can I use gold data API in real-time systems?

Yes, gold data API are commonly used in real-time applications such as trading platforms, dashboards, and alerting systems.


If you need access to multiple commodities including gold, oil, silver, and energy markets, you can use the full Commodity Price API.

Start Using Gold Price Data

Access real-time and historical gold price data via Fin2Dev APIs.

Explore Commodity Price API