For the complete documentation index, see llms.txt. This page is also available as Markdown.

API - EVM Swaps

KyberSwap Aggregator EVM APIs

Disclaimer: Data provided as-is. Please see the relevant Developer Guide for more details

Download OpenAPI specification:

EVM swap APIs

If you're just getting started with the KyberSwap Aggregator, you can refer to our Execute A Swap With The Aggregator API dev guide for information and code samples on how to query and execute swaps at superior rates. Note that there is also a KyberSwap Widget option for integrators who require a simple minimal-code implementation. For existing integrators, please refer to Upgrading To APIv1 for further details on the motivation behind the upgrade as well as the relevant changes to swap flow and parameters.

Use the latest [V1] APIs for faster queries and RFQ liquidity. Both API versions remain backward compatible. Only [V1] APIs receive updates and support RFQ liquidity. Migrate before the non-versioned API is deprecated.

[V1] GET /routes API is designed to be performant and real-time, the market moves constantly so it is recommended to not cache routes from client side for more than 5-10 seconds and to refetch a new route before swapping if the current swap is too long ago to avoid potential slippage.

API statuses and support

KyberSwap APIs use these statuses to prevent version confusion and support uninterrupted service:

  • Latest: API is functional and supported. This is the recommended version for all integrators (new and existing).

  • Legacy: API remains functional with support for bugs only. No new feature updates.

  • Deprecated: API is no longer functional and is not supported.

For all developers, it is highly recommended that you refer to the API with the Latest tag to ensure access to the latest features as well as improved service quality and efficiency. APIs which are planned to be sunset will be tagged Legacy during the transition period and thereafter moved to Deprecated.

The KyberSwap Docs will continue to maintain information regarding Legacy and Deprecated APIs.

Chain identifiers

The Aggregator APIs require a chain name to be included in the path when calling the APIs:

  • Ethereum (ChainID: 1) -> ethereum

  • BSC (ChainID: 56) -> bsc

  • Arbitrum (ChainID: 42161) -> arbitrum

  • Polygon PoS (ChainID: 137) -> polygon

  • Optimism (ChainID: 10) -> optimism

  • Avalanche (ChainID: 43114) -> avalanche

  • Base (ChainID: 8453) -> base

  • Linea (ChainID: 59144) -> linea

  • Mantle (ChainID: 5000) -> mantle

  • Sonic (ChainID: 146) -> sonic

  • Berachain (ChainID: 80094) -> berachain

  • Ronin (ChainID: 2020) -> ronin

  • Unichain (ChainID: 130) -> unichain

  • HyperEVM (ChainID: 999) -> hyperevm

  • Plasma (ChainID: 9745) -> plasma

  • Etherlink (ChainID: 42793) -> etherlink

  • Monad (ChainID: 143) -> monad

  • MegaETH (ChainID: 4326) -> megaeth

  • Robinhood Chain (ChainID: 4663) -> robinhood

  • Arc (ChainID: 5042) -> arc

Latest

[V1] Get Swap Route

get

Find the best route to swap from tokenIn to tokenOut, supporting all liquidity sources including RFQ. Use this API to get a route preview before confirming the swap. The route returned can then be combined with transaction specific params in the POST API payload to get the encoded data for submission to the KyberSwap router contract. Refer to Supported Exchanges And Networks for the full list of supported networks.

Path parameters
chainstringRequired

Chain name. Full list of supported chains available in Docs.

Example: ethereum
Query parameters
tokenInstringRequired

Address of the input token 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE in case of native token

tokenOutstringRequired

Address of the output token 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE in case of native token

amountInstringRequired

Amount of the input token (in wei)

includedSourcesstringOptional

DEX IDs included in the route, separated by comma

excludedSourcesstringOptional

DEX IDs excluded from the route, separated by comma

excludeRFQSourcesbooleanOptional

Exclude RFQ sources

onlyScalableSourcesbooleanOptional

Exclude unscalable sources and only use sources that accept scaling input amounts

onlyDirectPoolsbooleanOptional

Only routes directly from tokenIn to tokenOut (without hop tokens)

onlySinglePathbooleanOptional

