Default

Get swap routing plan

get

Returns a graph-based routing plan for swap request. The plan includes detailed routes through various liquidity sources and can optionally include encoded calldata for immediate execution.

Query parameters
chainIdintegerRequired

Integer ID of the blockchain

Example: 1
sellTokenstringRequired

Address of sell token. For native tokens, use either 0x0000000000000000000000000000000000000000 or 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

Example: 0x853d955acef822db058eb8505911ed77f175b99e
buyTokenstringRequired

Address of buy token. For native tokens, use either 0x0000000000000000000000000000000000000000 or 0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee

Example: 0x1f9840a85d5af5bf1d1762f925bdaddc4201f984
sellAmountstringOptional

Amount of sellToken to sell (in base units). Exactly one of sellAmount or buyAmount must be provided.

Example: 10000000000000000000000
buyAmountstringOptional

Amount of buyToken to buy (in base units). Exactly one of sellAmount or buyAmount must be provided.

Example: 1000000000000000000
useRfqbooleanOptional

Whether to use market maker RFQ liquidity

Default: falseExample: false
routerstring · enumOptional

Router contract unique name

Default: default-routerExample: swapnet-routerPossible values:
includeCalldatabooleanOptional

Whether to include calldata in the response

Default: falseExample: false
userAddressstringOptional

User's wallet address. Required when includeCalldata=true

Example: 0x11b86991c6218b36c1d19d4a2e9eb0ce3606eb49
slippageTolerancenumber · max: 1Optional

Slippage tolerance (0.01 = 1%). Required when includeCalldata=true

Example: 0.01
apiKeystringRequired

Your API key

Example: your-api-key-here
Responses
200

Successful swap routing response

application/json
get
GET /api/v1.0/swap?chainId=1&sellToken=text&buyToken=text&apiKey=text HTTP/1.1
Host: app.swap-net.xyz
Accept: */*
{
  "aggregator": "swapnet",
  "router": "default-router",
  "sell": {
    "referenceId": 7,
    "amount": "10000000000000000000000"
  },
  "buy": {
    "referenceId": 6,
    "amount": "1034955025987043448356"
  },
  "nativeTokenUsdPrice": 4622.638914277432,
  "tokens": [
    {
      "referenceId": 7,
      "address": "0x853d955acef822db058eb8505911ed77f175b99e",
      "name": "Frax",
      "symbol": "FRAX",
      "decimals": 18,
      "usdPrice": 0.9985832349359104
    },
    {
      "referenceId": 6,
      "address": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984",
      "name": "Uniswap",
      "symbol": "UNI",
      "decimals": 18,
      "usdPrice": 9.632281172169868
    }
  ],
  "routes": [
    {
      "address": "0xc63b0708e2f7e69cb8a1df0e1389a98c35a76d52",
      "name": "UniswapV3",
      "details": {
        "fee": 500
      },
      "fromTokens": [
        {
          "referenceId": 7,
          "amount": "10000000000000000000000"
        }
      ],
      "toTokens": [
        {
          "referenceId": 6,
          "amount": "1034955025987043448356"
        }
      ]
    }
  ]
}

Get example tokens

get

Returns a list of example tokens for trading on the specified chain. Notice that this is not a full list of tradable tokens.

Query parameters
chainIdintegerRequired

Integer ID of the blockchain

Example: 1
apiKeystringRequired

Your API key

Example: your-api-key-here
Responses
200

Successful tokens response

application/json
get
GET /api/v1.0/tokens?chainId=1&apiKey=text HTTP/1.1
Host: app.swap-net.xyz
Accept: */*
[
  {
    "address": "0x853d955acef822db058eb8505911ed77f175b99e",
    "name": "Frax",
    "symbol": "FRAX",
    "decimals": 18,
    "metadata": {
      "logoURI": "https://example.com/frax.png"
    }
  },
  {
    "address": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984",
    "name": "Uniswap",
    "symbol": "UNI",
    "decimals": 18,
    "metadata": {
      "logoURI": "https://example.com/uni.png"
    }
  }
]

Get available chains

get

Returns a list of blockchain networks supported by the SwapNet aggregator.

Query parameters
apiKeystringRequired

Your API key

Example: your-api-key-here
Responses
200

Successful chains response

application/json
get
GET /api/v1.0/chains?apiKey=text HTTP/1.1
Host: app.swap-net.xyz
Accept: */*
[
  {
    "chainId": 1,
    "name": "Ethereum"
  },
  {
    "chainId": 137,
    "name": "Polygon"
  },
  {
    "chainId": 42161,
    "name": "Arbitrum One"
  }
]

Get detailed chain information

get

Returns detailed information about a specific blockchain network, including supported routers, liquidity sources, and key token addresses.

Query parameters
chainIdintegerRequired

Integer ID of the blockchain

Example: 1
apiKeystringRequired

Your API key

Example: your-api-key-here
Responses
200

Successful chain info response

application/json
get
GET /api/v1.0/chainInfo?chainId=1&apiKey=text HTTP/1.1
Host: app.swap-net.xyz
Accept: */*
{
  "chainId": 1,
  "name": "Ethereum",
  "usdTokenAddress": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
  "wrappedNativeTokenAddress": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
  "routers": [
    {
      "name": "default-router",
      "liquiditySources": [
        "UniswapV2",
        "UniswapV3",
        "SushiswapV2"
      ],
      "deployedAddress": "0x616000e384Ef1C2B52f5f3A88D57a3B64F23757e",
      "hasEncoder": true
    }
  ]
}