RESTful API

You are referring to the Legacy version of KyberSwap docs.

For the most updated information, please refer to:

INTRODUCTION

The RESTful API provide a way for users to be able to programmatically interact with the KyberNetwork contract without in depth understanding of blockchain and smart contracts. Please note that some of these endpoints have certain limitations as follows:

  1. The /buy_rate and /sell_rate endpoints are restricted to ETH <-> token queries only while the trade_data endpoint allows token <-> token trades.

  2. The fields active, custom_proxy and original_token will only appear if certain conditions are met. Otherwise, they will not show up in the API response.

  3. The only_official_reserve parameter has been deprecated.

INDEX

<AUTOGENERATED_TABLE_OF_CONTENTS>

REFERENCE

Endpoints

/buy_rate

(GET) Returns the latest BUY conversion rate in ETH. For example, if you want to know how much ETH is needed to buy 1 DAI, you can use this function.

Arguments:

ParameterTypeRequiredDescription

id

string

Yes

The id represents the token you want to buy using ETH.

qty

float

Yes

A floating point number which will be rounded off to the decimals of the asset specified. The quantity is the amount of units of the asset you want to buy.

only_official_reserve

bool

No

Deprecated

Response:

ParameterTypeDescription

src_id

string

The id represents the source token. It should be ETH for this endpoint.

dst_id

string

The id represents the destination token of the pair you want to get rates for. id should match one of the request input parameters specified in id.

src_qty

float[]

Array of floating point numbers which will be rounded off to the decimals of ETH.

dst_qty

float[]

Array of floating point numbers which will be rounded off to the decimals of the id represents the destination token. They should match the request input parameter specified in qty.

Example

Get buy rates for 300 KNC and 10.1 OMG.

> curl "https://api.kyber.network/buy_rate?id=0xdd974D5C2e2928deA5F71b9825b8b646686BD200&qty=300&id=0xd26114cd6EE289AccF82350c8d8487fedB8A0C07&qty=10.1"
{
  "error":false,
  "data":[
    {
      "src_id":"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
      "dst_id":"0xdd974D5C2e2928deA5F71b9825b8b646686BD200",
      "src_qty":[
        0.5671077504725898
      ],
      "dst_qty":[
        300
      ]
    },
    {
      "src_id":"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
      "dst_id":"0xd26114cd6EE289AccF82350c8d8487fedB8A0C07",
      "src_qty":[
        0.18035714285714283
      ],
      "dst_qty":[
        10.1
      ]
    },
    ...
  ]
}

/change24h

(GET) Returns token to ETH and USD rates and percentage changes against the past day

Arguments:

ParameterTypeRequiredDescription

only_official_reserve

bool

No

Deprecated

Response:

ParameterTypeDescription

timestamp

int

Server timestamp in UTC

token_name

string

Name of the asset

token_symbol

string

Symbol of the asset

token_decimal

int

Decimals that will be used to round-off the srcQty or dstQty of the asset in other requests

token_address

string

The asset contract address

rate_eth_now

float

Current asset price against ETH

change_eth_24h

float

Percentage change in ETH against the past 24 hours

change_usd_24h

float

Percentage change in USD against the past 24 hours

rate_usd_now

float

Current asset price in USD

custom_proxy

bool

Returns true if the address is a proxy address. Note that this field only appears if the token is a proxy token.

original_token

string

The address of the original token contract. Note that this field only appears if the token is a proxy token.

Example

> curl "https://api.kyber.network/change24h"
{
  "ETH_KNC":{
    "timestamp":1548065183567,
    "token_name":"Kyber Network",
    "token_symbol":"KNC",
    "token_decimal":18,
    "token_address":"0xdd974d5c2e2928dea5f71b9825b8b646686bd200",
    "rate_eth_now":0.001144689345999999,
    "change_eth_24h":-2.7115507894449724,
    "change_usd_24h":13.883783963625097,
    "rate_usd_now":0.1443257387379925
  },
  "ETH_OMG":{
    "timestamp":1548065183567,
    "token_name":"OmiseGO",
    "token_symbol":"OMG",
    "token_decimal":18,
    "token_address":"0xd26114cd6ee289accf82350c8d8487fedb8a0c07",
    "rate_eth_now":0.0105194607632,
    "change_eth_24h":-2.0145305819746198,
    "change_usd_24h":-10.129,
    "rate_usd_now":0.8
  },
  "ETH_SNX":{
    "timestamp":1573200127195,
    "token_symbol":"SNX",
    "token_name":"Synthetix Network",
    "token_address":"0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f",
    "token_decimal":18,
    "rate_eth_now":0.004682812478752438,
    "change_eth_24h":5.285125197652733,
    "rate_usd_now":0.8631071531728769,
    "change_usd_24h":3.3441675583726584,
    "custom_proxy":true,
    "original_token":"0x42D03f506c2308ECd06aE81D8fA22352BC7A8F2b"
  }
  ...
}

