Get Bitcoin (BTC) prices using this API

Get Bitcoin (BTC) Prices Using This API
In the rapidly evolving world of cryptocurrency, having access to real-time data is essential for developers and traders alike. One of the most powerful tools available for obtaining Bitcoin (BTC) prices and other metal data is the Metals-API. This API not only provides current prices but also offers a wealth of historical data, making it an invaluable resource for anyone looking to build applications or conduct analysis in the cryptocurrency and metals markets.
Metals-API Information
API Description
The Metals-API is a robust platform that delivers real-time and historical data on various metals, including precious metals like gold (XAU), silver (XAG), platinum (XPT), and palladium (XPD). With its innovative architecture, the API empowers developers to create next-generation applications that require accurate and timely data. The API's capabilities extend beyond mere price retrieval; it allows for complex queries, historical analysis, and even conversion between different metal types.
By leveraging the Metals-API Documentation, developers can explore a variety of endpoints that cater to different data needs, whether it’s for real-time trading applications, market analysis, or financial reporting. The API's transformative potential lies in its ability to provide comprehensive data that can drive informed decision-making.
Key Features and Endpoints
The Metals-API boasts several key features that make it a standout choice for developers:
- Latest Rates Endpoint: This endpoint provides real-time exchange rates for all available metals. It is crucial for applications that require up-to-the-minute pricing information.
- Historical Rates Endpoint: Access to historical exchange rates allows developers to analyze trends over time, making it easier to forecast future movements.
- Time-series Endpoint: This feature enables users to retrieve exchange rates for a specific time period, which is particularly useful for backtesting trading strategies.
- Convert Endpoint: The ability to convert between different metals or to/from USD is essential for applications that require flexible pricing models.
- Fluctuation Endpoint: Track rate fluctuations between two dates to understand market volatility and make informed trading decisions.
- OHLC (Open/High/Low/Close) Endpoint: This endpoint provides detailed market data for a specific time period, essential for technical analysis.
- Bid/Ask Endpoint: Get current bid and ask prices for metals, which is vital for trading applications that require precise entry and exit points.
List of Symbols
The 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. This extensive list includes not only precious metals but also industrial metals, allowing developers to cater to a wide array of market needs.
API Endpoint Examples and Responses
Understanding the structure and content of API responses is crucial for effective integration. Below are examples of various endpoints and their responses:
Latest Rates Endpoint
The Latest Rates Endpoint provides real-time exchange rates for all available metals. Here’s an example response:
{
"success": true,
"timestamp": 1757876432,
"base": "USD",
"date": "2025-09-14",
"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 rates
object contains the current price of various metals, with the base currency set to USD. Each metal symbol corresponds to its price per troy ounce.
Historical Rates Endpoint
Accessing historical exchange rates is essential for trend analysis. Here’s an example response:
{
"success": true,
"timestamp": 1757790032,
"base": "USD",
"date": "2025-09-13",
"rates": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915,
"XPD": 0.000748
},
"unit": "per troy ounce"
}
This response shows the historical rates for a specific date, allowing developers to analyze past performance and make predictions based on historical data.
Time-series Endpoint
The Time-series Endpoint allows users to retrieve exchange rates for a specific time period. Here’s an example response:
{
"success": true,
"timeseries": true,
"start_date": "2025-09-07",
"end_date": "2025-09-14",
"base": "USD",
"rates": {
"2025-09-07": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915
},
"2025-09-09": {
"XAU": 0.000483,
"XAG": 0.0382,
"XPT": 0.000913
},
"2025-09-14": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912
}
},
"unit": "per troy ounce"
}
This response provides a series of rates over a specified date range, which is particularly useful for visualizing trends and patterns in metal prices.
Convert Endpoint
The Convert Endpoint allows for conversion between different metals or to/from USD. Here’s an example response:
{
"success": true,
"query": {
"from": "USD",
"to": "XAU",
"amount": 1000
},
"info": {
"timestamp": 1757876432,
"rate": 0.000482
},
"result": 0.482,
"unit": "troy ounces"
}
This response indicates that 1000 USD converts to 0.482 troy ounces of gold (XAU) at the current exchange rate.
Fluctuation Endpoint
The Fluctuation Endpoint tracks rate fluctuations between two dates. Here’s an example response:
{
"success": true,
"fluctuation": true,
"start_date": "2025-09-07",
"end_date": "2025-09-14",
"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 prices have changed over a specified period, which is crucial for understanding market dynamics.
OHLC (Open/High/Low/Close) Endpoint
The OHLC Endpoint provides detailed market data for a specific time period. Here’s an example response:
{
"success": true,
"timestamp": 1757876432,
"base": "USD",
"date": "2025-09-14",
"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 the opening, highest, lowest, and closing prices for metals over a specified period, which is essential for traders conducting technical analysis.
Bid/Ask Endpoint
The Bid/Ask Endpoint provides current bid and ask prices for metals. Here’s an example response:
{
"success": true,
"timestamp": 1757876432,
"base": "USD",
"date": "2025-09-14",
"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, along with the spread, which is crucial for traders looking to make informed buying and selling decisions.
Conclusion
The Metals-API is an essential tool for developers and traders in the cryptocurrency and metals markets. Its comprehensive features, including real-time pricing, historical data access, and conversion capabilities, make it a versatile resource for building applications that require accurate and timely information. By utilizing the various endpoints, developers can create sophisticated applications that analyze market trends, track price fluctuations, and provide valuable insights into the metals market.
For more information on how to implement these features, refer to the Metals-API Documentation and explore the Metals-API Supported Symbols to understand the full range of data available. The Metals-API Website is also a valuable resource for staying updated on new features and enhancements.
In summary, the Metals-API not only simplifies the process of obtaining metal prices but also opens up new avenues for innovation in financial applications. By harnessing the power of real-time data, developers can create solutions that are not only effective but also transformative in the way they approach market analysis and trading strategies.