Obtain Pakistan Gold 24k (XAUPAK24) Historical Prices from this API
Introduction
In the world of finance and investment, gold (XAU) has always held a significant place due to its intrinsic value and historical importance as a safe-haven asset. For developers and financial analysts, obtaining accurate and timely historical prices of gold is crucial for making informed decisions. The Metals-API provides a robust solution for accessing historical prices of 24k gold (XAUPAK24) and other precious metals. This blog post will delve into the capabilities of the Metals-API, exploring how it empowers developers to harness real-time and historical data for gold trading and analysis.
About Gold (XAU)
Gold, represented by the symbol XAU, is a precious metal that has been a cornerstone of wealth and investment for centuries. In recent years, the digital transformation in precious metals trading has revolutionized how investors access and analyze gold prices. The integration of data analytics and market insights has enabled traders to make more informed decisions based on real-time data.
With the rise of technology in trading, the importance of innovation in price discovery has become paramount. The Metals-API stands at the forefront of this transformation, offering developers the tools needed to build next-generation applications that leverage real-time metals data. By utilizing the API, developers can create digital asset solutions that cater to the evolving needs of investors and traders.
API Description
The Metals-API is a powerful JSON API that provides access to real-time and historical prices for various metals, including gold. It is designed to empower developers to create applications that require accurate and timely metals data. With its innovative features and capabilities, the Metals-API enables users to build applications that can analyze market trends, track price fluctuations, and convert currencies seamlessly.
For more information about the API, you can visit the Metals-API Website or check the Metals-API Documentation for detailed instructions on how to get started.
Key Features and Endpoints
The Metals-API offers a variety of endpoints that cater to different needs when it comes to accessing metals data. Below are some of the key features and their potential applications:
Latest Rates Endpoint
The Latest Rates Endpoint provides real-time exchange rate data for various metals, including gold. Depending on your subscription plan, this endpoint can return data updated every 60 minutes, every 10 minutes, or even more frequently. This feature is essential for traders who need to make quick decisions based on the latest market conditions.
{
"success": true,
"timestamp": 1788826381,
"base": "USD",
"date": "2026-09-08",
"rates": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912,
"XPD": 0.000744
},
"unit": "per troy ounce"
}
Historical Rates Endpoint
The Historical Rates Endpoint allows users to access historical exchange rates for most currencies dating back to 2019. This endpoint is particularly useful for analysts who need to study price trends over time. By appending a specific date in the format YYYY-MM-DD, users can retrieve historical data for gold and other metals.
{
"success": true,
"timestamp": 1788739981,
"base": "USD",
"date": "2026-09-07",
"rates": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915
},
"unit": "per troy ounce"
}
Bid And Ask Endpoint
The Bid and Ask Endpoint is a powerful feature that enables users to retrieve real-time bid and ask prices for metals. This information is crucial for traders looking to execute buy or sell orders at the best possible prices. The bid price represents the maximum price that a buyer is willing to pay, while the ask price is the minimum price that a seller is willing to accept.
{
"success": true,
"timestamp": 1788826381,
"base": "USD",
"date": "2026-09-08",
"rates": {
"XAU": {
"bid": 0.000481,
"ask": 0.000483,
"spread": 2.0e-6
},
"XAG": {
"bid": 0.0381,
"ask": 0.0382,
"spread": 0.0001
}
},
"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. By specifying the amount and the currencies involved, users can easily perform conversions.
{
"success": true,
"query": {
"from": "USD",
"to": "XAU",
"amount": 1000
},
"info": {
"timestamp": 1788826381,
"rate": 0.000482
},
"result": 0.482,
"unit": "troy ounces"
}
Time-Series Endpoint
The Time-Series Endpoint allows users to query the API for daily historical rates between two dates of their choice. This feature is invaluable for conducting in-depth analyses of price movements over specific periods. By specifying a start and end date, users can obtain a comprehensive view of how gold prices have fluctuated over time.
{
"success": true,
"timeseries": true,
"start_date": "2026-09-01",
"end_date": "2026-09-08",
"base": "USD",
"rates": {
"2026-09-01": {
"XAU": 0.000485,
"XAG": 0.03825
},
"2026-09-03": {
"XAU": 0.000483,
"XAG": 0.0382
},
"2026-09-08": {
"XAU": 0.000482,
"XAG": 0.03815
}
},
"unit": "per troy ounce"
}
Fluctuation Endpoint
The Fluctuation Endpoint provides information about how currencies fluctuate on a day-to-day basis. This feature is essential for traders who want to understand the volatility of gold prices over a specified period. By specifying a start and end date, users can track the changes in price and assess market trends.
{
"success": true,
"fluctuation": true,
"start_date": "2026-09-01",
"end_date": "2026-09-08",
"base": "USD",
"rates": {
"XAU": {
"start_rate": 0.000485,
"end_rate": 0.000482,
"change": -3.0e-6,
"change_pct": -0.62
}
},
"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 technical analysis, as it provides insights into market trends and price movements. Traders can use this information to make informed decisions based on historical performance.
{
"success": true,
"timestamp": 1788826381,
"base": "USD",
"date": "2026-09-08",
"rates": {
"XAU": {
"open": 0.000485,
"high": 0.000487,
"low": 0.000481,
"close": 0.000482
}
},
"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 users interested in analyzing the historical performance of metals traded on the London Metal Exchange. By utilizing this endpoint, traders can gain insights into long-term price trends and market behavior.
API Key and Authentication
To access the Metals-API, users 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 secure access to the API's features. Developers should keep their API keys confidential and avoid exposing them in public repositories.
API Response and Data Structure
The API responses delivered by the Metals-API are by default relative to USD. All data is returned in a structured JSON format, making it easy for developers to parse and utilize the information in their applications. Understanding the structure of the API response is crucial for effectively integrating the API into your projects.
For a complete list of all supported symbols and their specifications, refer to the Metals-API Supported Symbols.
Conclusion
The Metals-API offers a comprehensive solution for developers seeking to access historical prices and real-time data for gold and other precious metals. With its innovative features, including the Latest Rates, Historical Rates, and various conversion endpoints, the API empowers users to build applications that can analyze market trends and make informed trading decisions.
By leveraging the capabilities of the Metals-API, developers can create powerful tools that enhance the trading experience, providing insights into price fluctuations and historical performance. As the financial landscape continues to evolve, the importance of accurate and timely metals data cannot be overstated. For more information on how to get started with the Metals-API, visit the Metals-API Website and explore the Metals-API Documentation for detailed guidance.