LCX Liberty. American DeFi. Your keys. Your assets. Your control.
Stablecoin quote
POST /v1/stablecoins/quote prices a conversion and measures it against its anchor, or refuses it.
Request
/v1/stablecoins/quote| Field | Type | Description |
|---|---|---|
| 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. |
| amount | string | The same amount in human units, e.g. "250000", scaled by the token's own decimals. |
| decimals | number | Optional and best left out, with the same rules as /v1/quote (decimals_mismatch, decimals_required). |
| maxParDeviationBps | number | 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. |
| slippageBps | number | 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. |
| allowOffPeg | boolean | Default false. Buying a coin that trades more than 1% from its peg is refused with off_peg unless this is true. |
| integrator | string | 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. |
chainId*numberThe chain both coins are on. A conversion never crosses chains: there is no toChainId here.
tokenIn*stringThe stablecoin being sold. Must be in the registry for chainId, or the request is refused with not_a_stablecoin.
tokenOut*stringThe stablecoin being bought. The same rule, and it must differ from tokenIn.
amountIn*stringThe amount to sell in base units, as on /v1/quote. Required unless amount is sent; never both.
amountstringThe same amount in human units, e.g. "250000", scaled by the token's own decimals.
decimalsnumberOptional and best left out, with the same rules as /v1/quote (decimals_mismatch, decimals_required).
maxParDeviationBpsnumberYour 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.
slippageBpsnumberThe 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.
allowOffPegbooleanDefault false. Buying a coin that trades more than 1% from its peg is refused with off_peg unless this is true.
integratorstringYour 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
{
"chainId": 1,
"tokenIn": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
"tokenOut": "0xdAC17F958D2ee523a2206206994597C13D831ec7",
"amount": "250000",
"maxParDeviationBps": 10
}Example
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
{
"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:
| Field | Type | Description |
|---|---|---|
| anchor | string | 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 / currencyOut | string | The registry's currency for each side. |
| parDeviationBps | number | The quote's distance from the anchor, in basis points. Positive means more than par. Two decimals. |
| maxParDeviationBps | number | The tolerance this quote was judged by: yours, or the default. |
| minOut | string | The least the swap may deliver, in base units of tokenOut: the tighter of your slippage bound and your tolerance. |
| slippageBps | number | minOut as a slippage figure. Send it to /v1/build to keep that floor if you build the quoteId yourself. |
| offPegChecked | boolean | False when you sent allowOffPeg: true. |
| named | boolean | The chain has passed our benchmark gate. Informational: every chain is quoted under the same rules. |
anchorstringWhat 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 / currencyOutstringThe registry's currency for each side.
parDeviationBpsnumberThe quote's distance from the anchor, in basis points. Positive means more than par. Two decimals.
maxParDeviationBpsnumberThe tolerance this quote was judged by: yours, or the default.
minOutstringThe least the swap may deliver, in base units of tokenOut: the tighter of your slippage bound and your tolerance.
slippageBpsnumberminOut as a slippage figure. Send it to /v1/build to keep that floor if you build the quoteId yourself.
offPegCheckedbooleanFalse when you sent allowOffPeg: true.
namedbooleanThe 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.