/currencies

(GET) Returns a list of all possible tokens available for trade.

Arguments:

ParameterTypeRequiredDescription

include_delisted

bool

No

Accepts true or false as arguments. If no value is specified, it will default to false. If true, the API will also return tokens that have been delisted.

page

int

No

The page index of the response data, starts from 0. If no value is specified, it will default to 0. Each page includes maximum 1000 records.

only_official_reserve

bool

No

Deprecated

Response:

ParameterTypeDescription

symbol

string

The symbol of the asset in its native chain.

name

string

Name of the asset in its native chain.

decimals

int

Decimals that will be used to round-off the srcQty or dstQty of the asset in other requests.

address

string

The address of the asset in its native chain.

id

string

A unique ID used by Kyber Network to identify between different symbols.

active

bool

A boolean value to represent if the token is still active on Kyber. Note that this field only appears when you specify a value for the include_delisted parameter.

reserves_src

string[]

Reserve contract addresses supporting Token to Ether trades

reserves_dest

string[]

Reserve contract addresses supporting Ether to Token trades

custom_proxy

bool

Returns true if the address is a proxy address. Note that this field only appears if the token is a proxy token.

original_token

string

The address of the original token contract. Note that this field only appears if the token is a proxy token.

Note: Ether and tokens that have been deployed permissionlessly do not have the reserves_src and reserves_dest fields.

Example

> curl "https://api.kyber.network/currencies"
{
  "error":false,
  "data":[
    {
      "symbol":"ETH",
      "name":"Ethereum",
      "address":"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
      "decimals":18,
      "id":"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
    },
    {
      "symbol":"WETH",
      "name":"Wrapped Ether",
      "address":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
      "decimals":18,
      "id":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
      "reserves_src":[
        "0x57f8160e1c59D16C01BbE181fD94db4E56b60495"
      ],
      "reserves_dest":[
        "0x57f8160e1c59D16C01BbE181fD94db4E56b60495"
      ]
    },
    {
      "symbol":"KNC",
      "name":"KyberNetwork",
      "address":"0xdd974d5c2e2928dea5f71b9825b8b646686bd200",
      "decimals":18,
      "id":"0xdd974d5c2e2928dea5f71b9825b8b646686bd200",
      "reserves_src":[
        "0x63825c174ab367968EC60f061753D3bbD36A0D8F",
        "0x21433Dec9Cb634A23c6A4BbcCe08c83f5aC2EC18"
      ],
      "reserves_dest":[
        "0x63825c174ab367968EC60f061753D3bbD36A0D8F",
        "0x21433Dec9Cb634A23c6A4BbcCe08c83f5aC2EC18"
      ]
    },
    {
      "symbol":"TUSD",
      "name":"TrueUSD",
      "address":"0x8dd5fbce2f6a956c3022ba3663759011dd51e73e",
      "decimals":18,
      "id":"0x8dd5fbce2f6a956c3022ba3663759011dd51e73e",
      "reserves_src":[
        "0x5D154c145Db2ca90B8aB5e8Fe3E716AfA4AB7Ff0",
        "0x7a3370075a54B187d7bD5DceBf0ff2B5552d4F7D"
      ],
      "reserves_dest":[
        "0x5D154c145Db2ca90B8aB5e8Fe3E716AfA4AB7Ff0",
        "0x7a3370075a54B187d7bD5DceBf0ff2B5552d4F7D"
      ],
      "custom_proxy":true,
      "original_token":"0x0000000000085d4780B73119b644AE5ecd22b376"
    }
    ...
  ]
}

