Delegation Endpoints

The accounts, rates, quote, and order endpoints you implement for Lirium to call

These four endpoints are implemented and hosted by you, the Banking Partner. Lirium calls them to read Customer balances and rates, price an operation, and settle it. They are the counterpart to the Delegation Accounts product.

📘

These are your endpoints

Unlike the rest of the API Reference, these operations are not served by Lirium. You expose them on your own host, and Lirium acts as the client. Every request is authenticated with a JWT signed by Lirium — see Authenticating Lirium's requests.

All amounts are strings. Currency codes are uppercase (USD, ARS, BTC).


Get Accounts

Lists the Customer's accounts available on your platform, with their balances.

GET /accounts

Response

{
  "accounts": [
    { "id": "1234", "currency": "ARS", "balance": "1000.00", "name": "Mi cuenta en pesos" },
    { "id": "abcd", "currency": "USD", "balance": "100.00", "name": "Mi cuenta en dólares" }
  ]
}
FieldTypeRequiredDescription
accountsarrayYesThe Customer's accounts.
accounts[].idstringYesAccount identifier. An id lets a Customer hold more than one balance in the same currency. If you keep a single balance per currency and do not want to expose an account id, return the currency code as the id.
accounts[].currencystringYesCurrency code of the account.
accounts[].balancestringYesCurrent balance, as a string.
accounts[].namestringNoDisplay name shown in the WebApp. If omitted, the WebApp builds a description from your partner name (e.g. Mi cuenta {partner_name}).

Get Rates

Returns the rates for the currencies the Customer operates. Lirium uses them to price operations.

GET /rates

Response

{
  "ARS": { "base": "USD", "quote": "ARS", "buy": "1400", "sell": "1350" },
  "USD": { "base": "USD", "quote": "USD", "buy": "1.001", "sell": "0.999" }
}

The response is keyed by currency code. Each entry describes the price of that currency against the settlement base.

FieldTypeRequiredDescription
basestringYesBase currency of the pair.
quotestringYesQuote currency of the pair.
buystringYesPrice applied when the Customer is buying.
sellstringYesPrice applied when the Customer is selling.

Create Quote

Prices a debit or credit operation for the Customer. Lirium requests a quote whenever a Customer starts a buy or sell so it can show the final amount in the selected currency.

POST /quote

Depending on what the Customer entered, the amount can be denominated in either currency. Lirium sends the amount on the side it knows; you compute the missing amount, honoring the from → to direction.

📘

Settlement in the account currency

Even when the settlement currency matches the Customer's account currency, Lirium still requests a quote. This lets you apply a different amount to account for a commission or operating cost.

Request

{
  "from": { "currency": "ARS", "account_id": "1234" },
  "to": { "currency": "USD", "amount": "101.23" }
}
FieldTypeRequiredDescription
from.currencystringYesSource currency.
from.account_idstringNoThe Customer account the operation debits, when from is the account side.
from.amountstringNoPresent when the operation is denominated on the from side.
to.currencystringYesDestination currency.
to.account_idstringNoThe Customer account the operation credits, when to is the account side.
to.amountstringNoPresent when the operation is denominated on the to side.

Exactly one of from.amount / to.amount is present in the request. Fill in the other in the response.

Response

{
  "from": { "currency": "ARS", "amount": "120000", "account_id": "1234" },
  "to": { "currency": "USD", "amount": "101.23" },
  "id": "xyz"
}
FieldTypeRequiredDescription
fromobjectYesSource side, with both currency and amount resolved.
toobjectYesDestination side, with both currency and amount resolved.
idstringNoQuote identifier. If you return one, Lirium stores it and includes it as quote_id on the matching order, so you can honor the same price.

Create Order

Executes the fiat transfer between the Customer's account and your settlement account.

POST /order

The operation states the direction of the transfer:

  • debit — debit the Customer account (asset) and credit your settlement account. Used when the Customer buys crypto.
  • credit — debit your settlement account and credit the Customer account (asset). Used when the Customer sells crypto.

Use lirium_id as an idempotency key: if you receive the same value again (for example on a retry), return the original result instead of transferring again. If a quote_id is present, apply the price from that quote.

Request

{
  "operation": "debit",
  "asset": { "id": "1234", "currency": "ARS", "amount": "120000" },
  "settlement": { "currency": "USD", "amount": "101.23" },
  "quote_id": "xyz",
  "lirium_id": "a1b2c3e4f5"
}
FieldTypeRequiredDescription
operationstringYesdebit or credit. Direction of the fiat transfer.
asset.idstringYesThe Customer account to move funds on.
asset.currencystringYesCurrency of the Customer account.
asset.amountstringYesAmount to move on the Customer account, as quoted.
settlement.currencystringYesCurrency of your settlement account.
settlement.amountstringYesAmount to move on your settlement account, as quoted.
quote_idstringNoThe quote to apply, when one was returned by POST /quote.
lirium_idstringYesID of the order in Lirium. Idempotency key for the transfer.

If the rate moved and the Customer amount changed, return the updated final amount in the response.

Response

{
  "id": "x",
  "state": "completed",
  "operation": "debit",
  "asset": { "id": "1234", "currency": "ARS", "amount": "120000" },
  "settlement": { "currency": "USD", "amount": "101.23" },
  "quote_id": "xyz",
  "lirium_id": "a1b2c3e4f5"
}
FieldTypeRequiredDescription
idstringYesYour identifier for the transfer.
statestringYesFinal state of the transfer, e.g. completed.
operationstringYesEchoes the request operation.
assetobjectYesThe Customer side of the transfer, with the final amount.
settlementobjectYesThe settlement side of the transfer, with the final amount.
quote_idstringNoEchoes the request quote_id, when present.
lirium_idstringYesEchoes the request lirium_id.

Did this page help you?