The Easiest Way to Get Gold Ask (XAU-ASK) Historical Rates Using API Requests
The Easiest Way to Get Gold Ask (XAU-ASK) Historical Rates Using API Requests
In today's fast-paced financial landscape, the demand for accurate and real-time data is paramount, especially in the realm of precious metals trading. For developers and traders alike, accessing historical rates for Gold (XAU) can provide invaluable insights into market trends and price movements. The Metals-API offers a robust solution for obtaining these historical rates through a series of well-structured API requests. This blog post will guide you through the process of retrieving Gold historical prices using the Metals-API, detailing the various endpoints, parameters, and data formats involved.
About Gold (XAU)
Gold has long been regarded as a safe haven asset, a hedge against inflation, and a store of value. With the rise of digital transformation in the precious metals market, the integration of technology in trading has become increasingly important. Data analytics and market insights derived from historical price data can empower traders to make informed decisions. The innovation in price discovery mechanisms and the advent of digital asset solutions have further revolutionized how investors interact with Gold.
As a developer, understanding how to leverage APIs to access historical Gold prices can enhance your trading applications and provide users with the tools they need to analyze market trends effectively. The Metals-API is designed to facilitate this process, offering a comprehensive suite of endpoints that cater to various data needs.
API Description
The Metals-API is a powerful tool that provides real-time and historical data for various metals, including Gold (XAU). This API enables developers to build next-generation applications that can analyze market trends, perform currency conversions, and track price fluctuations. With its innovative design and user-friendly documentation, the Metals-API empowers developers to harness the transformative potential of real-time metals data.
To get started, visit the Metals-API Website for more information. For detailed instructions on how to implement the API, refer to the Metals-API Documentation.
Key Features and Endpoints
The Metals-API offers a variety of endpoints that can be utilized to retrieve Gold historical prices and other related data. Here are some of the key features:
- Latest Rates Endpoint: This endpoint provides real-time exchange rate data for Gold and other metals, updated based on your subscription plan. Depending on the plan, updates can occur every 60 minutes or every 10 minutes.
- Historical Rates Endpoint: Access historical rates for Gold dating back to 2019. By appending a specific date in the format YYYY-MM-DD, you can retrieve the historical price for that day.
- Bid And Ask Endpoint: This feature allows you to retrieve real-time Bid and Ask prices for Gold, providing insights into the current market spread.
- Convert Endpoint: Use this endpoint to convert any amount from one currency to another, including conversions involving Gold.
- Time-Series Endpoint: Query the API for daily historical rates between two dates of your choice, allowing for detailed analysis over time.
- Fluctuation Endpoint: Track how Gold prices fluctuate on a day-to-day basis, providing insights into market volatility.
- Carat Endpoint: Retrieve information about Gold rates by Carat, which is particularly useful for jewelers and traders dealing in specific carat weights.
- Lowest/Highest Price Endpoint: Get the lowest and highest prices for Gold over a specified period, aiding in market analysis.
- Open/High/Low/Close (OHLC) Price Endpoint: This endpoint provides the open, high, low, and close prices for Gold, essential for technical analysis.
- Historical LME Endpoint: Access historical rates for LME symbols, dating back to 2008, which can be useful for comprehensive market studies.
- API Key: Your unique API key is required for authentication and must be included in your requests.
- API Response: The API delivers exchange rates relative to USD, ensuring consistency in data interpretation.
- Available Endpoints: The Metals-API includes 14 endpoints, each serving a distinct purpose, ensuring comprehensive data access.
- Supported Symbols Endpoint: This endpoint provides a constantly updated list of all available currencies and metals.
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 the structure of API responses is crucial for effective integration. Below are examples of various endpoints and their corresponding JSON responses:
Latest Rates Endpoint
Get real-time exchange rates for all available metals.
{
"success": true,
"timestamp": 1781964456,
"base": "USD",
"date": "2026-06-20",
"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"
}
Historical Rates Endpoint
Access historical exchange rates for any date since 1999.
{
"success": true,
"timestamp": 1781878056,
"base": "USD",
"date": "2026-06-19",
"rates": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915,
"XPD": 0.000748
},
"unit": "per troy ounce"
}
Time-series Endpoint
Get exchange rates for a specific time period.
{
"success": true,
"timeseries": true,
"start_date": "2026-06-13",
"end_date": "2026-06-20",
"base": "USD",
"rates": {
"2026-06-13": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915
},
"2026-06-15": {
"XAU": 0.000483,
"XAG": 0.0382,
"XPT": 0.000913
},
"2026-06-20": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912
}
},
"unit": "per troy ounce"
}
Convert Endpoint
Convert any amount from one metal to another or to/from USD.
{
"success": true,
"query": {
"from": "USD",
"to": "XAU",
"amount": 1000
},
"info": {
"timestamp": 1781964456,
"rate": 0.000482
},
"result": 0.482,
"unit": "troy ounces"
}
Fluctuation Endpoint
Track rate fluctuations between two dates.
{
"success": true,
"fluctuation": true,
"start_date": "2026-06-13",
"end_date": "2026-06-20",
"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"
}
OHLC (Open/High/Low/Close) Endpoint
Get OHLC data for a specific time period.
{
"success": true,
"timestamp": 1781964456,
"base": "USD",
"date": "2026-06-20",
"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"
}
Bid/Ask Endpoint
Get current bid and ask prices for metals.
{
"success": true,
"timestamp": 1781964456,
"base": "USD",
"date": "2026-06-20",
"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"
}
Conclusion
Accessing historical Gold prices through the Metals-API is a straightforward process that can significantly enhance your trading strategies and analytical capabilities. By utilizing the various endpoints provided by the API, developers can retrieve real-time and historical data, perform conversions, and analyze fluctuations in Gold prices. The comprehensive documentation available on the Metals-API Documentation site ensures that developers can easily implement these features into their applications.
As you explore the capabilities of the Metals-API, consider how integrating these data points can lead to more informed trading decisions and a deeper understanding of market dynamics. Whether you are building a trading platform, a financial analysis tool, or simply seeking to enhance your knowledge of precious metals, the Metals-API provides the resources you need to succeed.
For further exploration of the available symbols and their specifications, visit the Metals-API Supported Symbols page. Embrace the power of data and transform your approach to trading with the Metals-API.