Determines whether to only return single-path route

gasIncludebooleanOptional

Determines whether gas costs are accounted for when searching for best route. Defaults to true

gasPricestringOptional

Custom gas price in wei used when searching for the best swap route. Use result from eth_gasPrice otherwise

feeAmountstringOptional

Fee amount(s) to be collected. If isInBps = true, feeAmount is the percentage of fees to take with base unit = 10000, i.e feeAmount = 10 and isInBps = true then fee = 0.1%; If isInBps = false, feeAmount is the amount of token to take as fee, i.e feeAmount = 10 and isInBps = 'false' then fee = 10 token weis. It also accepts a comma-separated list of numbers to support multiple fee receivers, for example: feeAmount=10,20

chargeFeeBystring · enumOptional

Indicates that the API client wants to charge fee by input token (currency_in) or output token (currency_out). Default is empty whereby no fee is charged.

Possible values:
isInBpsbooleanOptional

if true, fee is taken in bps of the amount in/out, instead of absolute wei value

feeReceiverstringOptional

The API client's wallet address(es) to receive fee (if chargeFeeBy is not empty). It can accept a comma separated list of addresses to collect multiple fee amounts into multiple addresses

originstringOptional

The origin address (user wallet) of the swap tx. Include this to get access to exclusive pools and rates

Header parameters
X-Client-IdstringRequired

ClientID of the party calling the API. Provide a value to identify your client and avoid getting rate limited. If an even higher rate limit is needed, contact bd.

Example: MyAwesomeApp
Responses
200

Swap Found

application/json
codeintegerRequired

Response code

messagestringOptional

Response message

requestIdstringOptional

Request id for debug support purposes

