If you have ever integrated with the HNB v2 or v3 API, you will have noticed its non-standard data formatting, numbers as text and similar issues. There is also the issue of availability. As part of our ongoing efforts to improve SmartAccount and give back to the community, we now provide free access to exchange rate data for USD, GBP and JPY currencies, and for historical data also EUR.

The API is also available without a SmartAccount account.

1

Example: USD ($) exchange rate

Terminal
$ curl "https://app.smartaccount.hr/api/rates?currency=USD" | jq
Response
{
  "data": {
    "buying": 1.0824,
    "middle": 1.0808,
    "selling": 1.0792
  },
  "meta": {
    "date": "2023-08-28",
    "currency": "USD",
    "base_currency": "EUR"
  }
}

Values use the decimal type.

2

Historical data

You can specify a date to view historical data. The date must be sent in ISO8601 format.

Terminal
$ curl "https://app.smartaccount.hr/api/rates?currency=USD&date=2023-05-01" | jq
Response
{
  "data": {
    "buying": 1.0997,
    "middle": 1.0981,
    "selling": 1.0965
  },
  "meta": {
    "date": "2023-05-01",
    "currency": "USD",
    "base_currency": "EUR"
  }
}
3

Error 400

The API returns a 400 Bad request error with an explanation.

Terminal
$ curl "https://app.smartaccount.hr/api/rates" | jq
Response
{
  "errors": {
    "currency": [
      "can't be blank"
    ]
  }
}
4

Validation

FieldDescription
currencyPossible values: USD, GBP, JPY, EUR
dateISO8601 format (e.g. 2023-01-01), must not be in the future

Note: EUR can only be requested for dates before 2023-01-01.

5

Availability and versioning

The API is entirely free to integrate into existing and new systems, with a soft limit of 10 requests per second.

The API will not change, except for the addition of new currencies depending on client needs and requests.

For further questions, please contact us.