Get {Symbol} Historical Prices using this API
Get XAU Historical Prices using this API
In the ever-evolving world of finance, the demand for accurate and real-time data is paramount, especially when it comes to precious metals like gold. If you're looking to get historical prices for XAU (Gold), the Metals-API is a powerful tool that can help you access this data seamlessly. This blog post will delve into the capabilities of the Metals-API, focusing on how developers can leverage its features to obtain historical prices for XAU and more.
Metals-API Information
API Description
The Metals-API is a robust JSON API designed to provide real-time and historical data for various metals, including gold, silver, platinum, and palladium. With its innovative architecture, the API empowers developers to build next-generation applications that require accurate and timely metals data. Whether you are developing a financial application, a trading platform, or a market analysis tool, the Metals-API offers the flexibility and reliability needed to succeed.
One of the standout features of the Metals-API is its ability to deliver real-time exchange rate data, updated at intervals depending on your subscription plan. This means that developers can access the latest market information without delay, enabling them to make informed decisions based on the most current data available.
For comprehensive documentation on how to utilize the API, visit the Metals-API Documentation. Additionally, you can explore the full range of available symbols by checking the Metals-API Supported Symbols page.
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: This endpoint provides real-time exchange rate data for metals. Depending on your subscription plan, you can receive updates every 60 minutes, every 10 minutes, or even more frequently. This is particularly useful for traders who need to stay on top of market fluctuations.
- Historical Rates Endpoint: You can access historical rates for XAU dating back to 2019. By appending a specific date to your query, you can retrieve the price of gold for that day, allowing for in-depth analysis and trend tracking.
- Bid And Ask Endpoint: This feature allows you to retrieve real-time bid and ask prices for XAU. Understanding the bid-ask spread is crucial for traders looking to optimize their buying and selling strategies.
- Convert Endpoint: The API includes a currency conversion feature, enabling you to convert any amount from one metal to another or to/from USD. This is particularly beneficial for applications that require multi-currency support.
- Time-Series Endpoint: This endpoint allows you to query the API for daily historical rates between two dates of your choice. This is ideal for analyzing trends over specific periods.
- Fluctuation Endpoint: With this feature, you can track how the price of XAU fluctuates over a specified time frame, providing insights into market volatility.
- Carat Endpoint: This endpoint provides information about gold rates by carat, which is essential for jewelers and those in the jewelry industry.
- Lowest/Highest Price Endpoint: You can query the API to get the lowest and highest price of XAU for a specified date, which is useful for identifying market extremes.
- Open/High/Low/Close (OHLC) Price Endpoint: This endpoint allows you to retrieve the open, high, low, and close prices for XAU, which are critical for technical analysis.
- Historical LME Endpoint: Access historical rates for LME symbols dating back to 2008, providing a broader context for market analysis.
- API Key: Your unique API key is essential for accessing the API. It must be included in your requests to authenticate your access.
- API Response: The API delivers exchange rates relative to USD by default, ensuring consistency in your data analysis.
- Available Endpoints: The Metals-API features 14 different endpoints, each designed to provide specific functionalities, making it a versatile tool for developers.
- Supported Symbols Endpoint: This endpoint returns all available currencies and metals, ensuring you have access to the latest symbols.
- Gold Price India Endpoint: Retrieve the latest gold price in India using this dedicated endpoint, which is particularly useful for local market analysis.
- News Endpoint: Stay updated with the latest news articles related to various metals, helping you keep track of market trends and events.
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": 1759928431,
"base": "USD",
"date": "2025-10-08",
"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, with XAU (Gold) priced at 0.000482 per troy ounce.
Historical Rates Endpoint
Accessing historical exchange rates is straightforward. Here’s an example response for a specific date:
{
"success": true,
"timestamp": 1759842031,
"base": "USD",
"date": "2025-10-07",
"rates": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915,
"XPD": 0.000748
},
"unit": "per troy ounce"
}
This response indicates the price of XAU on October 7, 2025, allowing for historical analysis and comparison.
Time-series Endpoint
The Time-series Endpoint enables you to retrieve exchange rates for a specific period. Here’s an example response:
{
"success": true,
"timeseries": true,
"start_date": "2025-10-01",
"end_date": "2025-10-08",
"base": "USD",
"rates": {
"2025-10-01": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915
},
"2025-10-03": {
"XAU": 0.000483,
"XAG": 0.0382,
"XPT": 0.000913
},
"2025-10-08": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912
}
},
"unit": "per troy ounce"
}
This response provides daily rates for XAU over the specified period, enabling trend analysis and forecasting.
Convert Endpoint
The Convert Endpoint allows you to convert amounts between different metals or to/from USD. Here’s an example response:
{
"success": true,
"query": {
"from": "USD",
"to": "XAU",
"amount": 1000
},
"info": {
"timestamp": 1759928431,
"rate": 0.000482
},
"result": 0.482,
"unit": "troy ounces"
}
This response shows that 1000 USD converts to approximately 0.482 troy ounces of gold, providing valuable information for financial calculations.
Fluctuation Endpoint
Tracking rate fluctuations is essential for understanding market dynamics. Here’s an example response:
{
"success": true,
"fluctuation": true,
"start_date": "2025-10-01",
"end_date": "2025-10-08",
"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 response provides insights into how the price of XAU has changed over the specified period, which is crucial for traders and analysts.
OHLC (Open/High/Low/Close) Price Endpoint
The OHLC Price Endpoint provides essential data for technical analysis. Here’s an example response:
{
"success": true,
"timestamp": 1759928431,
"base": "USD",
"date": "2025-10-08",
"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 response provides the open, high, low, and close prices for XAU, which are critical for traders looking to analyze market trends.
Bid/Ask Endpoint
The Bid/Ask Endpoint provides current bid and ask prices for metals. Here’s an example response:
{
"success": true,
"timestamp": 1759928431,
"base": "USD",
"date": "2025-10-08",
"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 response shows the current bid and ask prices for XAU, which is essential for traders looking to execute orders effectively.
Conclusion
In conclusion, the Metals-API is an invaluable resource for developers seeking to access historical prices for XAU and other metals. With its comprehensive set of endpoints, real-time data capabilities, and user-friendly documentation, the API empowers developers to create sophisticated financial applications that can analyze and interpret market trends effectively.
By utilizing features such as the Historical Rates Endpoint, Time-Series Endpoint, and OHLC Price Endpoint, developers can gain deep insights into the performance of gold over time. Furthermore, the ability to track fluctuations and convert between different metals enhances the API's utility for various applications.
For more information on how to get started with the Metals-API, explore the Metals-API Documentation, and don't forget to check out the Metals-API Supported Symbols for a complete list of available metals. The Metals-API Website is also a great resource for updates and news related to metal prices.
With the right tools and data at your fingertips, you can harness the power of real-time metals data to drive your applications and make informed decisions in the dynamic world of finance.