get/{chain}/api/v1/routes
GET /{chain}/api/v1/routes?tokenIn=text&tokenOut=text&amountIn=text HTTP/1.1
Host: aggregator-api.kyberswap.com
X-Client-Id: MyAwesomeApp
Accept: */*
{
  "code": 0,
  "message": "successfully",
  "data": {
    "routeSummary": {
      "tokenIn": "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619",
      "amountIn": "1000000000000000000",
      "amountInUsd": "1668.95",
      "tokenOut": "0x2791bca1f2de4661ed88a30c99a7a9449aa84174",
      "amountOut": "1666243758",
      "amountOutUsd": "1665.9071767608839",
      "gas": "253000",
      "gasPrice": "181968304449",
      "gasUsd": "0.06491355324609177",
      "extraFee": {
        "feeAmount": "10",
        "chargeFeeBy": "currency_out",
        "isInBps": true,
        "feeReceiver": "0x0513c794bC2c65C6f374a86D6ad04425e32Df22e"
      },
      "route": [
        [
          {
            "pool": "0x4b543e89351faa242cb0172b2da0cdb52db699b4",
            "tokenIn": "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619",
            "tokenOut": "0x2791bca1f2de4661ed88a30c99a7a9449aa84174",
            "swapAmount": "1000000000000000000",
            "amountOut": "1667911669",
            "exchange": "dodo",
            "poolType": "dodo",
            "poolExtra": {
              "type": "DPP",
              "dodoV1SellHelper": "0xdfaf9584f5d229a9dbe5978523317820a8897c5a",
              "baseToken": "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619",
              "quoteToken": "0x2791bca1f2de4661ed88a30c99a7a9449aa84174"
            },
            "extra": {
              "amountIn": "1000000000000000000",
              "filledOrders": [
                {
                  "allowedSenders": "0x0000000000000000000000000000000000000000",
                  "feeAmount": "0",
                  "feeRecipient": "0x0000000000000000000000000000000000000000",
                  "filledMakingAmount": "950000",
                  "filledTakingAmount": "1000000000000000000",
                  "getMakerAmount": "f4a215c30000000000000000000000000000000000000000000000000000000011e1a3000000000000000000000000000000000000000000000000111e75953102eec1a0",
                  "getTakerAmount": "296637bf0000000000000000000000000000000000000000000000000000000011e1a3000000000000000000000000000000000000000000000000111e75953102eec1a0",
                  "interaction": "",
                  "isFallback": false,
                  "maker": "0xda060fd9ae5b23cebf8abcb2d19fab152a419d61",
                  "makerAsset": "0xc2132d05d31c914a87c6611c10748aeb04b58e8f",
                  "makerAssetData": "",
                  "makerTokenFeePercent": 0,
                  "makingAmount": "300000000",
                  "orderId": 9886,
                  "permit": "",
                  "predicate": "961d5b1e000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002000000000000000000000000227b0c196ea8db17a665ea6824d972a64202e936000000000000000000000000227b0c196ea8db17a665ea6824d972a64202e9360000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000044cf6fc6e3000000000000000000000000da060fd9ae5b23cebf8abcb2d19fab152a419d61000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002463592c2b000000000000000000000000000000000000000000000000000000006453683300000000000000000000000000000000000000000000000000000000",
                  "receiver": "0xda060fd9ae5b23cebf8abcb2d19fab152a419d61",
                  "salt": "202362243813858115557509104206720377774",
                  "signature": "8fb37c9b14d9ccd7709ccc8289860c24580b69f1ab0e905a7d8c20e2ae5e45c570d33324990afb94a445246872545c5eaf9712b164a90ac7f97502d91a7c27001b",
                  "takerAsset": "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270",
                  "takerAssetData": "",
                  "takingAmount": "315789473684210500000"
                }
              ],
              "swapSide": "BUY"
            }
          }
        ]
      ],
      "routeID": "ee24c504-f256-4678-b25a-00480789d5f0",
      "checksum": "10913824719960734178",
      "timestamp": 1744129861
    },
    "routerAddress": "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5"
  },
  "requestId": "fc4002ee-2678-4360-92a4-844b4b896c3f"
}

[V1] Post Swap Route For Encoded Data

post

Get the swap's calldata to be sent to the KyberSwap router contract. The request body must contain the routeSummary as exactly returned by [V1] Get Swap Route along with the additional tx related parameters. Please refer to Supported Exchanges And Networks for the full list of supported networks.

Path parameters
chainstringRequired

Chain name. Full list of supported chains available on Docs.

Example: ethereum
Header parameters
x-client-idstringOptional

ClientID of the party calling the API. Provide a value to identify your client and avoid getting rate limited. You can have a different ClientID value from the source field in the body.

Body
senderstringRequired

Address from which the swap input tokens will be transferred from

originstringOptional

Origin address (user wallet) of the swap tx. Include this to avoid getting rate limited by liquidity sources if you use a fixed sender.

recipientstringRequired

Address to which the swap output tokens will be sent to

permitstringOptional

Encoded token's permit calldata to swap without approving. The permit's spender should be the routerAddress returned in the Get Swap Route API response. See /permit

deadlineintegerOptional

Deadline (in Unix time second) for the transaction to be executed. Default will be +20 minute. Cannot be in the past.

slippageTolerancenumberOptional

This is the amount of slippage the user can accept for his trade. The unit is bps (1/100 of 1%). The value is in ranges [0, 2000], with 10 meaning 0.1%, and 0.1 meaning 0.001%. If no value is provided, slippageTolerance will be set to 0.

ignoreCappedSlippagebooleanOptional

If true, the slippage tolerance can be any value. Please use with caution.

enableGasEstimationbooleanOptional

If true, call eth_gasEstimate to get rpc-based gas estimation for the transaction. Also helps to detect any potential reverts.

sourcestringOptional

The source of the swap to be recorded on-chain. You may use a different value from the x-client-id in the header or even have multiple values to track separate sources.

referralstringOptional

Referral info to include in the swap transaction's ClientData event.

Responses
200

Successfully encoded

application/json
codeintegerRequired

Response code

messagestringOptional

Response message

requestIdstringOptional

Request id for debug support purposes

post/{chain}/api/v1/route/build
POST /{chain}/api/v1/route/build HTTP/1.1
Host: aggregator-api.kyberswap.com
Content-Type: application/json
Accept: */*
Content-Length: 693

