Utilize this API to Get Historical
Utilize this API to Get Historical Prices for XAU (Gold)
In today's fast-paced financial landscape, having access to real-time and historical data is crucial for developers and businesses alike. The Metals-API provides a robust solution for retrieving comprehensive metals data, including historical prices for various metals such as XAU (Gold). This blog post will delve into the capabilities of the Metals-API, focusing on how developers can leverage this powerful tool to access historical prices and enhance their applications.
Metals-API Information
API Description
The Metals-API is a powerful JSON API that offers real-time and historical data for various metals, including Gold, Silver, Platinum, and Palladium. With its innovative design, the API empowers developers to build next-generation applications that require accurate and timely metals data. The API's capabilities extend beyond mere data retrieval; it enables developers to create sophisticated financial tools, market analysis platforms, and trading applications that can respond to market changes in real-time.
One of the standout features of the Metals-API is its ability to provide historical rates dating back to 2019, allowing users to analyze trends and make informed decisions based on past performance. This feature is particularly beneficial for financial analysts, traders, and businesses involved in the metals market.
Key Features and Endpoints
The Metals-API offers a variety of endpoints that cater to different data needs. Here are some of the key features:
- Latest Rates Endpoint: Depending on your subscription plan, this endpoint returns real-time exchange rate data updated every 60 minutes, every 10 minutes, or even more frequently. This is essential for applications that require the most current pricing information.
- Historical Rates Endpoint: This endpoint allows users to access historical rates for most currencies dating back to 2019. By appending a specific date to the API request, developers can retrieve historical prices for XAU and other metals.
- Bid And Ask Endpoint: This feature enables users to retrieve real-time Bid and Ask prices, which are crucial for traders looking to make informed buying and selling decisions.
- Convert Endpoint: The API includes a currency conversion endpoint, allowing users to convert any amount from one metal to another or to/from USD, facilitating seamless transactions.
- Time-Series Endpoint: This endpoint allows users to query the API for daily historical rates between two dates of their choice, making it easier to analyze trends over specific periods.
- Fluctuation Endpoint: Users can track how currencies fluctuate on a day-to-day basis, providing insights into market volatility.
- Carat Endpoint: This feature allows users to retrieve information about Gold rates by Carat, which is particularly useful for jewelers and gold traders.
- Lowest/Highest Price Endpoint: This endpoint enables users to query the API to get the lowest and highest price for a specified date, aiding in market analysis.
- Open/High/Low/Close (OHLC) Price Endpoint: Users can access OHLC data for a specific time period, which is vital for technical analysis.
- Historical LME Endpoint: This endpoint provides access to historical rates for LME symbols dating back to 2008, allowing for comprehensive market analysis.
- API Key: Each user is assigned a unique API key that must be included in API requests to authenticate and authorize access.
- API Response: The API delivers exchange rates relative to USD by default, ensuring consistency in data interpretation.
- Available Endpoints: The Metals-API offers 14 different endpoints, each providing unique functionalities tailored to various user needs.
- Supported Symbols Endpoint: This endpoint returns a constantly updated list of all available currencies, ensuring users have access to the latest information.
- News Endpoint: Users can retrieve the latest news articles related to various metals, keeping them informed about market trends and developments.
List of Symbols
The Metals-API provides access to a comprehensive range of metal symbols. For a complete list of all supported symbols and their specifications, refer to the Metals-API Supported Symbols page. This resource is invaluable for developers looking to integrate specific metals into their applications.
API Endpoint Examples and Responses
Latest Rates Endpoint
The Latest Rates Endpoint provides real-time exchange rates for all available metals. Here’s an example response:
{
"success": true,
"timestamp": 1770250530,
"base": "USD",
"date": "2026-02-05",
"rates": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912,
"XPD": 0.000744,
"XCU": 0.294118,
"XAL": 0.434783,
"XNI": 0.142857,
"XZN": 0.344828
},
"unit": "per troy ounce"
}
In this response, the "rates" object contains the current exchange rates for various metals relative to USD. The "unit" indicates that these rates are measured per troy ounce.
Historical Rates Endpoint
The Historical Rates Endpoint allows users to access historical exchange rates for any date since 1999. Here’s an example response:
{
"success": true,
"timestamp": 1770164130,
"base": "USD",
"date": "2026-02-04",
"rates": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915,
"XPD": 0.000748
},
"unit": "per troy ounce"
}
This response provides historical rates for XAU and other metals, allowing developers to analyze past market performance.
Time-Series Endpoint
The Time-Series Endpoint enables users to get exchange rates for a specific time period. Here’s an example response:
{
"success": true,
"timeseries": true,
"start_date": "2026-01-29",
"end_date": "2026-02-05",
"base": "USD",
"rates": {
"2026-01-29": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915
},
"2026-01-31": {
"XAU": 0.000483,
"XAG": 0.0382,
"XPT": 0.000913
},
"2026-02-05": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912
}
},
"unit": "per troy ounce"
}
This endpoint is particularly useful for analyzing trends over time, as it provides daily rates for the specified period.
Convert Endpoint
The Convert Endpoint allows users to convert any amount from one metal to another or to/from USD. Here’s an example response:
{
"success": true,
"query": {
"from": "USD",
"to": "XAU",
"amount": 1000
},
"info": {
"timestamp": 1770250530,
"rate": 0.000482
},
"result": 0.482,
"unit": "troy ounces"
}
This response shows the conversion of 1000 USD to Gold (XAU), providing both the conversion rate and the result in troy ounces.
Fluctuation Endpoint
The Fluctuation Endpoint tracks rate fluctuations between two dates. Here’s an example response:
{
"success": true,
"fluctuation": true,
"start_date": "2026-01-29",
"end_date": "2026-02-05",
"base": "USD",
"rates": {
"XAU": {
"start_rate": 0.000485,
"end_rate": 0.000482,
"change": -3.0e-6,
"change_pct": -0.62
},
"XAG": {
"start_rate": 0.03825,
"end_rate": 0.03815,
"change": -0.0001,
"change_pct": -0.26
},
"XPT": {
"start_rate": 0.000915,
"end_rate": 0.000912,
"change": -3.0e-6,
"change_pct": -0.33
}
},
"unit": "per troy ounce"
}
This endpoint provides insights into how the rates for XAU and other metals have changed over the specified period, which is vital for traders and analysts.
OHLC (Open/High/Low/Close) Price Endpoint
The OHLC Price Endpoint provides open, high, low, and close prices for a specific time period. Here’s an example response:
{
"success": true,
"timestamp": 1770250530,
"base": "USD",
"date": "2026-02-05",
"rates": {
"XAU": {
"open": 0.000485,
"high": 0.000487,
"low": 0.000481,
"close": 0.000482
},
"XAG": {
"open": 0.03825,
"high": 0.0383,
"low": 0.0381,
"close": 0.03815
},
"XPT": {
"open": 0.000915,
"high": 0.000918,
"low": 0.00091,
"close": 0.000912
}
},
"unit": "per troy ounce"
}
This data is essential for technical analysis, allowing traders to assess market trends and make informed decisions.
Bid/Ask Endpoint
The Bid/Ask Endpoint provides current bid and ask prices for metals. Here’s an example response:
{
"success": true,
"timestamp": 1770250530,
"base": "USD",
"date": "2026-02-05",
"rates": {
"XAU": {
"bid": 0.000481,
"ask": 0.000483,
"spread": 2.0e-6
},
"XAG": {
"bid": 0.0381,
"ask": 0.0382,
"spread": 0.0001
},
"XPT": {
"bid": 0.000911,
"ask": 0.000913,
"spread": 2.0e-6
}
},
"unit": "per troy ounce"
}
This endpoint is crucial for traders who need to know the current market prices for buying and selling metals.
Conclusion
The Metals-API is an invaluable resource for developers looking to integrate historical and real-time metals data into their applications. With its extensive range of endpoints, including the ability to retrieve historical prices for XAU (Gold), the API provides the tools necessary to build sophisticated financial applications that can adapt to market changes.
By utilizing the various endpoints, developers can access a wealth of information, from real-time rates to historical data, enabling them to make informed decisions and provide valuable insights to their users. Whether you are building a trading platform, a market analysis tool, or a financial dashboard, the Metals-API offers the flexibility and functionality needed to succeed in the competitive financial landscape.
For more information on how to get started, visit the Metals-API Documentation and explore the various features and capabilities that this powerful API has to offer.