LabStack Docs
Login Signup

Currency Convert

Convert currency from one to another using an accurate and reliable exchange rates

Request

GET https://currency.labstack.com/api/v1/convert/:amount/:from/:to

Parameter Description Type Required Default
amount Amount to be converted Number Yes
from Currency source code String Yes
to Currency target code String Yes
curl \
  -X GET https://currency.labstack.com/api/v1/convert?from=USD&to=INR&amount=5 \
  -H 'Authorization: Bearer <API_KEY>'
c := labstack.NewClient("<API_KEY>")
s := c.Currency()
res, err := s.Convert(&currency.ConvertRequest{
  Amount: 10,
  From:   "USD",
  To:     "INR",
})
if err != nil {
  fmt.Println(err)
}
Client client = new Client("<API_KEY>");
CurrencyService service = client.currency();
try {
  ConvertRequest request = ConvertRequest.builder().amount(10D).from("USD").to("INR").build();
  ConvertResponse response = service.convert(request);
} catch (LabStackException e) {
  e.printStackTrace();
}
const client = new Client("<API_KEY>")
const service = client.currency();
try {
  const response = await service.convert({
    amount: 10,
    from: "USD",
    to: "INR"
  });
} catch (error) {
  console.error(error);
}
client = Client("<API_KEY>")
service = client.currency()
try:
  response = service.convert({
    'amount': 10,
    'from': 'USD',
    'to': 'INR'
  })
except LabStackError as e:
  print(e)

Response

{
  "time": "2019-07-27T16:20:00Z",
  "amount": 688.6
}
Parameter Description Type
time Rate updated time Date
amount Converted amount Number