UnifyUnits Developers

Currency

POST /v1/currency/convert converts between currencies using the European Central Bank (ECB) euro reference rates, and GET /v1/currency/rates lists them. Amounts and rates are decimal strings, and the conversion is exact: the result is value × toRate ÷ fromRate rounded once at the end if you set decimals.

About the rates

  • Source: ECB euro foreign exchange reference rates, about 30 currencies plus EUR. They are reference rates for informational use, not tradable quotes.
  • The ECB publishes once per TARGET business day, around 16:00 CET. Every response includes rate.date, the publication date used.
  • Cross rates go through EUR, so USD to GBP is GBP ÷ USD as quoted per euro. rate.value is that exact rate.
  • Currency codes are case-insensitive. Unsupported codes return UNKNOWN_CURRENCY.

Example

bash
curl "https://api.unifyunits.com/v1/currency/convert" \
  -X POST \
  -H "Authorization: Bearer $UNIFYUNITS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"value":"100","from":"USD","to":"GBP","decimals":2}'
json
{
  "data": {
    "input": { "value": "100", "unit": "USD" },
    "result": { "value": "64.00", "unit": "GBP" },
    "rate": { "date": "2026-10-02", "source": "ecb", "value": "0.64" }
  }
}

Historical rates

Add date (YYYY-MM-DD) to either endpoint to use the rates in effect on that day. This requires the Developer plan or higher; other plans receive PLAN_REQUIRED (HTTP 403). A weekend or holiday resolves to the previous publication, and rate.date shows which day was used. Dates with no data return RATE_NOT_FOUND.

Usage and availability

  • A successful conversion uses one conversion from your monthly quota. Failed conversions and listing rates are free.
  • If rates cannot be loaded the API returns SERVICE_UNAVAILABLE (HTTP 503); retry with backoff.