/expectedRate

(GET) Return the expected rate for a token pair, with behavior similar to getExpectedRate from the proxy contract.

Arguments:

ParameterTypeRequiredDescription

source

string

Yes

The source token contract address.

dest

string

Yes

The destination token contract address.

sourceAmount

number

Yes

The amount of source tokens in source token decimals.

platformFee

number

No

The platform fee in BPS.

Response:

ParameterTypeDescription

expectedRate

string

The conversion rate of the token pair in 10^18. See example for reference.

slippageRate

string

Deprecated, will return expectedRate

timestamp

int

Server timestamp in UTC.

error

bool

Returns true if the operation encountered an error, otherwise false.

Example

Get rates for 100 DAI to OMG, with a 0.25% platform fee.

> curl "https://api.kyber.network/expectedRate?source=0x6b175474e89094c44da98b954eedeac495271d0f&dest=0xd26114cd6ee289accf82350c8d8487fedb8a0c07&sourceAmount=100000000000000000000&platformFee=25"
{
  "error": false,
  "expectedRate": "634908750000000033",
  "slippageRate": "615861487500000032",
  "timestamp": 1594182159
}

This means that 1 DAI can be exchanged for 634908750000000033 / 1e18 = 0.63490875 OMG.

/gas_limit

(GET) Return the estimated Gas Limit used for a transaction based on source token amount.

Arguments:

ParameterTypeRequiredDescription

source

string

Yes

The source token contract address.

dest

string

Yes

The destination token contract address.

amount

number

The amount of source tokens.

Response:

ParameterTypeDescription

data

string

The estimated gas limit to be used for a transaction based on the parameters.

error

bool

Returns true if the operation encountered an error, otherwise false.

Example

Get the gas limit for exchanging 10000 DAI to OMG.

> curl "https://api.kyber.network/gas_limit?source=0x6b175474e89094c44da98b954eedeac495271d0f&dest=0xd26114cd6ee289accf82350c8d8487fedb8a0c07&amount=10000"
{
  "data": 880000,
  "error": false
}

/gasLimitConfig

(GET) Returns the gas limit for approving token and swapping between ETH <-> ERC20 token. To calculate the gas limit for swapping between token A <-> token B, take the sum of the gas limit for swapping from token A -> ETH and for swapping from ETH -> Token B. Note that some tokens may require higher gas limits than others e.g. DAI, TUSD, MKR, DGX.

Response:

ParameterTypeDescription

symbol

string

Symbol of the asset

address

string

Contract address of the asset

swapGasLimit

int

Gas limit when swapping between ETH <-> asset

approveGasLimit

int

Gas limit when approving KNP to trade the asset on behalf of the user

custom_proxy

bool

Returns true if the address is a proxy address. Note that this field only appears if the token is a proxy token.

original_token

string

The address of the original token contract. Note that this field only appears if the token is a proxy token.

Example

> curl "https://api.kyber.network/gasLimitConfig"
{
  "error":false,
  "data":[
    {
      "symbol":"ETH",
      "address":"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
      "swapGasLimit":0,
      "approveGasLimit":0
    },
    {
      "symbol":"WETH",
      "address":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
      "swapGasLimit":380000,
      "approveGasLimit":120000
    },
    {
      "symbol":"KNC",
      "address":"0xdd974d5c2e2928dea5f71b9825b8b646686bd200",
      "swapGasLimit":380000,
      "approveGasLimit":120000
    },
    {
      "symbol":"DAI",
      "address":"0x6b175474e89094c44da98b954eedeac495271d0f",
      "swapGasLimit":500000,
      "approveGasLimit":120000
    },
    {
      "symbol":"TUSD",
      "address":"0x8dd5fbce2f6a956c3022ba3663759011dd51e73e",
      "swapGasLimit":600000,
      "approveGasLimit":120000,
      "custom_proxy":true,
      "original_token":"0x0000000000085d4780B73119b644AE5ecd22b376"
    }
    ...
  ]
}

/hint

(GET) Returns the encoded hint based on the input parameters.

Arguments:

ParameterTypeRequiredDescription

type

string

Yes

Must be e2t, t2e, or t2t

token_src

string

Dependent on route

source token address

token_dest

string

