Guide to Getting Kanpur Gold 22k (KANP-22k) Historical Prices with this API
Introduction
In the world of precious metals, gold (XAU) stands out as a symbol of wealth and stability. For developers and financial analysts, accessing historical prices of gold is crucial for market analysis, investment strategies, and economic forecasting. The Metals-API provides a robust solution for retrieving real-time and historical gold prices, enabling users to harness the power of data analytics in their trading and investment decisions. This guide will delve into the capabilities of the Metals-API, focusing on how to obtain historical prices for Kanpur Gold 22k (KANP-22k) and explore the innovative features that make this API a valuable tool for developers.
About Gold (XAU)
Gold has long been a cornerstone of financial systems worldwide, serving as a hedge against inflation and currency fluctuations. With the digital transformation of financial markets, the integration of technology in trading has become paramount. The Metals-API exemplifies this transformation by providing developers with access to real-time data and historical insights into gold prices. By leveraging data analytics, traders can gain market insights that inform their strategies, allowing for more informed decision-making.
The API not only facilitates price discovery but also offers innovative digital asset solutions that cater to the evolving needs of the financial landscape. As the demand for transparency and accuracy in trading increases, the Metals-API stands out as a reliable source for gold pricing data.
API Description
The Metals-API is designed to empower developers to build next-generation applications that require real-time and historical metals data. With a focus on innovation and technological advancement, this API provides a comprehensive suite of features that cater to various use cases in the financial sector. Whether you are developing a trading platform, a financial analysis tool, or a market research application, the Metals-API offers the necessary capabilities to enhance your project.
For detailed information on how to get started, refer to the Metals-API Documentation, which outlines the various endpoints and their functionalities.
Key Features and Endpoints
The Metals-API boasts a variety of endpoints that provide developers with the flexibility to access different types of data. Here are some of the key features:
Latest Rates Endpoint
The Latest Rates endpoint is a powerful feature that allows users to retrieve real-time exchange rate data for gold and other metals. Depending on your subscription plan, the API updates this data every 60 minutes, every 10 minutes, or even more frequently. This feature is essential for traders who need to stay updated on market fluctuations.
Historical Rates Endpoint
Accessing historical rates is crucial for analyzing trends and making informed investment decisions. The Historical Rates endpoint allows users to query historical prices dating back to 2019 by appending a specific date in the format YYYY-MM-DD. This feature is particularly useful for conducting retrospective analyses of gold price movements.
Bid And Ask Endpoint
The Bid and Ask endpoint provides real-time bid and ask prices for gold and other metals. This feature is invaluable for traders looking to execute orders at the best possible prices. Depending on your subscription plan, this endpoint can deliver precise pricing information that reflects current market conditions.
Convert Endpoint
The Convert endpoint enables users to convert any amount from one metal to another or to/from USD. This feature is particularly useful for traders who operate in multiple currencies and need to quickly assess the value of their holdings in different denominations.
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 essential for analyzing price trends over specific periods, enabling traders to make data-driven decisions based on historical performance.
Fluctuation Endpoint
Using the Fluctuation endpoint, users can track how gold prices fluctuate on a day-to-day basis. This feature provides insights into market volatility and helps traders understand the dynamics of price movements over time.
Carat Endpoint
The Carat endpoint allows users to retrieve information about gold rates by carat. This feature is particularly relevant for jewelers and consumers looking to understand the value of gold based on its purity.
Lowest/Highest Price Endpoint
The Lowest/Highest Price endpoint enables users to query the API for the lowest and highest prices of gold within a specified date range. This feature is useful for identifying price extremes and understanding market behavior.
Open/High/Low/Close (OHLC) Price Endpoint
The OHLC Price endpoint provides users with open, high, low, and close prices for gold over a specified period. This data is essential for technical analysis and helps traders identify potential entry and exit points in the market.
Historical LME Endpoint
The Historical LME endpoint allows users to access historical rates for LME symbols dating back to 2008. This feature is particularly useful for traders who require comprehensive data for metals traded on the London Metal Exchange.
API Key and Response
To access the Metals-API, users must obtain an API key, which is passed into the API base URL's access_key parameter. The API delivers exchange rates relative to USD by default, and all data is returned in a structured JSON format, making it easy to integrate into applications.
Available Endpoints
The Metals-API offers a total of 14 endpoints, each providing unique functionalities. Developers can explore these endpoints to find the best fit for their specific needs. For a complete list of supported symbols and their specifications, refer to the Metals-API Supported Symbols page.
API Endpoint Examples and Responses
Latest Rates Endpoint
To retrieve real-time exchange rates for all available metals, you can use the Latest Rates endpoint. Here is an example response:
{
"success": true,
"timestamp": 1783210389,
"base": "USD",
"date": "2026-07-05",
"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 the current exchange rates for various metals, with gold (XAU) priced at 0.000482 per troy ounce.
Historical Rates Endpoint
Accessing historical exchange rates for any date since 1999 is straightforward with the Historical Rates endpoint. Here is an example response:
{
"success": true,
"timestamp": 1783123989,
"base": "USD",
"date": "2026-07-04",
"rates": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915,
"XPD": 0.000748
},
"unit": "per troy ounce"
}
This response provides historical rates for gold and other metals, allowing users to analyze past market conditions.
Time-series Endpoint
The Time-Series endpoint allows users to retrieve exchange rates for a specific time period. Here is an example response:
{
"success": true,
"timeseries": true,
"start_date": "2026-06-28",
"end_date": "2026-07-05",
"base": "USD",
"rates": {
"2026-06-28": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915
},
"2026-06-30": {
"XAU": 0.000483,
"XAG": 0.0382,
"XPT": 0.000913
},
"2026-07-05": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912
}
},
"unit": "per troy ounce"
}
This response provides daily historical rates for the specified period, enabling users to analyze trends over time.
Convert Endpoint
The Convert endpoint allows users to convert any amount from one metal to another or to/from USD. Here is an example response:
{
"success": true,
"query": {
"from": "USD",
"to": "XAU",
"amount": 1000
},
"info": {
"timestamp": 1783210389,
"rate": 0.000482
},
"result": 0.482,
"unit": "troy ounces"
}
This response shows the conversion of 1000 USD to gold (XAU), resulting in 0.482 troy ounces.
Fluctuation Endpoint
The Fluctuation endpoint allows users to track rate fluctuations between two dates. Here is an example response:
{
"success": true,
"fluctuation": true,
"start_date": "2026-06-28",
"end_date": "2026-07-05",
"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 fluctuated over the specified period, highlighting both the absolute change and percentage change.
OHLC (Open/High/Low/Close) Price Endpoint
The OHLC Price endpoint provides users with open, high, low, and close prices for a specific time period. Here is an example response:
{
"success": true,
"timestamp": 1783210389,
"base": "USD",
"date": "2026-07-05",
"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 response provides critical data for traders looking to perform technical analysis based on price movements throughout the trading day.
Bid/Ask Endpoint
The Bid/Ask endpoint provides current bid and ask prices for metals. Here is an example response:
{
"success": true,
"timestamp": 1783210389,
"base": "USD",
"date": "2026-07-05",
"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 essential pricing information for traders looking to make informed decisions based on current market conditions.
Conclusion
The Metals-API offers a comprehensive suite of features that empower developers to access real-time and historical gold prices efficiently. By leveraging the various endpoints, users can gain valuable insights into market trends, perform technical analysis, and make informed trading decisions. Whether you are interested in the latest rates, historical data, or price fluctuations, the Metals-API provides the necessary tools to enhance your financial applications.
For further exploration of the API's capabilities, be sure to check out the Metals-API Documentation and the Metals-API Supported Symbols page. With the right tools and data, you can navigate the complexities of the gold market with confidence.