Exchange Rate
Get live currency exchange rates and convert amounts between currencies. Rates are sourced from the European Central Bank via Frankfurter and cached for up to one hour.
Descripción general
Casos de uso
- E-commerce multi-currency pricing
- Fintech apps and payment processors
- Travel and expense management tools
- Financial dashboards and reporting
- Invoice generation in foreign currencies
Funcionalidades
Puntos finales de la API
Get Exchange Rate
Returns the current exchange rate between two currencies.
https://requiems.xyz/v1/finance/exchange-rate
Parámetros
| Nombre | Tipo | Obligatorio | Descripción |
|---|---|---|---|
| from | string |
Obligatorio | ISO 4217 source currency code (3 letters, e.g. USD) |
| to | string |
Obligatorio | ISO 4217 target currency code (3 letters, e.g. EUR) |
Pruébalo
Demostración en vivoSolicitud
ISO 4217 source currency code (3 letters, e.g. USD)
ISO 4217 target currency code (3 letters, e.g. EUR)
Campos de respuesta
| Campo | Tipo | Descripción |
|---|---|---|
| from | string |
Source currency code (uppercased) |
| to | string |
Target currency code (uppercased) |
| rate | number |
Exchange rate — how many units of `to` equal 1 unit of `from` |
| timestamp | string |
Date the rate was published by the ECB (ISO 8601) |
Ejemplos de código
curl "https://requiems.xyz/v1/finance/exchange-rate?from=USD&to=EUR" \
-H "requiems-api-key: YOUR_API_KEY"
import requests
url = "https://requiems.xyz/v1/finance/exchange-rate"
headers = {"requiems-api-key": "YOUR_API_KEY"}
params = {"from": "USD", "to": "EUR"}
response = requests.get(url, headers=headers, params=params)
data = response.json()["data"]
print(data["rate"]) # 0.92
const params = new URLSearchParams({ from: 'USD', to: 'EUR' });
const response = await fetch(
`https://requiems.xyz/v1/finance/exchange-rate?${params}`,
{ headers: { 'requiems-api-key': 'YOUR_API_KEY' } }
);
const { data } = await response.json();
console.log(data.rate); // 0.92
require 'net/http'
require 'json'
uri = URI('https://requiems.xyz/v1/finance/exchange-rate')
uri.query = URI.encode_www_form(from: 'USD', to: 'EUR')
request = Net::HTTP::Get.new(uri)
request['requiems-api-key'] = 'YOUR_API_KEY'
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
data = JSON.parse(response.body)['data']
puts data['rate'] # 0.92
Respuestas de error
A required parameter is missing or the currency code is not exactly 3 alphabetic characters.
One or both currency codes are not recognised by the upstream data source.
The exchange rate data source is temporarily unavailable.
Convert Currency
Converts an amount from one currency to another and returns the rate alongside the converted value.
https://requiems.xyz/v1/finance/convert
Parámetros
| Nombre | Tipo | Obligatorio | Descripción |
|---|---|---|---|
| from | string |
Obligatorio | ISO 4217 source currency code (3 letters, e.g. USD) |
| to | string |
Obligatorio | ISO 4217 target currency code (3 letters, e.g. EUR) |
| amount | number |
Obligatorio | Amount to convert. Must be greater than 0. |
Pruébalo
Demostración en vivoSolicitud
ISO 4217 source currency code (3 letters, e.g. USD)
ISO 4217 target currency code (3 letters, e.g. EUR)
Amount to convert. Must be greater than 0.
Campos de respuesta
| Campo | Tipo | Descripción |
|---|---|---|
| from | string |
Source currency code (uppercased) |
| to | string |
Target currency code (uppercased) |
| rate | number |
Exchange rate used for the conversion |
| amount | number |
The original amount passed in the request |
| converted | number |
Result of amount × rate, rounded to 2 decimal places |
| timestamp | string |
Date the rate was published by the ECB (ISO 8601) |
Ejemplos de código
curl "https://requiems.xyz/v1/finance/convert?from=USD&to=EUR&amount=100" \
-H "requiems-api-key: YOUR_API_KEY"
import requests
url = "https://requiems.xyz/v1/finance/convert"
headers = {"requiems-api-key": "YOUR_API_KEY"}
params = {"from": "USD", "to": "EUR", "amount": 100}
response = requests.get(url, headers=headers, params=params)
data = response.json()["data"]
print(data["converted"]) # 92.0
print(data["rate"]) # 0.92
const params = new URLSearchParams({ from: 'USD', to: 'EUR', amount: 100 });
const response = await fetch(
`https://requiems.xyz/v1/finance/convert?${params}`,
{ headers: { 'requiems-api-key': 'YOUR_API_KEY' } }
);
const { data } = await response.json();
console.log(data.converted); // 92
console.log(data.rate); // 0.92
require 'net/http'
require 'json'
uri = URI('https://requiems.xyz/v1/finance/convert')
uri.query = URI.encode_www_form(from: 'USD', to: 'EUR', amount: 100)
request = Net::HTTP::Get.new(uri)
request['requiems-api-key'] = 'YOUR_API_KEY'
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|
http.request(request)
end
data = JSON.parse(response.body)['data']
puts data['converted'] # 92.0
puts data['rate'] # 0.92
Respuestas de error
A required parameter is missing, the currency code is not 3 alphabetic characters, or the amount is 0 or negative.
One or both currency codes are not recognised by the upstream data source.
The exchange rate data source is temporarily unavailable.