{
  "routeSummary": {
    "tokenIn": "text",
    "amountIn": "text",
    "amountInUsd": "text",
    "tokenOut": "text",
    "amountOut": "text",
    "amountOutUsd": "text",
    "gas": "text",
    "gasPrice": "text",
    "gasUsd": "text",
    "extraFee": {
      "feeAmount": "text",
      "chargeFeeBy": "currency_in",
      "isInBps": true,
      "feeReceiver": "text"
    },
    "route": [
      [
        {
          "pool": "text",
          "tokenIn": "text",
          "tokenOut": "text",
          "swapAmount": "text",
          "amountOut": "text",
          "exchange": "text",
          "poolType": "text",
          "poolExtra": "text",
          "extra": "text"
        }
      ]
    ],
    "routeID": "text",
    "checksum": "text",
    "timestamp": "text"
  },
  "sender": "text",
  "origin": "text",
  "recipient": "text",
  "permit": "text",
  "deadline": 1,
  "slippageTolerance": 1,
  "ignoreCappedSlippage": true,
  "enableGasEstimation": true,
  "source": "text",
  "referral": "text"
}
{
  "code": 0,
  "message": "successfully",
  "data": {
    "amountIn": "1000000000000000000",
    "amountInUsd": "1668.5",
    "amountOut": "1666243758",
    "amountOutUsd": "1666.243758",
    "gas": "253000",
    "gasUsd": "0.06491355324609177",
    "additionalCostUsd": "0.0004381760190451663",
    "additionalCostMessage": "L1 fee that pays for rolls up cost",
    "data": "0xe21fd0e900000000000000000000000000000000000000000000000000000000000000200000000000000000000000001d5702c6d7eb30e42a8c94b8db7ea2e8444a37fd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000003e000000000000000000000000000000000000000000000000000000000000006600000000000000000000000000000000000000000000000000000000000000320000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f6190000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174000000000000000000000000000000000000000000000000000000006350dcae0000000000000000000000006131b5fae19ea4f9d964eac0408e4408b66337b50000000000000000000000000000000000000000000000000000000063f6fe9c00000000000000000000000000000000000000000000000000000000000002e0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000408a5da90f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001200000000000000000000000001d5702c6d7eb30e42a8c94b8db7ea2e8444a37fd0000000000000000000000004b543e89351faa242cb0172b2da0cdb52db699b40000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f6190000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841740000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000dfaf9584f5d229a9dbe5978523317820a8897c5a0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f6190000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000513c794bc2c65c6f374a86d6ad04425e32df22e0000000000000000000000000000000000000000000000000de0b6b3a7640000000000000000000000000000000000000000000000000000000000006350dcae00000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000000010000000000000000000000001d5702c6d7eb30e42a8c94b8db7ea2e8444a37fd00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000513c794bc2c65c6f374a86d6ad04425e32df22e0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001de7b22536f75726365223a22222c22416d6f756e74496e555344223a22313636382e35222c22416d6f756e744f7574555344223a22313636362e323433373538222c22526566657272616c223a22222c22466c616773223a332c22496e74656772697479496e666f223a7b224b65794944223a2231222c225369676e6174757265223a22435558755770383248546b6148425659454b574f784a7a76367a2b4f4d7952302f51324558726e41773863646e753474755344534744347a454367504f35374c626b6e366d5054344d5647726f30515a6f497750486c4a50615935426e4f347a416c6f5876532f4a4b31467066776553516b79726d555834793478624f554341655474497477546c726c4d64694e5474544852764c76555255436443443875362b6f4c68766f782b6e5336483378672f7453693566327673744471666166506864524b45496b432f7841584c4a3279764769567361564542722b55483943774e455a53756f7765424f4c4d386f4d7a3047306a4b7470395768756a50796171757832694b674f625271347974625976586935744f6d734d486935654574782b54705539546f694a5957317252456a447170426c486d5849526738714d734a6b46495361314e352f31374b447957482f48366f466e39513d3d227d7d0000",
    "routerAddress": "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5",
    "transactionValue": "1000000000000000000"
  },
  "requestId": "9adab9e7-b007-4864-bf02-7f388b1c70cf"
}

