Access United States Dollar (USD) Exchange Rates with API Integration Examples in JSON Format
Access United States Dollar (USD) Exchange Rates with API Integration Examples in JSON Format
In today's fast-paced financial landscape, accessing real-time exchange rates is crucial for businesses and developers alike. The Metals-API provides a robust solution for retrieving United States Dollar (USD) exchange rates in JSON format, enabling seamless integration into applications. This blog post will explore the capabilities of the Metals-API, focusing on its innovative features, practical applications, and detailed examples of API responses.
Metals-API Information
About Nickel (NI)
Nickel, represented by the symbol NI, is a vital metal in various industries, particularly in the production of stainless steel and batteries. As the world moves towards digital transformation, the metal markets are also evolving. Technological innovations and advancements in data analytics are reshaping how we understand and interact with metal prices. The integration of smart technology in trading and investment strategies is paving the way for future trends that promise to enhance market efficiency and transparency.
With the Metals-API, developers can harness the power of real-time data analytics to gain insights into nickel prices and other metals. This API empowers users to build next-generation applications that can analyze market trends, optimize trading strategies, and provide valuable insights to stakeholders.
API Description
The Metals-API is designed to provide developers with comprehensive access to real-time and historical metals data. It offers a wide range of features that enable users to retrieve exchange rates, perform conversions, and analyze fluctuations in metal prices. The API is built with a focus on innovation and technological advancement, making it an essential tool for anyone looking to integrate metals data into their applications.
For more information, visit the Metals-API Website or check out the Metals-API Documentation for detailed guidance on usage.
Key Features and Endpoints
The Metals-API offers a variety of endpoints, each designed to serve specific needs. Here are some of the key features:
- Latest Rates Endpoint: This endpoint provides real-time exchange rate data updated every 60 minutes, 10 minutes, or even more frequently, depending on your subscription plan. It allows users to access the most current prices for various metals.
- Historical Rates Endpoint: Users can access historical rates dating back to 2019 by appending a specific date in the YYYY-MM-DD format. This feature is invaluable for analyzing trends over time.
- Bid And Ask Endpoint: This powerful feature retrieves real-time bid and ask prices, enabling traders to make informed decisions based on current market conditions.
- Convert Endpoint: The conversion endpoint allows users to convert any amount from one currency to another, facilitating seamless transactions across different metals.
- Time-Series Endpoint: This endpoint enables users to query daily historical rates between two chosen dates, providing insights into price movements over time.
- Fluctuation Endpoint: Users can track how currencies fluctuate on a day-to-day basis, offering a deeper understanding of market dynamics.
- Carat Endpoint: This endpoint provides information about gold rates by carat, allowing users to make precise calculations based on purity.
- Lowest/Highest Price Endpoint: Users can query the API to get the lowest and highest prices for a specified date, aiding in market analysis.
- Open/High/Low/Close (OHLC) Price Endpoint: This endpoint provides open, high, low, and close prices for a specific date, essential for traders looking to analyze market performance.
- Historical LME Endpoint: Access historical rates for LME symbols dating back to 2008, allowing for comprehensive market analysis.
- API Key: Your unique API key is required for authentication and must be included in the API base URL's access_key parameter.
- API Response: Exchange rates are delivered relative to USD by default, with all data returned in a structured JSON format.
- Available Endpoints: The Metals-API includes 14 endpoints, each providing different functionalities to cater to various user needs.
- Supported Symbols Endpoint: This constantly updated endpoint returns all available currencies, ensuring users have access to the latest information.
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.
API Endpoint Examples and Responses
Latest Rates Endpoint
To get real-time exchange rates for all available metals, you can use the latest rates endpoint. Here’s an example of a typical response:
{
"success": true,
"timestamp": 1780532619,
"base": "USD",
"date": "2026-06-04",
"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"
}
In this response, the success field indicates whether the request was successful. The timestamp provides the time of the response, while base indicates the currency used for the exchange rates. The rates object contains the exchange rates for various metals, with each metal represented by its symbol.
Historical Rates Endpoint
Accessing historical exchange rates for any date since 1999 can be done through the historical rates endpoint. Here’s an example response:
{
"success": true,
"timestamp": 1780446219,
"base": "USD",
"date": "2026-06-03",
"rates": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915,
"XPD": 0.000748
},
"unit": "per troy ounce"
}
This response structure is similar to the latest rates endpoint, but it provides historical data for the specified date. This is particularly useful for analyzing trends and making informed decisions based on past performance.
Time-series Endpoint
The time-series endpoint allows users to get exchange rates for a specific time period. Here’s an example:
{
"success": true,
"timeseries": true,
"start_date": "2026-05-28",
"end_date": "2026-06-04",
"base": "USD",
"rates": {
"2026-05-28": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915
},
"2026-05-30": {
"XAU": 0.000483,
"XAG": 0.0382,
"XPT": 0.000913
},
"2026-06-04": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912
}
},
"unit": "per troy ounce"
}
This response provides a time series of exchange rates for the specified period, allowing users to analyze trends and fluctuations over time. Each date in the rates object contains the exchange rates for that specific day.
Convert Endpoint
The convert endpoint allows users to convert any amount from one metal to another or to/from USD. Here’s an example response:
{
"success": true,
"query": {
"from": "USD",
"to": "XAU",
"amount": 1000
},
"info": {
"timestamp": 1780532619,
"rate": 0.000482
},
"result": 0.482,
"unit": "troy ounces"
}
This response indicates a successful conversion from USD to gold (XAU). The query object shows the parameters used for the conversion, while the result field provides the converted amount in troy ounces.
Fluctuation Endpoint
To track rate fluctuations between two dates, you can use the fluctuation endpoint. Here’s an example:
{
"success": true,
"fluctuation": true,
"start_date": "2026-05-28",
"end_date": "2026-06-04",
"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 detailed information about how the rates for each metal have changed over the specified period. The change and change_pct fields are particularly useful for understanding market dynamics.
OHLC (Open/High/Low/Close) Endpoint
The OHLC endpoint provides open, high, low, and close prices for a specific time period. Here’s an example:
{
"success": true,
"timestamp": 1780532619,
"base": "USD",
"date": "2026-06-04",
"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 a comprehensive overview of the price movements for each metal on the specified date, which is essential for traders looking to analyze market performance.
Bid/Ask Endpoint
To get current bid and ask prices for metals, you can use the bid/ask endpoint. Here’s an example response:
{
"success": true,
"timestamp": 1780532619,
"base": "USD",
"date": "2026-06-04",
"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 each metal, along with the spread, which is crucial for traders making real-time decisions.
Conclusion
The Metals-API is a powerful tool for developers looking to access real-time and historical exchange rates for metals, including the United States Dollar (USD). With its comprehensive features and endpoints, the API enables users to build innovative applications that leverage real-time data analytics for market insights and trading strategies.
By utilizing the various endpoints, developers can retrieve the latest rates, historical data, perform conversions, and analyze fluctuations, all in a structured JSON format. The detailed examples provided in this blog post illustrate the practical applications of the API and how it can be integrated into various projects.
For further exploration, refer to the Metals-API Documentation for in-depth guidance, and check the Metals-API Supported Symbols page for a complete list of available symbols. The Metals-API Website is also a valuable resource for staying updated on the latest features and enhancements.
In conclusion, the Metals-API stands out as a transformative solution for accessing metals data, empowering developers to create applications that can adapt to the ever-changing financial landscape.