Dependent on route

destination token address

trade_type

string

Yes

Must be bestofall, maskin, maskout, or split

reserve_id

string

Dependent on route

ID(s) of the reserve, comma-separated

split_value

string

Dependent on route

Respective split for the reserveId, comma-separated

Response:

ParameterTypeDescription

data

string

The encoded hint

Example

Build a KNC to ETH split trade among 2 reserves:

  • Reserve 0xff00004b79626572000000000000000000000000000000000000000000000000: 70%

  • Reserve 0xff53706561726f53000000000000000000000000000000000000000000000000: 30%

> curl "https://api.kyber.network/hint?type=t2e&trade_type=split&token_src=0x7b2810576aa1cce68f2b118cef1f36467c648f92&reserve_id=0xff00004b79626572000000000000000000000000000000000000000000000000,0xff53706561726f53000000000000000000000000000000000000000000000000&split_value=7000,3000"
{
  "data": "0x0000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000002aa12aa56bbfff000000000000000000000000000000000000000000000000000ff1234567a334f7d00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000001b580000000000000000000000000000000000000000000000000000000000000bb8"
}

/market

(GET) Retrieve in-depth information about price and other information about assets.

Response:

ParameterTypeDescription

timestamp

int

Server timestamp in UTC.

quote_symbol

string

Symbol of the asset used for quoting i.e. ETH.

quote_name

string

Name of the asset in its native chain. i.e. Ethereum.

quote_decimals

int

Decimals that will be used to round-off the srcQty or dstQty of the asset in other requests.

quote_address

string

Contract address of the asset used for quoting.

base_symbol

string

Symbol of the asset to be quoted in terms of the quote_symbol.

base_name

string

Name of the asset to be quoted in terms of the quote_name.

base_decimals

int

Decimals of the asset to be quoted.

base_address

string

Contract address of the asset to be quoted.

past_24h_high

float

Highest ASK price for the last 24 hours of the pair.

past_24h_low

float

Highest BID price for the last 24 hours of the pair.

usd_24h_volume

float

Volume for the last 24 hours in USD.

eth_24h_volume

float

Volume for the last 24 hours in ETH.

token_24h_volume

float

Volume for the last 24 hours in tokens.

current_bid

float

Current (considering some X minute delay) BID price.

current_ask

float

Current (considering some X minute delay) ASK price.

last_traded

float

Last traded price in the exchange.

pair

string

Pair name consisting of the quote and base asset symbols.

custom_proxy

bool

Returns true if the address is a proxy address. Note that this field only appears if the token is a proxy token.

original_token

string

The address of the original token contract. Note that this field only appears if the token is a proxy token.

Example

> curl "https://api.kyber.network/market"
{
  "error":false,
  "data":[
    {
      "timestamp":1565676643703,
      "quote_symbol":"ETH",
      "quote_name":"Ethereum",
      "quote_decimals":18,
      "quote_address":"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
      "base_symbol":"WETH",
      "base_name":"Wrapped Ether",
      "base_decimals":18,
      "base_address":"0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2",
      "past_24h_high":1,
      "past_24h_low":1,
      "usd_24h_volume":55171.31700779925,
      "eth_24h_volume":261.98872813093953,
      "token_24h_volume":261.98872813093953,
      "current_bid":1,
      "current_ask":1,
      "last_traded":1,
      "pair":"ETH_WETH"
    },
    {
      "timestamp":1565676643703,
      "quote_symbol":"ETH",
      "quote_name":"Ethereum",
      "quote_decimals":18,
      "quote_address":"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
      "base_symbol":"KNC",
      "base_name":"KyberNetwork",
      "base_decimals":18,
      "base_address":"0xdd974d5c2e2928dea5f71b9825b8b646686bd200",
      "past_24h_high":0.000793293929007035,
      "past_24h_low":0.000783163456436218,
      "usd_24h_volume":5751.223513558892,
      "eth_24h_volume":27.365939751337628,
      "token_24h_volume":34737.279673311226,
      "current_bid":0.000787059792040378,
      "current_ask":0.00079253036315891,
      "last_traded":0.000788978737325427,
      "pair":"ETH_KNC"
    },
    {
      "timestamp":1565676643703,
      "quote_symbol":"ETH",
      "quote_name":"Ethereum",
      "quote_decimals":18,
      "quote_address":"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
      "base_symbol":"DAI",
      "base_name":"DAI",
      "base_decimals":18,
      "base_address":"0x6b175474e89094c44da98b954eedeac495271d0f",
      "past_24h_high":0.004764611951928574,
      "past_24h_low":0.004672131147540981,
      "usd_24h_volume":202729.63505611182,
      "eth_24h_volume":963.3434244536832,
      "token_24h_volume":203591.66123820562,
      "current_bid":0.004743332850081698,
      "current_ask":0.004789407404832812,
      "last_traded":0.004789355488531787,
      "pair":"ETH_DAI"
    },
    {
      "timestamp":1573199827192,
      "quote_symbol":"ETH",
      "quote_name":"Ethereum",
      "quote_decimals":18,
      "quote_address":"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
      "base_symbol":"TUSD",
      "base_name":"TrueUSD",
      "base_decimals":18,
      "base_address":"0x8dd5fbce2f6a956c3022ba3663759011dd51e73e",
      "past_24h_high":0.005382922417172212,
      "past_24h_low":0.005256588523707966,
      "usd_24h_volume":8437.676524840423,
      "eth_24h_volume":45.33700723026804,
      "token_24h_volume":8400.120592248511,
      "current_bid":0.005366444083242093,
      "current_ask":0.00543261156727895,
      "last_traded":0.005345203077303782,
      "pair":"ETH_TUSD",
      "custom_proxy":true,
      "original_token":"0x0000000000085d4780B73119b644AE5ecd22b376"
    }
    ...
  ]
}

/quote_amount

(GET) Returns the amount of quote token needed to buy / received when selling qty amount of base token. This endpoint will only work for official reserves.

Arguments:

ParameterTypeRequiredDescription

base

string

Yes

The base token contract address.

quote

string

Yes

The quote token contract address.

base_amount

number

The amount of base tokens you would like to buy / sell.

type

string

Yes

Accepts buy or sell as arguments. Whether you want to buy / sell base_amount worth of base token.

platformFee

number

No

Platform fee to be charged, in basis points. Read more about platform fees here.

Response:

ParameterTypeDescription

error

bool

Returns true if the operation encountered an error, otherwise false.

data

string

The amount of quote token needed to buy / received when selling base_amount worth of base tokens.

Examples

  1. Get WETH amount receivable for selling 10 KNC, with 0.08% platform fee. (10 KNC -> ? WETH)

> curl "https://api.kyber.network/quote_amount?base=0xdd974d5c2e2928dea5f71b9825b8b646686bd200&quote=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&base_amount=10&type=sell&platformFee=8"
{
  "data":"0.068293",
  "error":false
}
  1. Get WETH amount needed to purchase 10 KNC, with 0.1% platform fee. (? WETH -> 10 KNC)

> curl "https://api.kyber.network/quote_amount?base=0xdd974d5c2e2928dea5f71b9825b8b646686bd200&quote=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2&base_amount=10&type=buy&platformFee=10"
{
  "data":"0.068949",
  "error":false
}

/all_reserves

(GET) Returns a list of all reserves added to the network.

Response:

ParameterTypeDescription

address

string

The address of the asset in its native chain.

id

string

Reserve ID. Refer to this section for more information.

type

integer

Reserve Type. Elaborated in description.

rebate_wallet

string

Reserve rebate wallet address

description

string

Reserve type description

Reserve Types

Refer to this section for more information on reserve types.

  • 1 = Fed Price Reserve (FPR)

  • 2 = Automated Price Reserve (APR)

  • 3 = Bridge Reserve (BRIDGE)

  • 4 = Utility Reserve (UTILITY)

  • 5 = Custom Reserve (CUSTOM)

  • 6 = Orderbook Reserve (ORDERBOOK)

Example

> curl "https://api.kyber.network/all_reserves"
{
  "data": [
    {
      "address": "0x39C30B03799DB870e9C01747f68e24D2b38A30C9",
      "id": "0xff00004b79626572000000000000000000000000000000000000000000000000",
      "type": 1,
      "rebate_wallet": "0xDd102CeDa27a2283dC85028f9bF7d022d8a640d2"
    },
    {
      "address": "0xc4684f4FbfC3db0A24CFFe35821b12e55BeaEF7A",
      "id": "0xaa4b4e4320415052000000000000000000000000000000000000000000000000",
      "type": 2,
      "rebate_wallet": "0x7de9bC2cDfa6B7Ee7088a4f5848A86A26Cd5aFD1"
    },
    ...
  ]
}

/reserves

(GET) Returns a list of reserves that supports a token pair.

Arguments:

ParameterTypeRequiredDescription

token

string

Yes

Address of the asset.

type

string

Yes

Accepts buy or sell as arguments. buy will return a list of reserves which support the eth -> token pair, otherwise sell returns reserves which support the token -> eth pair.

Response:

ParameterTypeDescription

address

string

The address of the asset in its native chain.

id

string

Reserve ID. Refer to this section for more information.

type

integer

Reserve Type. Elaborated in description.

rebate_wallet

string

Reserve rebate wallet address

description

string

Reserve type description

Reserve Types

Refer to this section for more information on reserve types.

  • 1 = Fed Price Reserve (FPR)

  • 2 = Automated Price Reserve (APR)

  • 3 = Bridge Reserve (BRIDGE)

  • 4 = Utility Reserve (UTILITY)

  • 5 = Custom Reserve (CUSTOM)

  • 6 = Orderbook Reserve (ORDERBOOK)

Example

Get list of reserves that support ETH -> KNC trades.

> curl "https://api.kyber.network/reserves?token=0xdd974d5c2e2928dea5f71b9825b8b646686bd200&type=buy"
{
  "data": [
    {
      "address": "0x39C30B03799DB870e9C01747f68e24D2b38A30C9",
      "id": "0xff00004b79626572000000000000000000000000000000000000000000000000",
      "type": 1,
      "rebate_wallet": "0xDd102CeDa27a2283dC85028f9bF7d022d8a640d2"
    },
    {
      "address": "0xc4684f4FbfC3db0A24CFFe35821b12e55BeaEF7A",
      "id": "0xaa4b4e4320415052000000000000000000000000000000000000000000000000",
      "type": 2,
      "rebate_wallet": "0x7de9bC2cDfa6B7Ee7088a4f5848A86A26Cd5aFD1"
    },
    ...
  ]
}

/sell_rate

(GET) Returns the latest SELL conversion rate in ETH. For example, if you want to know how much ETH you will get by selling 1 DAI, you can use this function.

Arguments:

ParameterTypeRequiredDescription

id

string

Yes

The id represents the token you want to sell using ETH.

qty

float

Yes

A floating point number which will be rounded off to the decimals of the asset specified. The quantity is the amount of units of the asset you want to sell.

only_official_reserve

bool

No

Deprecated

Response:

Example

Get sell rates for 300 and 150 KNC, and 10.1, 20 and 30 OMG.

> curl "https://api.kyber.network/sell_rate?id=0xdd974D5C2e2928deA5F71b9825b8b646686BD200&qty=300&qty=150&id=0xd26114cd6EE289AccF82350c8d8487fedB8A0C07&qty=10.1&qty=20.2&qty=30"
{
  "error":false,
  "data":[
    {
      "src_id":"0xdd974D5C2e2928deA5F71b9825b8b646686BD200",
      "dst_id":"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
      "src_qty":[
        300,
        150
      ],
      "dst_qty":[
        0.55963380759,
        0.279816903795
      ]
    },
    {
      "src_id":"0xd26114cd6EE289AccF82350c8d8487fedB8A0C07",
      "dst_id":"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
      "src_qty":[
        10.1,
        20.2,
        30
      ],
      "dst_qty":[
        0.17552908314026,
        0.35105816628052,
        0.521373514278
      ]
    }
  ]
}

/trade_data

(GET) Returns the transaction payload for the user to sign and broadcast in order to trade or convert an asset pair from token A to token B.

Arguments:

ParameterTypeRequiredDescription

user_address

string

Yes

The ETH address that will be executing the swap.

src_id

string

Yes

The id represents the source token of the pair you want to trade.

dst_id

string

Yes

The id represents the destination token of the pair you want to trade.

src_qty

float

Yes

A floating point number representing the source amount in the conversion which will be rounded off to the decimals of the source token id.

