HNB Exchange Rate Lookup API

If you want to access the HNB exchange rate from your web, mobile or desktop application, you can use our JSON-based REST API for getting the exchange rate. This is the same API used by our web service.

There are no limits or throttling for the API, but we ask you to please be considerate.

Also, while we will do our best to ensure the availability of the API service and correctness of data, we can't provide any guarantees or warranties about either.

Calling the API

Now for the fun part: to get the rates for a particular date, make a HTTP call to the following URL:

http://hnbex.eu/api/v1/rates/daily/?date=YYYY-MM-DD

The date parameter is optional. If not set, the current date (today) is used.

The server will respond with a HTTP status code 200 (OK) and a JSON document with the following format:

    [
        {
            "currency_code": "EUR",
            "unit_value": 1,
            "buying_rate": "7.491394",
            "median_rate": "7.513936",
            "selling_rate": "7.536478",
        }, ...
    ]
    

The list contains all the rates for all the currencies HNB covers in its exchange rate list.

Cross-domain requests from JavaScript

If you want to make the cross-domain requests directly from the user browser, you can use the JSONP variant by specifying the callback query parameter (this is what jQuery does by default for JSONP requests).

Errors

In case of errors, an appropriate HTTP response will be returned with one of the following status codes: