Access Pakistan Gold 22k (XAUPAK22) Exchange Rates via JSON API
Access Pakistan Gold 22k (XAUPAK22) Exchange Rates via JSON API
In today's digital age, the demand for real-time financial data has surged, especially in the precious metals market. Developers and traders alike are seeking reliable and efficient ways to access exchange rates for gold and other metals. One such solution is the Metals-API, which provides comprehensive access to gold (XAU) exchange rates in JSON format. This blog post will delve into the capabilities of the Metals-API, focusing on how to retrieve gold exchange rates, explore its features, and provide practical integration tips for developers.
About Gold (XAU)
Gold, represented by the symbol XAU, is not just a precious metal; it is a cornerstone of the global financial system. As digital transformation reshapes the landscape of trading, the integration of technology in precious metals trading has become paramount. The Metals-API stands at the forefront of this transformation, offering developers the tools needed to harness data analytics and market insights effectively.
With the rise of digital asset solutions, the ability to access real-time gold prices and historical data has never been more critical. The Metals-API empowers developers to innovate in price discovery, enabling them to create applications that can analyze trends, forecast prices, and provide users with valuable insights into the gold market.
API Description
The Metals-API is a powerful JSON API that provides real-time and historical data for precious metals, including gold. It allows developers to build next-generation applications that require accurate and timely metals data. With its user-friendly interface and comprehensive documentation, the Metals-API is designed to facilitate seamless integration into various applications.
For more information on how to get started, visit the Metals-API Documentation, which provides detailed guidance on using the API effectively.
Key Features and Endpoints
The Metals-API offers a variety of endpoints, each designed to cater to specific needs in the realm of metals trading. Here are some of the key features:
- Latest Rates Endpoint: This endpoint provides real-time exchange rate data for gold and other metals, updated every 60 minutes, 10 minutes, or even more frequently, depending on your subscription plan. This feature is essential for traders who need the most current pricing information.
- Historical Rates Endpoint: Access historical rates dating back to 2019. By appending a specific date (YYYY-MM-DD) to the endpoint, developers can retrieve past exchange rates, which is crucial for trend analysis and market research.
- 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 Metals-API includes a currency conversion feature, enabling users to convert any amount from one currency to another. This is particularly useful for traders who operate in multiple currencies.
- Time-Series Endpoint: This endpoint allows users to query daily historical rates between two chosen dates, facilitating in-depth analysis of price movements over time.
- Fluctuation Endpoint: Track how currencies fluctuate on a day-to-day basis, providing insights into market volatility and trends.
- Carat Endpoint: Retrieve information about gold rates by carat, which is particularly useful for jewelers and consumers interested in specific gold purities.
- Lowest/Highest Price Endpoint: This endpoint allows users to query the API for the lowest and highest prices over a specified period, aiding in market analysis.
- Open/High/Low/Close (OHLC) Price Endpoint: Get detailed OHLC data for a specific time period, which is essential for technical analysis and trading strategies.
- Historical LME Endpoint: Access historical rates for LME symbols dating back to 2008, providing a comprehensive view of market trends.
- API Key: Each user is assigned a unique API key, which must be included in requests to authenticate access to the API.
- API Response: The API delivers exchange rates relative to USD by default, ensuring consistency in data interpretation.
- Available Endpoints: The Metals-API features 14 different endpoints, each offering unique functionalities tailored to various user needs.
- Supported Symbols Endpoint: This constantly updated endpoint returns all available currencies, ensuring users have access to the latest information.
- Intraday Endpoint: Query intraday exchange rate data for a single symbol, which is vital for high-frequency trading strategies.
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 API responses is crucial for effective integration. Below are examples of various endpoints and their JSON responses:
Latest Rates Endpoint
Get real-time exchange rates for all available metals.
{
"success": true,
"timestamp": 1786010870,
"base": "USD",
"date": "2026-08-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"
}
Historical Rates Endpoint
Access historical exchange rates for any date since 1999.
{
"success": true,
"timestamp": 1785924470,
"base": "USD",
"date": "2026-08-05",
"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-07-30",
"end_date": "2026-08-06",
"base": "USD",
"rates": {
"2026-07-30": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915
},
"2026-08-01": {
"XAU": 0.000483,
"XAG": 0.0382,
"XPT": 0.000913
},
"2026-08-06": {
"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": 1786010870,
"rate": 0.000482
},
"result": 0.482,
"unit": "troy ounces"
}
Fluctuation Endpoint
Track rate fluctuations between two dates.
{
"success": true,
"fluctuation": true,
"start_date": "2026-07-30",
"end_date": "2026-08-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"
}
OHLC (Open/High/Low/Close) Endpoint
Get OHLC data for a specific time period.
{
"success": true,
"timestamp": 1786010870,
"base": "USD",
"date": "2026-08-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"
}
Bid/Ask Endpoint
Get current bid and ask prices for metals.
{
"success": true,
"timestamp": 1786010870,
"base": "USD",
"date": "2026-08-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"
}
Conclusion
The Metals-API is an invaluable resource for developers looking to access real-time and historical gold exchange rates. By leveraging its various endpoints, developers can create sophisticated applications that provide users with critical insights into the precious metals market. Whether you are interested in the latest rates, historical data, or conversion capabilities, the Metals-API offers a comprehensive solution.
For further exploration, check out the Metals-API Documentation for detailed guidance on implementation, and visit the Metals-API Supported Symbols page to understand the full range of available data. With the right integration strategies and a solid understanding of the API's capabilities, developers can harness the power of real-time metals data to drive innovation in the financial sector.