min_dst_qty

float

Yes

A floating point number representing the source amount in the conversion which will be rounded off to the decimals of the destination token id. It is the minimum destination asset amount that is acceptable to the user. A guideline would be to set it at 3% less the destination quantity in getPair, which indicates a 3% slippage.

gas_price

string

Yes

One of the following 3: low, medium, high. Priority will be set according to the level defined.

wallet_id

string

No

Wallet address that to get fees from the trade. Read more about platform fees here.

wallet_fee

integer

No

Platform fee to be charged, in basis points. Read more about platform fees here.

hint

string

No

The trade hint, specifying the trade type, reserve IDs and splits. Read more about building and parsing hints here.

nonce

integer

No

Users can specify a nonce to override the default account nonce.

only_official_reserve

bool

No

Deprecated.

Response:

ParameterTypeDescription

from

string

The ETH address that executed the swap. Must match the user_address request input parameter.

to

string

The contract address of the KyberNetwork smart contract. Verify that it should always be the address resolved from kybernetwork.eth ENS.

data

string

Transaction data. This data needs to be signed and broadcasted to the blockchain.

value

string

This will be equal to 0 in hex (0x0) if the user tries to trade from token to ETH (assuming src_id is the source token address).

gasPrice

string

Calculated ETHGasStation price according to the user's request. If you need to specify a price value, change this wei hex value.

nonce

string

The nonce of the account. If multiple conversions are requested at the same time, each request will have the same nonce as the API will return the nonce of the account's last mined transaction.

gasLimit

string

The gas limit required for the transaction. This value should not be altered unless for specific reasons.

Example

User 0x8fa07f46353a2b17e92645592a94a0fc1ceb783f to swap 0.05 ETH to KNC (minimally receive 5.5 KNC) at medium gas price, with a nonce of 200. 0.025% of the trade will be allocated to 0x0859A7958E254234FdC1d200b941fFdfCAb02fC1.

> curl "https://api.kyber.network/trade_data?user_address=0x8fa07f46353a2b17e92645592a94a0fc1ceb783f&src_id=0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee&dst_id=0xdd974D5C2e2928deA5F71b9825b8b646686BD200&src_qty=0.05&min_dst_qty=5.5&gas_price=medium&wallet_id=0x0859A7958E254234FdC1d200b941fFdfCAb02fC1&wallet_fee=25&nonce=200"
{
  "error":false,
  "data":[
    {
      "from":"0x8fa07f46353a2b17e92645592a94a0fc1ceb783f",
      "to":"0x818e6fecd516ecc3849daf6845e3ec868087b755",
      "data":"0xcb3c28c7000000000000000000000000eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee00000000000000000000000000000000000000000000000000044364c5bb0000000000000000000000000000dd974d5c2e2928dea5f71b9825b8b646686bd2000000000000000000000000008fa07f46353a2b17e92645592a94a0fc1ceb783f800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b1ae4d6e2ef5000000000000000000000000000000859a7958e254234fdc1d200b941ffdfcab02fc1",
      "value":"0x44364c5bb0000",
      "gasPrice":"0x39eda2b80",
      "nonce":"0xc8",
      "gasLimit":"0x43d81"
    }
  ]
}

/transfer_data

(GET) Returns the transaction payload for the user to sign and broadcast in order to transfer an asset to a recipient.

Arguments:

ParameterTypeRequiredDescription

from

string

Yes

The Ethereum address of the sender. | | to | string | Yes | The Ethereum address of the receiver.

token

string

No

The contract address of token. If no argument is provided, it will default to ETH.

value

float

Yes

The number of token / ETH you want to send. For example, if you want to send 1.35 ZIL (12 decimals), it would be 1.35.

gas_price

string

Yes

One of the following 3: low, medium, high. Priority will be set according to the level defined.

gas_limit

integer

No

The limit of gas required for your transaction.

nonce

integer

No

Users can specify a nonce to override the default account nonce.

Response:

ParameterTypeDescription

from

string

The Ethereum address that executed the transfer. Must match the from input parameter.

to

string

The contract address of the token or the recipient Ethereum address (if transferring ETH).

data

string

Transaction data. This data needs to be signed and broadcasted to the blockchain. If sending ETH, the value for this parameter should be '0x0'.

