v2

OpenAPI 3.1.02026-07-3139137119.0 KB
swap

Swap Quote

Spammable single-pair swap quote for live price discovery. Flat request/response. result_type carries soft errors on a 200. Optional recipient; fees match the swap execute path.

post/swap/quote

Headers

X-API-KEYstring required

API key for authentication

Request body

trade_type'EXACT_INPUT' | 'EXACT_OUTPUT' required

Whether the source or destination amount is fixed.

amountstring required
senderstring nullable
recipientstring nullable
slippage_bpsinteger nullable

Example request

{
  "amount": "100.0",
  "destination": {
    "address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    "chain_id": 30000000000001
  },
  "recipient": "0x1234...abcd",
  "sender": "0x1234...abcd",
  "slippage_bps": 50,
  "source": {
    "address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    "chain_id": 30000000000001
  },
  "trade_type": "EXACT_OUTPUT"
}

Response

Quote produced (check result_type)

result_type'OK' | 'NO_ROUTE' | 'HIGH_IMPACT' required

Soft-error result code returned by /v3/swap/quote endpoints. Non-OK values still arrive on a 200 so polling clients don't have to special-case errors.

Example response

{
  "issues": {
    "price_impact_warning": {
      "impact": 0.07,
      "threshold": 0.05
    }
  },
  "quote": {
    "input": {
      "amount": {
        "raw": "100000000",
        "ui": "100.0",
        "value_usd": 100
      },
      "balance": {
        "raw": "100000000",
        "ui": "100.0",
        "value_usd": 100
      },
      "breakdown": {
        "base": {
          "raw": "100000000",
          "ui": "100.0",
          "value_usd": 100
        },
        "fees": {
          "custom_fee": {
            "raw": "100000000",
            "ui": "100.0",
            "value_usd": 100
          },
          "protocol_fee": {
            "raw": "100000000",
            "ui": "100.0",
            "value_usd": 100
          },
          "relayer_fee": {
            "raw": "100000000",
            "ui": "100.0",
            "value_usd": 100
          },
          "total_fee": {
            "raw": "100000000",
            "ui": "100.0",
            "value_usd": 100
          }
        },
        "gas": {
          "raw": "100000000",
          "ui": "100.0",
          "value_usd": 100
        },
        "total": {
          "raw": "100000000",
          "ui": "100.0",
          "value_usd": 100
        }
      },
      "currency": {
        "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
        "chain_id": 1,
        "decimals": 6,
        "id": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48-1",
        "name": "USD Coin",
        "price_usd": 1,
        "symbol": "USDC"
      }
    },
    "output": {
      "amount": {
        "raw": "100000000",
        "ui": "100.0",
        "value_usd": 100
      },
      "amount_out_minimum": {
        "raw": "100000000",
        "ui": "100.0",
        "value_usd": 100
      },
      "currency": {
        "address": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
        "chain_id": 1,
        "decimals": 6,
        "id": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48-1",
        "name": "USD Coin",
        "price_usd": 1,
        "symbol": "USDC"
      }
    },
    "trade_type": "EXACT_OUTPUT"
  },
  "result_type": "OK"
}