Skip to content

Display currency

Last updated: 2026-11-22T06:50:00-03:00 (UTC-3)

The gateway counts, budgets and enforces in USD, always. With fx_display, the console and the report and analytics responses can also show amounts in another currency, converted with the daily reference rate of the European Central Bank (ECB) and always labelled with that rate’s date. A budget typed in another currency is converted to USD once, when you save it, and stored in USD with the rate used.

features:
fx_display: true # off by default; requires PostgreSQL (migration 184)
fx:
default_display_currency: USD # gateway default; USD, EUR or an ECB reference currency
refresh_interval: 6h # 1h to 24h; how often each replica fetches the ECB file
stale_after: 96h # 24h to 336h; an older rate shows USD with a notice
Key Default What it does
fx.default_display_currency USD The currency amounts are shown in when neither the user nor the organization chose one
fx.refresh_interval 6h How often each replica fetches the ECB reference rates, 1h–24h
fx.stale_after 96h How old the latest rate date may be before amounts fall back to USD with a notice, 24h–336h; the default spans a weekend plus a holiday

fx_display is an operator flag; it can be switched in the console. The fx settings are read on every cycle and request.

  • A background job on every replica fetches https://www.ecb.europa.eu/stats/eurofxref/eurofxref-daily.xml every refresh_interval (and at start). No account or key is needed, and no request ever waits for it.
  • The file gives units per euro. The gateway stores units per USD: rate(X) / rate(USD), and for the euro 1 / rate(USD), computed exactly and rounded half to even at 10 decimals. Each row keeps its source (ecb), the rate date and when it was fetched. A day already stored is never rewritten.
  • A failed fetch keeps the last stored day. Its date then ages; once it is older than stale_after (counted from the end of the rate date), amounts are shown in USD with a notice. A rate is never guessed or carried forward silently.

Currencies: USD, EUR, JPY, CZK, DKK, GBP, HUF, PLN, RON, SEK, CHF, ISK, NOK, TRY, AUD, BRL, CAD, CNY, HKD, IDR, ILS, INR, KRW, MXN, MYR, NZD, PHP, SGD, THB, ZAR and BGN (when the ECB publishes it).

The effective currency is, in order: the user’s own choice, then the user’s organization, then fx.default_display_currency.

In the console: Settings & sources → Display currency. A named console user picks My display currency; a global admin, or an organization admin for its own organization, picks the Organization display currency. The panel shows the latest rate date and any notice, and, read-only, the effective fx.refresh_interval and fx.stale_after (restart required to change them). GET /api/v1/admin/fx returns the three fx.* settings under their YAML names: default_display_currency, refresh_interval and stale_after.

Through the API:

Terminal window
curl -sS -b "$COOKIE_FILE" "$BASE_URL/api/v1/admin/fx"
curl -sS -b "$COOKIE_FILE" -H "X-CSRF-Token: $CSRF" -H 'Content-Type: application/json' \
-X PUT -d '{"scope":"user","currency":"EUR"}' "$BASE_URL/api/v1/admin/fx/preference"

For an organization: {"scope":"organization","organization_id":"org_research","currency":"BRL"}. A global admin names the organization; an organization admin may omit it and always sets its own.

An empty currency clears the choice. The shared admin and viewer tokens have no personal preference (422) and use the organization or gateway default. Every change is audited as fx.preference.

Responses keep every *_usd field unchanged and add a display_currency object:

"display_currency": {"currency": "EUR", "status": "ok", "per_usd": "0.91000091",
"rate_date": "2026-11-17", "source": "ecb", "chosen": "EUR", "from": "user"}

status is usd (nothing to convert), ok, stale or missing; only ok converts, and then currency is the display currency. Otherwise currency is USD and notice says why.

Response Added
GET /api/v1/admin/valuation display_currency, and known_amount_display when ok
GET /api/v1/admin/analytics/query with cost_usd display_currency, and a cost_display column after the others when ok
Console: Estimated cost (valuation) “≈ 9.10 EUR · ECB rate of 2026-11-17” under the USD amount, or the notice

Converted amounts are rounded half to even to the currency’s minor units (0 decimals for JPY, ISK and KRW, 2 for the others). They are display values: exports, budgets, alerts, invoices and the ledger stay in USD.

Send budget_entered instead of policy.budget_usd when you create or edit a quota policy:

PUT /api/v1/admin/quota-policies/team_research_monthly
{"version": 12, "base_fingerprint": "...",
"policy": {"id": "team_research_monthly", "subject": "team", "subject_id": "research", "budget_period": "month"},
"budget_entered": {"amount": "500", "currency": "EUR"}}
  • The amount is converted once, at the latest fresh rate: amount / per_usd, rounded half to even at 6 decimals, and saved as budget_usd. From then on the budget is that USD value; later rate changes do not move it.
  • The answer includes budget_entered with the amount, the currency, the rate and its date; GET /api/v1/admin/fx/budget-conversions?policy_id=... (global admin) lists them.
  • With a missing or stale rate the request answers 409 fx_rate_unavailable and nothing is saved. Sending both budget_usd and budget_entered is 400.
  • If the conversion record cannot be written after the policy is saved, the answer is 503: the budget is saved in USD; read it back before retrying.
  • Rates are ECB reference rates for information, not transaction rates.
  • An older binary ignores the rates and preferences and refuses budget_entered: remove fx and the flag from YAML before rolling back.

Every route below needs a console session or an admin Bearer token, the role’s permission and, for writes, the X-CSRF-Token header; the full contract is in the API reference.

Route What it does
GET /api/v1/admin/fx The default, user and organization display currencies, the effective one and the latest stored rates
PUT /api/v1/admin/fx/preference Sets or clears the display currency of the session user, or of an organization

m7gtwcontact@m7gtw.com