KyberSwap Docs
  • Introduction to KyberSwap
  • Getting Started
    • Quickstart
      • FAQ
    • Supported Exchanges And Networks
    • Foundational Topics
      • Decentralized Finance
        • Tokens
        • Stablecoins
        • DEX/DeFi Aggregator
        • Slippage
        • Price Impact
        • Zap
        • Maximal Extractable Value (MEV)
      • Decentralized Technologies
        • Wallets
        • Dapps
        • RPC
        • Oracles
        • On-Chain vs Off-Chain Data
      • Other Valuable Resources
  • KyberSwap Solutions
    • KyberSwap Interface
      • User Guides
        • Connect Your Wallet
        • Switching Networks
        • Instantly Swap At Superior Rates
        • Swap At Your Preferred Rates
        • Cross-chain Swap
        • Add Your Favourite Tokens
        • Get Crypto With Fiat
        • Bridge Your Assets Across Multiple Chains
      • Profiles
        • Profile Creation
        • Profile Customization
        • Sync Profile Across Devices
      • Notifications
        • Notification Center
    • KyberSwap Aggregator
      • Concepts
        • Dynamic Trade Routing
      • User Guides
        • Instantly Swap At Superior Rates
      • Developer Guides
        • Execute A Swap With The Aggregator API
        • Upgrading To APIv1
      • Aggregator API Specification
        • EVM Swaps
        • Permit
      • Contracts
        • Aggregator Contract Addresses
      • DEX IDs
      • Subgraphs
      • FAQ
    • KyberSwap Zap as a Service
      • KyberSwap Zap as a Service (ZaaS) API
        • ZaaS HTTP API
        • ZaaS GRPC API
      • KyberSwap Zap Liquidity Widget
      • Zap Fee Model
      • Zap's Supported Chains/Dexes
      • Zap's Deployed Contract Addresses
      • Zap's DEX IDs
    • KyberSwap Widget
      • Developer Guides
        • Integrating The KyberSwap Widget
        • Customizing The KyberSwap Widget
      • iFrame Alternative
      • Widget/iFrame Fee
    • KyberSwap Liquidity Widget
      • Integrating The KyberSwap Liquidity Widget
    • Limit Order
      • Concepts
        • Off-Chain Relay, On-Chain Settlement
        • Gasless Cancellation
      • User Guides
        • Swap At Your Preferred Rates
        • Update Limit Orders
        • Cancel Limit Orders
      • Developer Guides
        • Create Limit Order
        • Gasless Cancel
        • Hard Cancel
        • Fill Limit Order
      • Contracts
        • Limit Order Contract Addresses
      • Limit Order API Specification
        • General APIs
        • Maker APIs
        • Taker APIs
      • FAQ
    • KyberSwap OnChain Price Service
    • Fee Schedule
  • Governance
    • KyberDAO
      • User Guides
        • Participating in KyberDAO
        • Staking
        • Voting
        • Stake KNC And Enjoy Gas Savings
      • Fees to KyberDAO
      • KyberDAO Operator MultiSig
      • Contracts
        • KyberDAO Contract Repo
        • KyberDAO Contract Addresses
      • FAQ - Others
    • KNC Token
      • KNC Tokenomics & Utility
      • Gas Refund Program
      • KNC Contract Addresses
  • Security
    • Audits
  • Reference
    • Legacy
      • KyberSwap Classic
        • Concepts
          • Programmable Pricing Curves
          • Dynamic Auto-Adjusting Fees
          • Virtual Balances
          • Protocol Fees
        • Contracts
          • Classic Contract Repo
          • Classic Contract Addresses
          • Classic Contract Farming Addresses
      • KyberSwap Elastic
        • Concepts
          • Concentrated Liquidity
          • Reinvestment Curve
          • Tick-Range Mechanism
          • Pool Process Flows
          • Anti-Sniping Mechanism
          • Tick-Based Farming
          • Elastic Zap
          • TWAP Oracle
          • Elastic APR Calculations
        • Contracts
          • Elastic Contract Repo
          • Elastic Contract Addresses
          • Elastic Farming Contract Addresses
          • Elastic Zap Contract Addresses
          • Elastic Core Contracts
          • Elastic Core Libraries
          • Elastic Periphery Core Contracts
          • Elastic Peripheral Library Contracts
          • Elastic Peripheral Base Contracts
        • Subgraphs
      • Whitepapers
      • Audits
      • KyberAI
        • KyberScore
        • Concepts
        • On-Chain Indicators
          • Number Of Trades
          • Trading Volume
          • Netflow To Whale Wallets
          • Netflow To CEX
          • Number Of Transfers
          • Volume Of Transfers
          • Number Of Holders
          • Top Holders
        • Technical Indicators
          • Live Charts
          • Support & Resistance Levels
          • Live Trades
          • Funding Rate On CEX
          • Liquidations On CEX
        • Liquidity Analysis
      • Elastic Legacy
        • Elastic Legacy Contract Repo
        • Elastic Legacy Contract Addresses
        • Elastic Legacy Farming Contract Addresses
        • Remove Elastic Legacy Liquidity
      • Protocol
        • Overview
        • Smart Contract Architecture
        • Trust and Security Model
      • Integrations
        • Getting Started
        • Use Cases
        • Integration Types
        • Smart Contracts
        • Ethers JS
        • RESTful API
        • Slippage Rate Protection
        • Price Feed Security
        • Contract Events
        • Platform Fees
      • Reserves
        • Getting Started
          • Overview
          • Why Develop On Kyber
          • Create New Reserve
          • Existing Reserves
          • Customising Existing Reserves
        • Development Guides
          • Fed Price Reserve
          • Automated Price Reserve
          • Reserves with Ganache
          • Orderbook Reserve
        • Operations
          • Listing Policies
          • Reserve IDs
          • Reserve Rebates
          • Sanity Rates
      • Addresses
        • Introduction
        • Mainnet
        • Kovan
        • Rinkeby
        • Ropsten
      • API/ABI
        • Introduction
        • RESTful API
          • RESTful API Overview
          • RESTful API
        • Core Smart Contracts
          • IKyberNetworkProxy
          • KyberNetworkProxy
          • IKyberNetwork
          • ISimpleKyberProxy
          • IKyberMatchingEngine
          • KyberMatchingEngine
          • IKyberHint
          • KyberHintHandler
          • IKyberHintHandler
          • IKyberFeeHandler
          • IKyberStaking
          • KyberStaking
          • IKyberDao
          • KyberDao
          • IKyberStorage
          • KyberStorage
          • IKyberHistory
          • KyberHistory
          • IKyberReserve
          • KyberReserve
          • ConversionRates
          • LiquidityConversionRates
          • EpochUtils
          • IEpochUtils
          • KyberFeeHandler
        • Contract ABIs
          • ABIs
        • Code Snippets
          • Token Quantity Conversion
        • Misc Contracts
          • KyberNetwork
          • ConversionRatesInterface
          • PermissionGroups
          • SanityRates
          • Withdrawable
          • OrderbookReserveInterface
          • OrderbookReserveLister
    • KyberSwap Operator MultiSig
    • Permitable Tokens
    • Third-Party Integrations
    • KyberSwap Analytics
    • KyberSwap App
    • GitHub
    • KyberSwap Analytics
    • KyberSwap Blog
    • Kyber Network Press Kit
  • Socials
    • X
    • Discord
    • Telegram
    • LinkedIn
    • Reddit
    • Instagram
    • Tik Tok
  • Support
    • KyberSwap Help Center
    • Complaints Handling Process
