Algobook
- The developer's handbook
mode-switch
back-button
Buy Me A Coffee

Exchange rates API

A complete free API for currency exchange rates. No need for API keys or signing up anywhere. We are using data from the European Central Bank to do our calculations.

Usage

Currently we have three endpoints. One for getting the current exchange rate between two currencies, one for calculating the amount if you do an exchange and one for getting all supported currencies.

GET /exchange/rate

await fetch( `https://stocks.algobook.info/api/v1/exchange/rate?from=USD&to=SEK` );

Response

{ "updated": "2023-04-25", "rate": 10.2563 }

Error

If any non supported currency is passed, we will return an error

await fetch( `https://stocks.algobook.info/api/v1/exchange/rate?from=USD&to=NON_VALID` );

Error response

{ "error": "NON_VALID was not found" }

GET /exchange/convert

To do a conversion, you can use our /convert endpoint where you pass in currencies and amount to be converted.

await fetch( `https://stocks.algobook.info/api/v1/exchange/convert?from=USD&to=SEK&amount=15` );

Response

{ "updated": "2023-04-25", "amount": 153.84 }

Error

We will return errors like we do for the /rate endpoint

await fetch( `https://stocks.algobook.info/api/v1/exchange/convert?from=USD&to=NON_VALID&amount=15` );

Error response

{ "error": "NON_VALID was not found" }

GET /currencies

await fetch(`https://stocks.algobook.info/api/v1/exchange/currencies`);

Response

[ { "code": "USD", "name": "US dollar" }, { "code": "JPY", "name": "Japanese yen" }, { "code": "BGN", "name": "Bulgarian lev" }, { "code": "CZK", "name": "Czech koruna" }, { "code": "DKK", "name": "Danish krone" }, { "code": "GBP", "name": "Pound sterling" }, { "code": "HUF", "name": "Hungarian forint" }, { "code": "PLN", "name": "Polish zloty" }, { "code": "RON", "name": "Romanian leu" }, { "code": "SEK", "name": "Swedish krona" }, { "code": "CHF", "name": "Swiss franc" }, { "code": "ISK", "name": "Icelandic krona" }, { "code": "NOK", "name": "Norwegian krone" }, { "code": "TRY", "name": "Turkish lira" }, { "code": "AUD", "name": "Australian dollar" }, { "code": "BRL", "name": "Brazilian real" }, { "code": "CAD", "name": "Canadian dollar\t" }, { "code": "CNY", "name": "Chinese yuan renminbi" }, { "code": "HKD", "name": "Hong Kong dollar" }, { "code": "IDR", "name": "Indonesian rupiah" }, { "code": "ILS", "name": "Israeli shekel" }, { "code": "INR", "name": "Indian rupee" }, { "code": "KRW", "name": "South Korean won" }, { "code": "MXN", "name": "Mexican peso" }, { "code": "MYR", "name": "Malaysian ringgit" }, { "code": "NZD", "name": "New Zealand dollar" }, { "code": "PHP", "name": "Philippine peso\t" }, { "code": "SGD", "name": "Singapore dollar" }, { "code": "THB", "name": "Thai baht" }, { "code": "ZAR", "name": "South African rand" }, { "code": "EUR", "name": "Euro" } ]

Feedback and improvements

If you feel something is missing our have any feature request. Please send us an e-mail and we will do all we can to improve this API. Contact info is found here.

signature
See all our articlesSee all our open source projects