The Easiest Way to Get Gold Ask (XAU-ASK) Historical Rates from Public APIs
The Easiest Way to Get Gold Ask (XAU-ASK) Historical Rates from Public APIs
In the world of finance, particularly in the realm of precious metals, having access to accurate and timely data is crucial for making informed decisions. For developers and traders alike, the ability to retrieve historical prices for Gold (XAU) is essential. The Metals-API provides a robust solution for accessing historical rates, enabling users to integrate this data into their applications seamlessly. This blog post will explore how to effectively utilize the Metals-API to obtain Gold historical prices, including detailed descriptions of endpoints, parameters, and example responses.
About Gold (XAU)
Gold has long been a symbol of wealth and stability, often viewed as a safe haven during economic uncertainty. With the digital transformation in precious metals trading, data analytics and market insights have become more accessible than ever. The integration of technology in trading has revolutionized how investors approach the market, allowing for innovative price discovery and the development of digital asset solutions.
As the demand for real-time data grows, the Metals-API stands out as a powerful tool for developers looking to build next-generation applications that require accurate and timely metals data. By leveraging the capabilities of the Metals-API, developers can create applications that provide users with insights into market trends, historical price movements, and more.
API Description
The Metals-API is a comprehensive JSON API that provides access to real-time and historical data for various metals, including Gold (XAU). This API empowers developers to build applications that can track market fluctuations, analyze historical trends, and convert between different metal currencies. With its user-friendly interface and extensive documentation, the Metals-API is designed to facilitate seamless integration into any application.
For more information, visit the Metals-API Website or check out the Metals-API Documentation for detailed guidance on how to use the API effectively.
Key Features and Endpoints
The Metals-API offers a variety of endpoints that cater to different needs. Here are some of the key features:
- Latest Rates Endpoint: This endpoint provides real-time exchange rate data for metals, updated based on your subscription plan. Depending on your plan, you can receive updates every 60 minutes or every 10 minutes.
- Historical Rates Endpoint: Access historical rates for Gold and other metals dating back to 2019. By appending a specific date in the format YYYY-MM-DD, you can retrieve past rates.
- Bid And Ask Endpoint: This feature allows you to retrieve real-time Bid and Ask prices for metals, providing insights into market conditions.
- Convert Endpoint: Easily convert any amount from one metal to another or to/from USD, facilitating transactions and analysis.
- Time-Series Endpoint: Query for daily historical rates between two chosen dates, allowing for in-depth analysis of price movements over time.
- Fluctuation Endpoint: Track how currencies fluctuate on a day-to-day basis, providing valuable insights into market volatility.
- Carat Endpoint: Retrieve information about Gold rates by Carat, which is particularly useful for jewelers and traders.
- Lowest/Highest Price Endpoint: Get the lowest and highest prices for a specified date, helping to identify market extremes.
- Open/High/Low/Close (OHLC) Price Endpoint: Access detailed OHLC data for a specific time period, essential for technical analysis.
- Historical LME Endpoint: Access historical rates for LME symbols dating back to 2008, useful for those involved in industrial metals.
- API Key: Your unique key is required for authentication, ensuring secure access to the API.
- API Response: Exchange rates are delivered relative to USD, with all data returned in a structured JSON format.
- Available Endpoints: The Metals-API includes 14 endpoints, each providing different functionalities tailored to user needs.
- Supported Symbols Endpoint: Access a constantly updated list of all available currencies and metals.
- News Endpoint: Retrieve the latest news articles related to various metals, keeping you informed about market 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.
API Endpoint Examples and Responses
Understanding how to interact with the Metals-API is crucial for effective implementation. Below are examples of various endpoints, including their expected responses.
Latest Rates Endpoint
This endpoint retrieves real-time exchange rates for all available metals. Here’s an example response:
{
"success": true,
"timestamp": 1777846058,
"base": "USD",
"date": "2026-05-03",
"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
To access historical exchange rates for any date since 1999, you can use this endpoint. Below is an example response:
{
"success": true,
"timestamp": 1777759658,
"base": "USD",
"date": "2026-05-02",
"rates": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915,
"XPD": 0.000748
},
"unit": "per troy ounce"
}
This response shows the historical rates for Gold and other metals on a specific date. The "date" field indicates the day for which the rates are provided.
Time-series Endpoint
This endpoint allows you to get exchange rates for a specific time period. Here’s an example response:
{
"success": true,
"timeseries": true,
"start_date": "2026-04-26",
"end_date": "2026-05-03",
"base": "USD",
"rates": {
"2026-04-26": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915
},
"2026-04-28": {
"XAU": 0.000483,
"XAG": 0.0382,
"XPT": 0.000913
},
"2026-05-03": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912
}
},
"unit": "per troy ounce"
}
This response illustrates how to track the historical rates of Gold over a specified period, allowing for trend analysis and forecasting.
Convert Endpoint
The Convert Endpoint enables you 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": 1777846058,
"rate": 0.000482
},
"result": 0.482,
"unit": "troy ounces"
}
This response shows the conversion of 1000 USD to Gold (XAU), providing the resulting amount in troy ounces. The "rate" field indicates the conversion rate at the time of the request.
Fluctuation Endpoint
To track rate fluctuations between two dates, you can use the Fluctuation Endpoint. Here’s an example response:
{
"success": true,
"fluctuation": true,
"start_date": "2026-04-26",
"end_date": "2026-05-03",
"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 Gold and other metals have fluctuated over a specified period, including the percentage change, which is crucial for traders looking to capitalize on market movements.
OHLC (Open/High/Low/Close) Endpoint
To obtain OHLC data for a specific time period, you can use this endpoint. Below is an example response:
{
"success": true,
"timestamp": 1777846058,
"base": "USD",
"date": "2026-05-03",
"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 Gold and other metals, which are essential for performing technical analysis and making informed trading decisions.
Bid/Ask Endpoint
The Bid/Ask Endpoint allows you to get current bid and ask prices for metals. Here’s an example response:
{
"success": true,
"timestamp": 1777846058,
"base": "USD",
"date": "2026-05-03",
"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 provides the current bid and ask prices for Gold, allowing traders to understand the market's current buying and selling conditions.
Conclusion
Accessing historical prices for Gold (XAU) through the Metals-API is a straightforward process that can significantly enhance your trading strategies and market analysis. By utilizing the various endpoints available, developers can retrieve real-time and historical data, perform conversions, and analyze fluctuations effectively. The comprehensive documentation provided by the Metals-API ensures that users can easily integrate these capabilities into their applications.
For further exploration, consider visiting the Metals-API Documentation for detailed guidance on each endpoint. Additionally, the Metals-API Supported Symbols page offers a complete list of available symbols, ensuring you have all the information needed to make informed decisions.
In summary, the Metals-API is an invaluable resource for developers and traders looking to harness the power of real-time metals data. By leveraging its capabilities, you can build applications that provide users with the insights they need to navigate the complex world of precious metals trading.