Powered by GitBook
On this page

Was this helpful?

  1. KyberSwap Solutions
  2. KyberSwap Aggregator
  3. Aggregator API Specification

EVM Swaps

KyberSwap Aggregator EVM APIs

PreviousAggregator API SpecificationNextPermit

Last updated 19 days ago

Was this helpful?

Download OpenAPI specification:

Note on integration: clientID

In order to continuously improve the KyberSwap Aggregator, our APIs implement a client identifier field that enables us to understand how the APIs are being utilized. A stricter rate limit will be applied if a clientId is not provided. As a developer integrating with our APIs, please preferably use the same clientID (i.e. company name or your app name) for:

  • [V1] Get Swap Route

    • Header: x-client-id

  • [V1] Post Swap Route For Encoded Data

    • Header: x-client-id

This will enable us to serve you better as we continuously strive to improve our Aggregator API. For integrators who have previously integrated with our Legacy API, we highly encourage migrating to the Latest APIs to ensure access to the latest features as well as improved service quality and efficiency.

Example

  • [V1] GET /routes

    • Header

      • x-client-id: MyAwesomeApp

  • [V1] POST /route/build

    • Header

      • x-client-id: MyAwesomeApp

EVM swap APIs

To support more performant queries and the use of RFQ liquidity sources, KyberSwap highly encourages all integrators to implement the latest API [V1] version. While both versions of the API remains backwards compatible, only the [V1] APIs will continue to receive updates and can make use of RFQ liquidity sources, and hence developers are highly encouraged to implement the latest [V1] APIs to avoid any disruptions as the non-versioned API will eventually be deprecated.