[V1 BETA] Get Swap Route And Encoded Data

For caching clients

Please note that one same calldata is not guaranteed to be able to execute on-chain multiple times (for example, an RFQ order with nonce check will reject duplicate orders), so if you're caching a route returned by this endpoint and would like to execute another tx, request new calldata with POST /{chain}/api/v1/route/build with the route embedded in this route's response.

This endpoint replaces the legacy GET /route/encode endpoint, combining [V1] Get Swap Route and [V1] Post Swap Route For Encoded Data into a single round trip to reduce latency, while (unlike the legacy endpoint) supporting RFQ liquidity sources. It also replaces old legacy field names with V1's new field names.

[V1] Get Swap Route And Encoded Data

get

Find the best route from tokenIn to tokenOut and return its encoded calldata in a single call, combining [V1] Get Swap Route and [V1] Post Swap Route For Encoded Data into one round trip to reduce latency. Access to this endpoint is restricted to partners who can guarantee build intention for every request, since (unlike [V1] Get Swap Route And Encoded Data via /route/encode) it does not exclude RFQ liquidity sources. Refer to Supported Exchanges And Networks for the full list of supported networks.

Path parameters
chainstringRequired

Chain name. Full list of supported chains available in Docs.

Example: ethereum
Query parameters
tokenInstringRequired

Address of the input token 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE in case of native token

tokenOutstringRequired

Address of the output token 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE in case of native token

amountInstringRequired

Amount of the input token (in wei)

includedSourcesstringOptional

DEX IDs included in the route, separated by comma

excludedSourcesstringOptional

DEX IDs excluded from the route, separated by comma

excludeRFQSourcesbooleanOptional

Exclude RFQ sources. Defaults to false, unlike /route/encode which always excludes them.

onlyScalableSourcesbooleanOptional

Exclude unscalable sources and only use sources that accept scaling input amounts

onlyDirectPoolsbooleanOptional

Only routes directly from tokenIn to tokenOut (without hop tokens)

onlySinglePathbooleanOptional

Determines whether to only return single-path route

gasIncludebooleanOptional

Determines whether gas costs are accounted for when searching for best route. Defaults to true

gasPricestringOptional

Custom gas price in wei used when searching for the best swap route. Use result from eth_gasPrice otherwise

feeAmountstringOptional

Fee amount(s) to be collected. If isInBps = true, feeAmount is the percentage of fees to take with base unit = 10000, i.e feeAmount = 10 and isInBps = true then fee = 0.1%; If isInBps = false, feeAmount is the amount of token to take as fee, i.e feeAmount = 10 and isInBps = 'false' then fee = 10 token weis. It also accepts a comma-separated list of numbers to support multiple fee receivers, for example: feeAmount=10,20

chargeFeeBystring · enumOptional

Indicates that the API client wants to charge fee by input token (currency_in) or output token (currency_out). Default is empty whereby no fee is charged.

Possible values:
isInBpsbooleanOptional

if true, fee is taken in bps of the amount in/out, instead of absolute wei value

feeReceiverstringOptional

The API client's wallet address(es) to receive fee (if chargeFeeBy is not empty). It can accept a comma separated list of addresses to collect multiple fee amounts into multiple addresses

originstringOptional

The origin address (user wallet) of the swap tx. Include this to get access to exclusive pools and rates

senderstringOptional

Address from which the swap input tokens will be transferred from

recipientstringOptional

Address to which the swap output tokens will be sent to

permitstringOptional

Encoded token's permit calldata to swap without approving. The permit's spender should be the routerAddress returned in the response. See /permit

deadlineintegerOptional

Deadline (in Unix time second) for the transaction to be executed. Default will be +20 minute. Cannot be in the past.

slippageTolerancenumberOptional

This is the amount of slippage the user can accept for his trade. The unit is bps (1/100 of 1%). The value is in ranges [0, 2000], with 10 meaning 0.1%, and 0.1 meaning 0.001%. If no value is provided, slippageTolerance will be set to 0.

ignoreCappedSlippagebooleanOptional

If true, the slippage tolerance can be any value. Please use with caution.

enableGasEstimationbooleanOptional

