Fetch SPDR Gold Shares (GLD) Historical Prices from this API

Introduction
In the world of finance and investment, precious metals like gold have always held a significant place. For those looking to track the historical prices of SPDR Gold Shares (GLD), the Metals-API offers a powerful solution. This API provides developers with access to real-time and historical data on various metals, including gold, silver, platinum, and palladium. In this blog post, we will delve into the capabilities of the Metals-API, focusing on how to fetch historical prices for gold (XAU) and explore the innovative features that make this API a valuable tool for developers.
Metals-API Information
About Gold (XAU)
Gold, represented by the symbol XAU, is not just a commodity; it is a digital asset that has transformed the investment landscape. The digital transformation in precious metals trading has led to the integration of advanced data analytics and market insights, allowing investors to make informed decisions based on real-time data. The Metals-API plays a crucial role in this transformation by providing developers with the tools necessary to access and analyze gold prices effectively.
With the rise of technology in trading, the integration of innovative solutions for price discovery has become essential. The Metals-API empowers developers to build next-generation applications that can leverage real-time metals data, enabling them to create digital asset solutions that cater to the evolving needs of investors.
API Description
The Metals-API is designed to provide comprehensive access to metals prices and currency conversion through a simple and efficient JSON API. It allows developers to retrieve real-time and historical data, making it an indispensable resource for anyone involved in the trading or investment of precious metals. The API is built with innovation in mind, offering features that enhance the user experience and provide valuable insights into market trends.
For detailed information on how to use the API, developers can refer to the Metals-API Documentation, which outlines the various endpoints and their functionalities. The API supports a wide range of symbols, which can be explored further on the Metals-API Supported Symbols page.
Key Features and Endpoints
The Metals-API offers several key features that enable developers to access a wealth of information about precious metals. Below, we will explore some of the most important endpoints and their potential applications.
Latest Rates Endpoint
The Latest Rates Endpoint provides real-time exchange rate data for metals, updated every 60 minutes, every 10 minutes, or even more frequently, depending on the subscription plan. This feature is essential for traders who need up-to-the-minute information to make informed decisions. The response from this endpoint includes the base currency, the date of the rates, and the current rates for various metals.
{
"success": true,
"timestamp": 1748491279,
"base": "USD",
"date": "2025-05-29",
"rates": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912,
"XPD": 0.000744
},
"unit": "per troy ounce"
}
Historical Rates Endpoint
For those interested in analyzing trends over time, the Historical Rates Endpoint allows users to access historical exchange rates for most currencies dating back to 2019. By appending a specific date to the API request, developers can retrieve past rates, which is invaluable for conducting market analysis and forecasting future trends.
{
"success": true,
"timestamp": 1748404879,
"base": "USD",
"date": "2025-05-28",
"rates": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915,
"XPD": 0.000748
},
"unit": "per troy ounce"
}
Bid And Ask Endpoint
The Bid and Ask Endpoint is a powerful feature that enables developers to retrieve real-time bid and ask prices for metals. This information is crucial for traders looking to execute orders at the best possible prices. The response includes the bid and ask prices along with the spread, providing a comprehensive view of the current market conditions.
{
"success": true,
"timestamp": 1748491279,
"base": "USD",
"date": "2025-05-29",
"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"
}
Convert Endpoint
The Convert Endpoint allows users to convert any amount from one metal to another or to/from USD. This feature is particularly useful for traders who need to quickly assess the value of their holdings in different currencies. The response includes the conversion rate and the result of the conversion, making it easy to understand the value of metals in various contexts.
{
"success": true,
"query": {
"from": "USD",
"to": "XAU",
"amount": 1000
},
"info": {
"timestamp": 1748491279,
"rate": 0.000482
},
"result": 0.482,
"unit": "troy ounces"
}
Time-Series Endpoint
The Time-Series Endpoint allows developers to query the API for daily historical rates between two dates of their choice. This feature is essential for analyzing price movements over time and understanding market trends. The response includes the rates for each day within the specified range, providing a comprehensive view of historical price fluctuations.
{
"success": true,
"timeseries": true,
"start_date": "2025-05-22",
"end_date": "2025-05-29",
"base": "USD",
"rates": {
"2025-05-22": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915
},
"2025-05-24": {
"XAU": 0.000483,
"XAG": 0.0382,
"XPT": 0.000913
},
"2025-05-29": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912
}
},
"unit": "per troy ounce"
}
Fluctuation Endpoint
The Fluctuation Endpoint provides information about how currencies fluctuate on a day-to-day basis. This feature is particularly useful for traders looking to understand the volatility of the market and make informed decisions based on historical fluctuations. The response includes the start and end rates, as well as the percentage change over the specified period.
{
"success": true,
"fluctuation": true,
"start_date": "2025-05-22",
"end_date": "2025-05-29",
"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"
}
Open/High/Low/Close (OHLC) Price Endpoint
The OHLC Price Endpoint allows users to query the API for the open, high, low, and close prices for a specific time period. This data is crucial for traders who rely on candlestick charts and other technical analysis tools to make trading decisions. The response includes the OHLC data for each metal, providing a comprehensive view of market performance.
{
"success": true,
"timestamp": 1748491279,
"base": "USD",
"date": "2025-05-29",
"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"
}
Historical LME Endpoint
The Historical LME Endpoint provides access to historical rates for LME symbols dating back to 2008. This endpoint is particularly useful for developers working with industrial metals and looking to analyze long-term trends in the market. The response includes historical data that can be used for comprehensive market analysis.
API Key and Authentication
To access the Metals-API, developers must obtain an API key, which is a unique identifier passed into the API base URL's access_key parameter. This key is essential for authenticating requests and ensuring that users have the necessary permissions to access the data. Proper management of API keys is crucial for maintaining security and preventing unauthorized access.
API Response Structure
The API responses are structured in a way that provides clarity and ease of use. By default, exchange rates are relative to USD, and all data is returned in a consistent format. Understanding the structure of the API responses is vital for developers to effectively parse and utilize the data in their applications.
Conclusion
The Metals-API is an invaluable resource for developers looking to access real-time and historical data on precious metals, particularly gold (XAU). With its innovative features and comprehensive endpoints, the API empowers developers to build applications that can analyze market trends, track price fluctuations, and make informed trading decisions. By leveraging the capabilities of the Metals-API, developers can create solutions that meet the evolving needs of investors in the digital age.
For more information on how to get started with the Metals-API, be sure to check out the Metals-API Documentation and explore the Metals-API Supported Symbols page for a complete list of available metals. With the right tools and data at your fingertips, you can navigate the world of precious metals trading with confidence.