How to fetch LBMA Gold Pm (LBXAUPM) prices using this API
Introduction
In the world of finance and investment, gold (XAU) has always held a significant place as a store of value and a hedge against inflation. With the rise of digital transformation in precious metals trading, the ability to access real-time data has become crucial for investors and developers alike. This blog post will explore how to fetch LBMA Gold PM (LBXAUPM) prices using the Metals-API, a powerful tool that provides comprehensive data on precious metals, including gold. We will delve into the API's capabilities, its innovative features, and how it empowers developers to create next-generation applications that leverage real-time metals data.
About Gold (XAU)
Gold has been a symbol of wealth and prosperity for centuries. Its unique properties, such as scarcity, durability, and divisibility, make it an ideal medium of exchange and a reliable store of value. In recent years, the digital transformation in precious metals has led to the integration of advanced technologies in trading and price discovery. Data analytics and market insights have become essential for investors looking to make informed decisions in a volatile market.
The integration of technology in trading has opened new avenues for innovation, allowing for more efficient price discovery and enhanced trading strategies. Digital asset solutions are now available, enabling investors to trade gold and other precious metals seamlessly. As the market evolves, having access to accurate and timely data is more important than ever.
API Description
The Metals-API is a robust JSON API that provides real-time and historical data on precious metals, including gold, silver, platinum, and palladium. This API is designed for developers who want to build applications that require accurate metals pricing and conversion capabilities. With its innovative features, the Metals-API empowers users to access a wealth of information that can be used for trading, analysis, and decision-making.
One of the standout features of the Metals-API is its ability to deliver real-time exchange rate data, updated frequently based on the user's subscription plan. This ensures that developers have access to the most current information, which is critical for making timely trading decisions. Additionally, the API supports a wide range of endpoints, allowing users to retrieve historical rates, bid and ask prices, and even perform currency conversions.
For more detailed information about the API's capabilities, you can refer to the Metals-API Documentation.
Key Features and Endpoints
The Metals-API offers a variety of endpoints that cater to different needs. Here are some of the key features:
Latest Rates Endpoint
The Latest Rates Endpoint provides real-time exchange rate data for all available metals. Depending on your subscription plan, this endpoint can return updates every 60 minutes, every 10 minutes, or even more frequently. This feature is essential for traders who need to stay updated on market fluctuations.
{
"success": true,
"timestamp": 1777075762,
"base": "USD",
"date": "2026-04-25",
"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
Accessing historical rates is crucial for market analysis and trend identification. The Historical Rates Endpoint allows users to retrieve data dating back to 2019 by appending a specific date in the YYYY-MM-DD format. This feature is invaluable for developers looking to analyze past market performance.
{
"success": true,
"timestamp": 1776989362,
"base": "USD",
"date": "2026-04-24",
"rates": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915,
"XPD": 0.000748
},
"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 various metals. This information is critical for traders who need to make quick decisions based on current market conditions.
{
"success": true,
"timestamp": 1777075762,
"base": "USD",
"date": "2026-04-25",
"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"
}
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.
{
"success": true,
"query": {
"from": "USD",
"to": "XAU",
"amount": 1000
},
"info": {
"timestamp": 1777075762,
"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 essential for analyzing trends over specific periods and making informed trading decisions.
{
"success": true,
"timeseries": true,
"start_date": "2026-04-18",
"end_date": "2026-04-25",
"base": "USD",
"rates": {
"2026-04-18": {
"XAU": 0.000485,
"XAG": 0.03825,
"XPT": 0.000915
},
"2026-04-20": {
"XAU": 0.000483,
"XAG": 0.0382,
"XPT": 0.000913
},
"2026-04-25": {
"XAU": 0.000482,
"XAG": 0.03815,
"XPT": 0.000912
}
},
"unit": "per troy ounce"
}
Fluctuation Endpoint
The Fluctuation Endpoint provides information about how currencies fluctuate on a day-to-day basis. This feature is useful for traders looking to understand market volatility and make strategic decisions based on historical fluctuations.
{
"success": true,
"fluctuation": true,
"start_date": "2026-04-18",
"end_date": "2026-04-25",
"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"
}
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 essential for traders who analyze price movements and make decisions based on market trends.
{
"success": true,
"timestamp": 1777075762,
"base": "USD",
"date": "2026-04-25",
"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"
}
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 developers working with industrial metals and looking to analyze long-term trends.
API Key and Authentication
Your API Key is a unique identifier that is passed into the API base URL's access_key parameter to authenticate requests. It is essential to keep your API Key secure and not share it publicly. The API uses standard authentication practices to ensure that only authorized users can access the data.
API Response
Exchange rates 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 effective integration.
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. This resource is invaluable for developers looking to implement specific metals in their applications.
Conclusion
In conclusion, the Metals-API is a powerful tool for developers looking to access real-time and historical data on precious metals, particularly gold. With its extensive range of endpoints and features, the API empowers users to build innovative applications that leverage accurate metals pricing and conversion capabilities. By understanding the various endpoints and their functionalities, developers can create solutions that enhance trading strategies and provide valuable market insights.
As the market for precious metals continues to evolve, having access to reliable data will be crucial for making informed decisions. The Metals-API not only facilitates this access but also supports the integration of advanced technologies in trading, paving the way for a more efficient and transparent market.