If true, call eth_gasEstimate to get rpc-based gas estimation for the transaction. Also helps to detect any potential reverts.

sourcestringOptional

The source of the swap to be recorded on-chain. You may use a different value from the X-Client-Id in the header or even have multiple values to track separate sources.

referralstringOptional

Referral info to include in the swap transaction's ClientData event.

Header parameters
X-Client-IdstringRequired

ClientID of the party calling the API. Provide a value to identify your client and avoid getting rate limited. If an even higher rate limit is needed, contact bd.

Example: MyAwesomeApp
Responses
200

Swap Found And Encoded

application/json
codeintegerRequired

Response code

messagestringOptional

Response message

requestIdstringOptional

Request id for debug support purposes

get/{chain}/api/v1/swap
GET /{chain}/api/v1/swap?tokenIn=text&tokenOut=text&amountIn=text HTTP/1.1
Host: aggregator-api.kyberswap.com
X-Client-Id: MyAwesomeApp
Accept: */*
{
  "code": 0,
  "message": "successfully",
  "data": {
    "routeSummary": {
      "tokenIn": "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619",
      "amountIn": "1000000000000000000",
      "amountInUsd": "1668.95",
      "tokenOut": "0x2791bca1f2de4661ed88a30c99a7a9449aa84174",
      "amountOut": "1666243758",
      "amountOutUsd": "1665.9071767608839",
      "gas": "253000",
      "gasPrice": "181968304449",
      "gasUsd": "0.06491355324609177",
      "l1FeeUsd": "0",
      "extraFee": {
        "feeAmount": "",
        "chargeFeeBy": "",
        "isInBps": false,
        "feeReceiver": ""
      },
      "route": [
        [
          {
            "pool": "0x4b543e89351faa242cb0172b2da0cdb52db699b4",
            "tokenIn": "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619",
            "tokenOut": "0x2791bca1f2de4661ed88a30c99a7a9449aa84174",
            "swapAmount": "1000000000000000000",
            "amountOut": "1666243758",
            "exchange": "dodo",
            "poolType": "dodo",
            "poolExtra": {},
            "extra": {}
          }
        ]
      ],
      "routeID": "ee24c504-f256-4678-b25a-00480789d5f0",
      "checksum": "10913824719960734178",
      "timestamp": 1744129861
    },
    "routerAddress": "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5",
    "amountIn": "1000000000000000000",
    "amountInUsd": "1668.5",
    "amountOut": "1666243758",
    "amountOutUsd": "1666.243758",
    "gas": "253000",
    "gasUsd": "0.06491355324609177",
    "additionalCostUsd": "0.0004381760190451663",
    "additionalCostMessage": "L1 fee that pays for rolls up cost",
    "data": "0xe21fd0e9...",
    "transactionValue": "1000000000000000000"
  },
  "requestId": "9adab9e7-b007-4864-bf02-7f388b1c70cf"
}

Legacy

Get Swap Info with Encoded Data

get

Retrieve the information about a Swap between 2 tokens with encoded data to submit to KyberSwap router contract. RFQ liquidity sources are not supported. Please refer to Supported Exchanges And Networks for the full list of supported networks.

Path parameters
chainstringRequired

Full list of supported chains available on Docs.

Query parameters
tokenInstringRequired

Address of the input token 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE in case of native token

tokenOutstringRequired

Address of the output token 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE in case of native token

amountInstringRequired

Amount of the input token (in wei)

dexesstringOptional

DEX IDs included in the route, separated by comma

onlyScalableSourcesbooleanOptional

Exclude unscalable sources and only use sources that accept scaling input amounts

gasIncludebooleanOptional

Determines whether gas costs are accounted for when searching for best route

gasPricestringOptional

Custom gas price in wei used when searching for the best swap route. Use result from eth_gasPrice otherwise

slippageTolerancenumberOptional

This is the amount of slippage the user can accept for his trade. The unit is bps (1/100 of 1%). The value is in ranges [0, 2000], with 10 meaning 0.1%, and 0.1 meaning 0.001%. If no value is provided, slippageTolerance will be set to 0.

chargeFeeBystring · enumOptional

Indicates that the API client wants to charge fee by input token (currency_in) or output token (currency_out). Default is empty whereby no fee is charged.

Possible values:
feeReceiverstringOptional

The API client's wallet address to receive fee (if chargeFeeBy is not empty)

isInBpsbooleanOptional

if true, fee is taken in bps of the amount in/out, instead of absolute wei value

feeAmountstringOptional

Fee amount to be collected. If isInBps = true, feeAmount is the percentage of fees to take with base unit = 10000, i.e feeAmount = 10 and isInBps = true then fee = 0.1%; If isInBps = false, feeAmount is the amount of token to take as fee, i.e feeAmount = 10 and isInBps = 'false' then fee = 10 token weis

deadlinestringOptional

Deadline (in Unix epoch second) for the transaction to be executed by. Default will be +20 minute. Cannot be in the past.

Example: 1744196804
tostringRequired

Address to receive the output token

clientDatastringOptional

Json string to include your client id in the source field if header cannot be used

Example: {"source":"MyAwesomeApp"}
referralstringOptional

Referral info to include in the swap transaction's ClientData event.

permitstringOptional

Encoded token's permit calldata to swap without approving. The permit's spender should be the routerAddress returned in the Get Swap Route API response. See /permit

ignoreCappedSlippagebooleanOptional

If true, the slippage tolerance can be any value. Please use with caution.

Header parameters
X-Client-IdstringRequired

ClientID of the party calling the API. Provide a value to identify your client and avoid getting rate limited. If an even higher rate limit is needed, contact bd.

Example: MyAwesomeApp
Responses
200

Swap Found

application/json
inputAmountstringRequired

The input amount of tokenIn, in wei

outputAmountstringRequired

The input amount of tokenOut, in wei

totalGasintegerRequired

Estimated gas fee

gasPriceGweistringOptional

Current gas price in Gwei

gasUsdnumberRequired

Current gas price in USD

amountInUsdnumberRequired

Estimate of input value, in USD

amountOutUsdnumberRequired

Estimate of out value, in USD

receivedUsdnumberRequired

Estimate of final received value, in USD

encodedSwapDatastringRequired

The encoded data to be sent to our router address

routerAddressstringRequired

The KyberSwap router address

get/{chain}/route/encode
GET /{chain}/route/encode?tokenIn=text&tokenOut=text&amountIn=text&to=text HTTP/1.1
Host: aggregator-api.kyberswap.com
X-Client-Id: MyAwesomeApp
Accept: */*
200