API statuses and support

KyberSwap APIs uses the following statuses to minimize version miscommunications and ensure an uninterrupted service for the end user:

  • 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

  • zkSync Era (ChainID: 324) -> zksync

  • Fantom (ChainID: 250) -> fantom

  • Linea (ChainID: 59144) -> linea

  • Scroll (ChainID: 534352) -> scroll

  • Mantle (ChainID: 5000) -> mantle

  • Blast (ChainID: 81457) -> blast

  • Sonic (ChainID: 146) -> sonic

  • Berachain (ChainID: 80094) -> berachain

  • Ronin (ChainID: 2020) -> ronin

Latest

Legacy

KyberSwap positive slippage surplus collection

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, traders will always get the estimated output amount as long as the swap is executed at or above the current rate.

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

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 . 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.

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 point of transaction confirmation. Please refer to for more information.

Execute A Swap With The Aggregator API
KyberSwap Widget
Upgrading To APIv1
slippage
max slippage setting
  • Download OpenAPI specification:
  • EVM swap APIs
  • Latest
  • GET[V1] Get Swap Route
  • POST[V1] Post Swap Route For Encoded Data
  • Legacy
  • GETGet Swap Info with Encoded Data

[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 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

onlyScalableSourcesbooleanOptional

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

onlySinglePathbooleanOptional

Determines whether to only return single-path route

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

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

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
422
WETH is not configured on this network
application/json
400: Bad Request (4001)
Query parameters are malformed
application/json
400: Bad Request (4002)
Request body is malformed
application/json
400: Bad Request (4005)
`feeAmount` is greater than `amountIn`
application/json
400: Bad Request (4007)
`feeAmount` is greater than `amountOut`
application/json
400: Bad Request (4008)
Route not found
application/json
400: Bad Request (4009)
`amountIn` is greater than max allowed
application/json
400: Bad Request (4010)
No pool is eligible to find route on
application/json
400: Bad Request (4011)
`tokenIn` / `tokenOut` can not be found
application/json
get
GET /{chain}/api/v1/routes 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"
}

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 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
get
GET /{chain}/route/encode 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"
}

[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 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. Please use the same ClientID as the source field in the body.

Body
senderstringRequired

Address from which the swap input tokens will be transferred from

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 gas estimation for the transaction. Also helps to detect any potential reverts.

sourcestringOptional

The source of the swap to be recorded on-chain. You should use (and it defaults to be) the same value as the x-client-id in the header, unless you want to track separate sources.

referralstringOptional

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

Responses
200
Successfully encoded
application/json
422
WETH is not configured on this network
application/json
400: Bad Request (4001)
Query parameters are malformed
application/json
400: Bad Request (4002)
Request body is malformed
application/json
400: Bad Request (4005)
`feeAmount` is greater than `amountIn`
application/json
400: Bad Request (4007)
`feeAmount` is greater than `amountOut`
application/json
400: Bad Request (4008)
Route not found
application/json
400: Bad Request (4009)
`amountIn` is greater than max allowed
application/json
400: Bad Request (4010)
No pool is eligible to find route on
application/json
400: Bad Request (4011)
`tokenIn` / `tokenOut` can not be found
application/json
post
POST /{chain}/api/v1/route/build HTTP/1.1
Host: aggregator-api.kyberswap.com
Content-Type: application/json
Accept: */*
Content-Length: 677

{
  "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",
  "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"
}
Supported Exchanges And Networks
Supported Exchanges And Networks
Supported Exchanges And Networks
49KB
KyberSwapAggregator_EVMAPIs_v2.11.0.yaml