v1

latestOpenAPI 3.1.02026-07-13570316.1 KB
Bridge

Swap or Bridge Tokens

Swap one token for another using the optimal route available. You can specify a tokenIn amount (if exact='input') or tokenOut amount (if exact='output'), but not both. The corresponding output or input amount will be returned as the quote.

Authentication: This endpoint requires project authentication and wallet authentication. For backend usage, use x-secret-key header. For frontend usage, use x-client-id + Authorization: Bearer <jwt> headers.

post/v1/bridge/swap

Request body

exact'input' | 'output'

Whether to swap the exact input or output amount

fromstring

The wallet address or ENS name that will execute the swap. If omitted, the project wallet will be used if available.

receiverstring

The wallet address that will receive the swapped tokens. Defaults to the sender address if not specified.

slippageToleranceBpsnumber nullable

The slippage tolerance in basis points. Will be automatically calculated by default.

Example request

{
  "exact": "input",
  "tokenIn": {
    "address": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
    "chainId": 42161,
    "amount": "100"
  },
  "tokenOut": {
    "address": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
    "chainId": 42161,
    "minAmount": "80"
  },
  "from": "0xEfc38EF8C09535b25e364b6d1a7C406D3972f2A9"
}

Response

Swap completed successfully. Returns the transaction used for the swap.