Swap Found

{
  "inputAmount": "1000000000000000000",
  "outputAmount": "1667970343",
  "totalGas": 250000,
  "gasPriceGwei": "298.5144176",
  "gasUsd": 0.105226332201885,
  "amountInUsd": 1668.59,
  "amountOutUsd": 1667.970343,
  "receivedUsd": 1667.865116667798,
  "swaps": [
    [
      {
        "pool": "0x45dda9cb7c25131df268515131f647d726f50608",
        "tokenIn": "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619",
        "tokenOut": "0x2791bca1f2de4661ed88a30c99a7a9449aa84174",
        "swapAmount": "999000000000000000",
        "amountOut": "1667970343",
        "exchange": "uniswapv3",
        "poolType": "univ3"
      }
    ]
  ],
  "tokens": {
    "0x2791bca1f2de4661ed88a30c99a7a9449aa84174": {
      "address": "0x2791bca1f2de4661ed88a30c99a7a9449aa84174",
      "symbol": "USDC",
      "name": "USD Coin",
      "price": 1,
      "decimals": 6
    },
    "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619": {
      "address": "0x7ceb23fd6bc0add59e62ac25578270cff1b9f619",
      "symbol": "WETH",
      "name": "Wrapped Ether",
      "price": 1668.59,
      "decimals": 18
    }
  },
  "encodedSwapData": "0xe21fd0e900000000000000000000000000000000000000000000000000000000000000200000000000000000000000001d5702c6d7eb30e42a8c94b8db7ea2e8444a37fd000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000003c000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000000300000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f6190000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841740000000000000000000000000000000000000000000000000000000062ec95af0000000000000000000000006131b5fae19ea4f9d964eac0408e4408b66337b50000000000000000000000000000000000000000000000000000000063f6f85b00000000000000000000000000000000000000000000000000000000000002c0000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000409e8aa9350000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000001d5702c6d7eb30e42a8c94b8db7ea2e8444a37fd00000000000000000000000045dda9cb7c25131df268515131f647d726f506080000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f6190000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa841740000000000000000000000000000000000000000000000000ddd2935029d800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f6190000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a000000000000000000000000000000000000000000000000000000000000001e000000000000000000000000000000000000000000000000000000000000002200000000000000000000000000513c794bc2c65c6f374a86d6ad04425e32df22e0000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000000000062ec95af0000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000026000000000000000000000000000000000000000000000000000000000000000010000000000000000000000001d5702c6d7eb30e42a8c94b8db7ea2e8444a37fd00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000ddd2935029d800000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000513c794bc2c65c6f374a86d6ad04425e32df22e0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001df7b22536f75726365223a22222c22416d6f756e74496e555344223a22313636382e3539222c22416d6f756e744f7574555344223a22313636372e393730333433222c22526566657272616c223a22222c22466c616773223a332c22496e74656772697479496e666f223a7b224b65794944223a2231222c225369676e6174757265223a225057614f647055363157744e724258424777424f77665434755547674f4e5162597654747273566d30422b626d362b6b58357362722f6b746f554e655a646b4c354378325576674541795a4a5248565349505558627833336a445262773356337549446c41584241687578616e353642524846686f7a492b422b4b396b3961716d4168712b6f4e49696e535939386e4d4a595072504b506c787a457657653043684d32756a4c7264395876474e7143494f6c7644526531426c5259425a552f625936593034454c3149796d6467684b544237316c32637541643274507335347347414f4e3534356e786a58746d6946674668343570754a5a6e6a7876524b3376754861306a71334357384f51444f41416661416261636176544b6774566b42592b4e5058683965495a6c6b4933596f766e44586e6e4236366652747647506175787a374750386a786e735730646164655a344f5a41513d3d227d7d00",
  "routerAddress": "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5"
}

