Retrieve Surat Gold (XAU-SURA) Historical Prices through this API

In the world of finance and investment, the demand for accurate and timely data is paramount, especially when it comes to precious metals like gold. The ability to retrieve historical prices for gold, represented by the symbol XAU, is crucial for traders, analysts, and developers who are looking to build applications that rely on real-time and historical data. This blog post will explore how to retrieve historical prices for XAU using the Metals-API, a powerful tool that provides comprehensive access to metals pricing data.
Metals-API Information
About Gold (XAU)
Gold has long been a symbol of wealth and stability, often viewed as a safe haven during economic uncertainty. In recent years, the digital transformation in precious metals trading has revolutionized how investors access and analyze gold prices. With advancements in data analytics and market insights, traders can now leverage technology to make informed decisions based on real-time data.
The integration of technology in trading has led to innovative solutions for price discovery. Developers can utilize APIs like Metals-API to create applications that provide users with up-to-date information about gold prices, historical trends, and market fluctuations. This capability not only enhances trading strategies but also empowers investors to make data-driven decisions.
API Description
The Metals-API is designed to provide developers with a robust platform for accessing real-time and historical metals data. With its user-friendly interface and comprehensive documentation, developers can easily integrate the API into their applications. The API supports a variety of endpoints that cater to different needs, from retrieving the latest rates to accessing historical data dating back to 2019.
One of the standout features of Metals-API is its ability to deliver real-time exchange rate data, which is updated at intervals depending on the subscription plan. This ensures that users always have access to the most current information, which is essential for making timely trading decisions. Furthermore, the API's historical rates endpoint allows users to query past prices, enabling them to analyze trends and make predictions based on historical performance.
Key Features and Endpoints
The Metals-API offers a variety of endpoints that provide different functionalities, each designed to meet the needs of developers and traders alike. Here are some of the key features:
- Latest Rates Endpoint: Depending on your subscription plan, this endpoint returns real-time exchange rate data for metals, updated every 60 minutes, every 10 minutes, or even more frequently. This feature is essential for traders who need to stay informed about market movements.
- Historical Rates Endpoint: Users can access historical rates for most currencies dating back to 2019. By appending a specific date to the API request, developers can retrieve past prices for analysis and reporting.
- Bid And Ask Endpoint: This powerful feature allows users to retrieve real-time bid and ask prices for metals, providing insights into market liquidity and pricing dynamics.
- Convert Endpoint: The conversion endpoint enables users to convert any amount from one currency to another, facilitating transactions and price comparisons across different currencies.
- Time-Series Endpoint: This endpoint allows users to query the API for daily historical rates between two specified dates, making it easier to analyze trends over time.
- Fluctuation Endpoint: Users can track how currencies fluctuate on a day-to-day basis, providing insights into market volatility and price movements.
- Carat Endpoint: This feature allows users to retrieve information about gold rates by carat, catering to jewelers and consumers interested in specific gold purity levels.
- Lowest/Highest Price Endpoint: Users can query the API to get the lowest and highest prices for a specified date, which is useful for identifying price ranges and market extremes.
- Open/High/Low/Close (OHLC) Price Endpoint: This endpoint provides open, high, low, and close prices for a specific date, offering a comprehensive view of daily price movements.
- Historical LME Endpoint: Access historical rates for LME symbols dating back to 2008, which is particularly useful for traders dealing with industrial metals.
- API Key: Each user is assigned a unique API key that must be included in API requests to authenticate and authorize access to the data.
- API Response: The API delivers exchange rates relative to USD by default, ensuring consistency and ease of use for developers.
- Available Endpoints: The API provides a constantly updated list of all available currencies and metals, allowing users to stay informed about the latest offerings.
- Gold Price India Endpoint: Retrieve the latest gold price in India using this dedicated endpoint, which is particularly useful for investors in the Indian market.
- News Endpoint: Stay updated with the latest news articles related to various metals, helping traders keep abreast of 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. This resource is invaluable for developers looking to implement specific metal data into their applications.
API Endpoint Examples and Responses
Understanding how to interact with the Metals-API is crucial for developers. Below are examples of various API endpoints and their corresponding JSON responses, which illustrate the data structure and usage.
Latest Rates Endpoint
To get real-time exchange rates for all available metals, you can use the following request:
{ "success": true, "timestamp": 1746507693, "base": "USD", "date": "2025-05-06", "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" }
This response indicates that the current price of gold (XAU) is 0.000482 per troy ounce, relative to USD.
Historical Rates Endpoint
Accessing historical exchange rates for any date since 1999 can be done with the following request:
{ "success": true, "timestamp": 1746421293, "base": "USD", "date": "2025-05-05", "rates": { "XAU": 0.000485, "XAG": 0.03825, "XPT": 0.000915, "XPD": 0.000748 }, "unit": "per troy ounce" }
This example shows the historical price of gold on May 5, 2025, allowing traders to analyze past performance.
Time-series Endpoint
To get exchange rates for a specific time period, the following request can be made:
{ "success": true, "timeseries": true, "start_date": "2025-04-29", "end_date": "2025-05-06", "base": "USD", "rates": { "2025-04-29": { "XAU": 0.000485, "XAG": 0.03825, "XPT": 0.000915 }, "2025-05-01": { "XAU": 0.000483, "XAG": 0.0382, "XPT": 0.000913 }, "2025-05-06": { "XAU": 0.000482, "XAG": 0.03815, "XPT": 0.000912 } }, "unit": "per troy ounce" }
This response provides a time series of gold prices over a specified period, enabling trend analysis.
Convert Endpoint
To convert any amount from one metal to another or to/from USD, the following request can be used:
{ "success": true, "query": { "from": "USD", "to": "XAU", "amount": 1000 }, "info": { "timestamp": 1746507693, "rate": 0.000482 }, "result": 0.482, "unit": "troy ounces" }
This example shows how to convert 1000 USD into gold (XAU), resulting in 0.482 troy ounces.
Fluctuation Endpoint
To track rate fluctuations between two dates, the following request can be made:
{ "success": true, "fluctuation": true, "start_date": "2025-04-29", "end_date": "2025-05-06", "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 prices have fluctuated over a specified period, which is essential for understanding market dynamics.
OHLC (Open/High/Low/Close) Price Endpoint
To get OHLC data for a specific time period, the following request can be made:
{ "success": true, "timestamp": 1746507693, "base": "USD", "date": "2025-05-06", "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 endpoint provides a comprehensive view of daily price movements, allowing traders to analyze market behavior effectively.
Bid/Ask Endpoint
To get current bid and ask prices for metals, the following request can be made:
{ "success": true, "timestamp": 1746507693, "base": "USD", "date": "2025-05-06", "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, which is crucial for traders looking to execute buy or sell orders.
Conclusion
In conclusion, the Metals-API offers a comprehensive suite of tools for developers and traders looking to access real-time and historical data for precious metals like gold (XAU). With its innovative endpoints, the API empowers users to build next-generation applications that leverage accurate pricing data for informed decision-making. By understanding the various features and capabilities of the Metals-API, developers can create powerful tools that enhance trading strategies and provide valuable insights into market trends.
Whether you are a seasoned trader or a developer looking to integrate metals data into your applications, the Metals-API provides the necessary resources and documentation to succeed. For more information, refer to the Metals-API Documentation and explore the extensive range of supported symbols on the Metals-API Supported Symbols page. By harnessing the power of real-time metals data, you can stay ahead in the ever-evolving world of precious metals trading.