Skip to content
Quickstart

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

Getting started

Quickstart

From no account to a priced route, in one request.

Try it without a key

No key needed: unauthenticated requests are served at 5 requests a second per IP (150 a minute) on https://dex-api.lcx.com, the product host. The commercial host https://swap-api.lcx.com that the rest of these examples use refuses every request without a key, so this one call is the exception. See the anonymous tier.

bash
curl -X POST https://dex-api.lcx.com/v1/quote \
  -H "Content-Type: application/json" \
  -d '{
    "chainId": 1,
    "tokenIn":  "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
    "tokenOut": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
    "amount": "1",
    "decimals": 18
  }'

Get a key

Sign in with a wallet signature or with an email and password. Either creates the account. Answer four short questions, create a key, and the Free plan is active right away: 150,000 calls a month at 5 requests a second, no card.

The key is shown once. The database holds a hash of it and nothing else, so a lost key cannot be recovered. Revoke it and make another.

Make an authenticated call

bash
curl -X POST https://swap-api.lcx.com/v1/quote \
  -H "Authorization: Bearer YOUR_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "chainId": 1,
    "tokenIn":  "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
    "tokenOut": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
    "amount": "1",
    "decimals": 18,
    "slippageBps": 50
  }'
Send the key in the Authorization header, never in a query string. Query strings end up in browser history, proxy logs and referrer headers.

Reading the response

json
{
  "success": true,
  "data": {
    "quote": {
      "quoteId": "q_1_2_1785331092",
      "chainId": 1,
      "blockNumber": 25638739,
      "expiresAt": 1785331212,
      "input":  { "amount": "1000000000000000000", "token": "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" },
      "output": {
        "amount": "1900850015",
        "minimumAmount": "1891345764",
        "token": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"
      },
      "priceImpactPct": 0.05,
      "usdValueIn": 1901.8,
      "usdValueOut": 1900.85,
      "slippageBps": 50,
      "gasEstimateWei": "51205426350000",
      "gasFeeUSD": 0.0974,
      "venues": ["uniswap-v3"],
      "spender": "0x…",
      "stale": false
    }
  }
}

Amounts go in human and come back raw, as strings; see conventions. minimumAmount is the floor your slippageBps implies. Below it the swap reverts on-chain.

blockNumber pins the chain state this price was computed from, and expiresAt is 120 seconds after the quote was made. venues carries adapter keys in the spelling the engine uses internally, lowercase and hyphenated.

Next: Quotes & execution covers turning this into a transaction.