Convert
This endpoint allows users to convert an amount from one currency to another. Users can optionally specify a date to use historical exchange rates.
Endpoint
GET /api/v1/currencies/{currency_from}_{currency_to}
Request
URL params
-
currency_from * string
The base currency as a 3-letter code (eg.
EUR) -
currency_to * string
The target currency as a 3-letter code (eg.
USD)
Query params
-
amount * float64
The value to be converted (eg.
267.88) -
date string
A date in format
YYYY-MM-DDto use historical rates. (eg.2005-03-05)
Example
/api/v1/convert/USD_EUR?amount=267.88&date=1999-05-18
Response
200
Successful
{
"status": 200,
"data": {
"base": "USD",
"currency": "EUR",
"date": "2024-07-1",
"value": 250.5893
}
}
400
Validation error
{
"status": 400,
"errors": [
{
"key": "convertQueryRequest.Amount",
"validator": "required"
}
]
}