KyberSwap positive slippage surplus collection

For every swap executed by the KyberSwap Aggregator, users will be able to see an estimated output amount based on the current price as well as a minimum received that takes into account the max slippage setting. KyberSwap Aggregator will always strive to execute swaps at the estimated output amount and revert the transaction if the minimum received amount is not achieved.

In the event that the market moves in favor of the trade which results in a surplus of tokens above the estimated output amount (i.e positive slippage), this surplus will initially accrue to KyberSwap. Surplus sharing programs will be explored as the KyberSwap ecosystem grows to be more self-sufficient. Critically, users are guaranteed at least the minimum received amount (the estimated output adjusted by the selected max slippage) that they confirmed before submitting the transaction.

Note that this surplus is different from fees as it only applies in cases where the executed swap rate is better than the estimated rate at the point of transaction confirmation. Please refer to slippage for more information.

KyberSwap Dust Collector

During swap execution, a transaction may be routed through multiple liquidity sources and intermediate tokens, each with different execution mechanics. Under certain circumstances, including but not limited to depleted liquidity or pool-specific input rounding requirements, a liquidity source may partially fill an order, resulting in a portion of the input/intermediate tokens remaining unconsumed. Any such unconsumed tokens are initially accrued to KyberSwap.

Notwithstanding the occurrence of any unconsumed tokens during execution, users remain subject to and protected by the slippage settings confirmed before submitting the transaction.

For the avoidance of doubt, any unconsumed tokens accrued to KyberSwap do not constitute fees and arise solely as a consequence of the transaction execution mechanics described above.

Third-Party Liquidity Source Arrangements

KyberSwap may have commercial arrangements with certain Third-Party Liquidity Sources or service providers integrated with its Services. KyberSwap may receive fees, rebates, incentives, or other compensation through these arrangements.

These arrangements may vary over time. They do not impose additional fees or obligations on users.

Last updated

Was this helpful?