Historical Rates Endpoint
Historical rates are available for most currencies all the way back to the year of 2019. You can query the Metals-API API for historical rates by appending a date (format YYYY-MM-DD
) to the base URL.
Note: For LMBA and LME markets, the prices provided in this endpoint, correspond to the closing price of that day.
API Request:
https://metals-api.com/api/2013-12-24 ? access_key = API_KEY & base = GBP & symbols = USD,CAD,EUR
Request Parameters:
Parameter | Description |
---|---|
YYYY-MM-DD |
[required] A date in the past for which historical rates are requested. |
access_key |
[required] Your API Key. |
base |
[optional] Enter the three-letter currency code or metal code of your preferred base currency. Default USD. |
symbols |
[required] Enter a list of comma-separated currency codes or metal codes to limit output currencies. (The number of symbols per API request depends on the acquired plan). |
API Response:
{ "success": true, "historical": true, "date": "2013-12-24", "timestamp": 1387929599, "base": "GBP", "rates": { "USD": 1.636492, "EUR": 1.196476, "CAD": 1.739516 } }
Response Objects:
Response Object | Description |
---|---|
success |
Returns true or false depending on whether or not your API request has succeeded. |
historical |
Returns true if a request for historical exchange rates was made. |
date |
Returns the date for which historical rates were requested. |
timestamp |
Returns the exact date and time (UNIX time stamp) the given rates were collected. |
base |
Returns the three-letter currency code or metal code of the base currency used for this request. |
rates |
Returns exchange rate data for the currencies you have requested. |
Example request in Postman:
https://metals-api.com/api/2023-12-11?access_key=YOUR_API_KEY&base=GBP&symbols=XAU
Example request in Postman with multiple symbols (The number of symbols per API request depends on the acquired plan):
https://metals-api.com/api/2023-12-11?access_key=YOUR_API_KEY&base=USD&symbols=XAU,XAG
In the case of using USD as the base, you will need to perform 1/value. For example:
1/0.043822133794743 = 22.8195186634