Skip to content
Stablecoin quote

LCX Liberty. American DeFi. Your keys. Your assets. Your control.

Stablecoin API

Stablecoin quote

POST /v1/stablecoins/quote prices a conversion and measures it against its anchor, or refuses it.

Request

POST/v1/stablecoins/quote
Body
chainId*number

The chain both coins are on. A conversion never crosses chains: there is no toChainId here.

tokenIn*string

The stablecoin being sold. Must be in the registry for chainId, or the request is refused with not_a_stablecoin.

tokenOut*string

The stablecoin being bought. The same rule, and it must differ from tokenIn.

amountIn*string

The amount to sell in base units, as on /v1/quote. Required unless amount is sent; never both.

amountstring

The same amount in human units, e.g. "250000", scaled by the token's own decimals.

decimalsnumber

Optional and best left out, with the same rules as /v1/quote (decimals_mismatch, decimals_required).

maxParDeviationBpsnumber

Your tolerance: how far below the anchor you accept, in basis points. Default 50, above 0 and at most 100, and it may be fractional (2.5). A quote further below the anchor is refused with below_tolerance; a value out of range with bad_tolerance.

slippageBpsnumber

The bound against the quote itself. Default 30. The swap's minimum output is the tighter of this and your tolerance; see Tolerance and the floor.

allowOffPegboolean

Default false. Buying a coin that trades more than 1% from its peg is refused with off_peg unless this is true.

integratorstring

Your integration, exactly as on /v1/quote: an address, or a slug we registered for you. A fee you registered is taken from the output and stated in quote.fee; none is taken otherwise.

* required

json
{
  "chainId": 1,
  "tokenIn":  "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
  "tokenOut": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
  "amount": "250000",
  "maxParDeviationBps": 10
}

Example

bash
curl -X POST https://swap-api.lcx.com/v1/stablecoins/quote \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "chainId": 1,
    "tokenIn":  "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
    "tokenOut": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
    "amount": "250000",
    "maxParDeviationBps": 10
  }'

Response

json
{
  "success": true,
  "data": {
    "quote": {
      "quoteId": "q_1_2_1785331092",
      "chainId": 1,
      "input":  { "token": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", "amount": "250000000000", "decimals": 6 },
      "output": {
        "token": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
        "decimals": 6,
        "amount": "250022500000",
        "minimumAmount": "249272432500"
      },
      "fee": { "bps": 0, "amount": "0", "integratorSource": "none" },
      "priceImpactPct": 0.0,
      "usdValueIn": 250000.0,
      "usdValueOut": 250022.5,
      "gasFeeUSD": 0.41,
      "slippageBps": 30,
      "venues": ["curve-stable-ng", "uniswap-v3"],
      "expiresAt": 1785331212
    },
    "stablecoin": {
      "anchor": "USD par",
      "currencyIn": "USD",
      "currencyOut": "USD",
      "parDeviationBps": 0.9,
      "maxParDeviationBps": 10,
      "minOut": "249772477500",
      "slippageBps": 10,
      "offPegChecked": true,
      "named": true
    }
  }
}

data.quote is the /v1/quote answer, field for field; see its reference. Some of its fields are left out above. data.stablecoin is the rule set's verdict:

data.stablecoin
anchorstring

What the quote was measured against: "USD par", "EUR par" or "CHF par" within one currency, or a reference rate such as "USD/EUR reference rate" across two. See Anchors.

currencyIn / currencyOutstring

The registry's currency for each side.

parDeviationBpsnumber

The quote's distance from the anchor, in basis points. Positive means more than par. Two decimals.

maxParDeviationBpsnumber

The tolerance this quote was judged by: yours, or the default.

minOutstring

The least the swap may deliver, in base units of tokenOut: the tighter of your slippage bound and your tolerance.

slippageBpsnumber

minOut as a slippage figure. Send it to /v1/build to keep that floor if you build the quoteId yourself.

offPegCheckedboolean

False when you sent allowOffPeg: true.

namedboolean

The chain has passed our benchmark gate. Informational: every chain is quoted under the same rules.

quoteId expires 120 seconds after the quote, as on /v1/quote. A refusal is a success: false body with a code; see Refusals.