value

string

If sending token, the value for this parameter should be '0x0'. Else, it should match the value input parameter.

gasPrice

string

Calculated ETHGasStation price according to the user's request. If you want to specify a price value, change this wei hex value.

nonce

string

The nonce of the account. If multiple conversions are requested at the same time, each request will have the same nonce as the API will return the nonce of the account's last mined transaction.

gasLimit

string

The gas limit required for the transaction. This value should not be altered unless for specific reasons.

Example

Wallet 0x3Cf628d49Ae46b49b210F0521Fbd9F82B461A9E1 to transfer 20.5 KNC to 0x723f12209b9C71f17A7b27FCDF16CA5883b7BBB0 with medium gas price and tx nonce of 123.

> curl "https://api.kyber.network/transfer_data?from=0x3Cf628d49Ae46b49b210F0521Fbd9F82B461A9E1&to=0x723f12209b9C71f17A7b27FCDF16CA5883b7BBB0&token=0xdd974d5c2e2928dea5f71b9825b8b646686bd200&value=20.5&gas_price=medium&gas_limit=200000&nonce=123"
{
  "error":false,
  "data":[
    {
      "from":"0x3Cf628d49Ae46b49b210F0521Fbd9F82B461A9E1",
      "to":"0xdd974d5c2e2928dea5f71b9825b8b646686bd200",
      "data":"0xa9059cbb000000000000000000000000723f12209b9c71f17a7b27fcdf16ca5883b7bbb000000000000000000000000000000000000000000000000014d1120d7b160000",
      "value":"0x0",
      "gasPrice":"0x147d35700",
      "nonce":"0x7b",
      "gasLimit":"0x30d40"
    }
  ]
}

/users/:user_address/currencies

(GET) Returns a list of token enabled statuses of an Ethereum wallet. It indicates if the wallet can sell a token or not. If not, how many transactions he has to do in order to enable it.

Arguments:

ParameterTypeRequiredDescription

user_address

string

Yes

The ETH address to get information from.

page

int

No

The page index of the response data, starts from 0. If no value is specified, it will default to 0. Each page includes maximum 1000 records.

only_official_reserve

bool

No

Deprecated

Response:

ParameterTypeDescription

id

string

A unique ID used by Kyber Network to identify between different symbols

enabled

bool

Whether the user address has approved Kyber Network to spend the asset on their behalf. Applicable only to ERC20 tokens. See ‘allowance’ on the ERC20 standard.

txs_required

int

Number of transactions required until the ID is enabled for trading. When enabled is True, txs_required is 0. When enabled is False, majority of the time tx_required is 1.

Example

Find what tokens the wallet 0x8fA07F46353A2B17E92645592a94a0Fc1CEb783F has approved for trading.

> curl "https://api.kyber.network/users/0x8fA07F46353A2B17E92645592a94a0Fc1CEb783F/currencies"
{
  "error":false,
  "data":[
    {
      "id":"0xbf2179859fc6d5bee9bf9158632dc51678a4100e",
      "enabled":true,
      "txs_required":0
    },
    {
      "id":"0x595832f8fc6bf59c85c527fec3740a1b7a361269",
      "enabled":false,
      "txs_required":1
    },
    {
      "id":"0xd26114cd6ee289accf82350c8d8487fedb8a0c07",
      "enabled":true,
      "txs_required":0
    },
    {
      "id":"0x0f5d2fb29fb7d3cfee444a200298f468908cc942",
      "enabled":true,
      "txs_required":0
    },
    ...
  ]
}

/users/:user_address/currencies/:currency_id/enable_data

(GET) Returns all needed information for a user to sign and do a transaction, and to enable a token to be able to be sold.

Arguments:

ParameterTypeRequiredDescription

user_address

string

Yes

The ETH address of the user that will enable the asset.

currency_id

string

Yes

The unique ID of the destination asset.

gas_price

string

Yes

One of the following 3: low, medium, high. Priority will be set according to the level defined.

nonce

int

No

You can manually specify a nonce to override the default account nonce.

only_official_reserve

bool

No

Deprecated

Response:

ParameterTypeDescription

from

string

The ETH address of the user. Must match the user_address request parameter.