Exchange Rate

Convert an on-chain amount to a fiat currency

Quotes the given on-chain amount in the requested fiat currency via the rate oracle. Used to show wallet balances in the application preferred currency. The value is returned in reference sub-units (centi-units of the currency).

get/v1/exchange-rate/convert

Request

  • Base URL: https://api.prod.keyban.io
  • URL: https://api.prod.keyban.io/v1/exchange-rate/convert
  • Auth: API key in header X-Api-Key

Query parameters

asset'USDC' | 'ETH' required

On-chain asset to convert.

amountstring required

Raw amount to convert, in the asset base units (USDC: 6 decimals, ETH: 18). Passed as a string to preserve bigint precision.

currency'EUR' | 'USD' | 'JPY' required

Target fiat currency (ISO 4217).

Response

asset'USDC' | 'ETH' required

On-chain asset that was converted.

amountstring required

Raw on-chain amount that was converted, in the asset base units (USDC has 6 decimals, ETH 18). Echoed back from the request.

currency'EUR' | 'USD' | 'JPY' required

Fiat currency (ISO 4217) the amount was converted to.

valueRefstring required

Converted value in reference sub-units of currency (centi-units — divide by 100 for the major amount, uniform across currencies incl. JPY). Live quote from the rate oracle; subject to a short cache.

Example response

{
  "asset": "USDC",
  "amount": "1250500000",
  "currency": "EUR",
  "valueRef": "118750"
}

Changes

No recorded changes to this operation across all 1 revision of this API.