YAD
SiteDocs
SiteDocs
    • Introduction
    • Blockchains
      GET
    • List tokens
      POST
    • Liquidity sources
      GET
    • Gas prices
      GET
    • Get price for pair
      GET
    • Transaction allowance
      GET
    • Transaction approve
      GET
    • Get quote for pair
      GET
    • Get Bridge Price
      GET
    • Get Bridge Quote
      GET
    • Get Bridge Tokens
      POST

      Get price for pair

      GET
      https://api.entrswap.io/v1/{chainID}/price
      Returns the best route and exchange offer for pair, no calldata for transaction. Works faster than v1/quote.

      Request

      Authorization
      Add parameter in header
      X-API-Key
      Example:
      X-API-Key: ********************
      Path Params
      chainID
      enum<integer> 
      required
      The blockchain ID.
      (Supported list: v1/platforms)
      Allowed values:
      110561372504216143114
      Default:
      1
      Example:
      1
      Query Params
      fromTokenAddress
      string 
      required
      Smart contract address of the sale token.
      Default:
      0xdac17f958d2ee523a2206206994597c13d831ec7
      Example:
      0xdac17f958d2ee523a2206206994597c13d831ec7
      toTokenAddress
      string 
      required
      Smart contract address of the purchase token.
      Default:
      0x6b175474e89094c44da98b954eedeac495271d0f
      Example:
      0x6b175474e89094c44da98b954eedeac495271d0f
      amount
      integer 
      required
      The amount of sale tokens in decimals of the token (Decimals can be taken from the method /tokens/list).
      Default:
      1500000000
      Example:
      1500000000
      slippage
      number 
      required
      The amount of slippage allowed during the actual execution of the transaction (10 = 1% slippage). If the price changes by more than this percentage, the transaction will revert. Min = 1 (0.1%), max = 500 (50%).
      Default:
      1
      Example:
      1
      gasPrice
      string  | null 
      optional
      Gas price value for making a transaction in WEI (nAVAX for Avalanche) (1 GWEI = 1000000000 WEI), default value is the value high from /{chainID}/gasprices.
      Example:
      16000000000
      feeRecipient
      string 
      optional
      Wallet address for receiving fees.
      The commission is paid from the purchase or sale token. It depends on which of the fields is sent in the request: buyTokenPercentageFee or sellTokenPercentageFee.
      Default:
      0xdac17f958d2ee523a2206206994597c13d831ec7
      buyTokenPercentageFee
      number 
      optional
      Percentage of commission from the amount of purchase tokens, is taken in favor of 'feeRecipient'. (10 = 1%, maximum value is 500).
      sellTokenPercentageFee
      number 
      optional
      Percentage of commission from the amount of sale tokens, is taken in favor of 'feeRecipient'. (10 = 1%, maximum value is 500).
      excludeAggregator
      string 
      optional
      Exclude some aggregators from routing (add several parameters for multiple exclude).
      includeAggregator
      string 
      optional
      Include some aggregators from routing (add several parameters for multiple include). This parameter cannot be combined with excludedAggregators.
      withGas
      boolean 
      optional
      If TRUE choose a route based on gas.
      Default:
      false
      rfqOnly
      boolean 
      optional
      If TRUE: use only RFQ providers for routing.
      Note: If set to TRUE, the excludeAggregator and includeAggregator fields are ignored.
      Default:
      false

      Request samples

      Shell
      JavaScript
      Java
      Swift
      Go
      PHP
      Python
      HTTP
      C
      C#
      Objective-C
      Ruby
      OCaml
      Dart
      R
      Request Request Example
      Shell
      JavaScript
      Java
      Swift
      curl --location --request GET 'https://api.entrswap.io/v1/1/price?fromTokenAddress=0xdac17f958d2ee523a2206206994597c13d831ec7&toTokenAddress=0x6b175474e89094c44da98b954eedeac495271d0f&amount=1500000000&slippage=1' \
      --header 'X-API-Key;'

      Responses

      🟢200OK
      application/json
      Body
      amount_out_total
      string 
      optional
      The amount of purchase tokens in decimals of the token.
      Example:
      1497761574710071333259
      estimate_gas_total
      string 
      optional
      The estimated amount of gas that will be used during the transaction.
      Example:
      127000
      token_in
      string 
      optional
      Smart contract address of the sale token.
      Example:
      0xdac17f958d2ee523a2206206994597c13d831ec7
      token_out
      string 
      optional
      Smart contract address of the purchase token.
      Example:
      0x6b175474e89094c44da98b954eedeac495271d0f
      gas_price
      string 
      optional
      Gas price value for a transaction in WEI (nAVAX for Avalanche).
      Example:
      127000
      fee_recipient_amount
      string 
      optional
      The amount of purchase tokens in decimals of the token which will be taken in favor of feeRecipient.
      The value will be 0 if feeRecipient and buyTokenPercentageFee parameters are not specified.
      routes
      array [object {6}] 
      optional
      An array of DEXs the transaction will be carried out through.
      type
      string 
      optional
      Liquidity source type.
      Example:
      dex
      protocol_name
      string 
      optional
      DEX name the transaction will be carried out through.
      Example:
      Uniswap_V3
      amount_in
      string 
      optional
      Amount of token to exchange.
      Example:
      1500000000
      amount_out
      string 
      optional
      Expected amount of token out.
      Example:
      1497761574710071333259
      percent
      number 
      optional
      The percent of amount that will be swapped on the current DEX.
      Example:
      100
      pools
      object 
      optional
      The array of liquidity pools through which the exchange will be conducted.
      Example
      {
          "amount_out_total": "1497761574710071333259",
          "estimate_gas_total": "127000",
          "token_in": "0xdac17f958d2ee523a2206206994597c13d831ec7",
          "token_out": "0x6b175474e89094c44da98b954eedeac495271d0f",
          "gas_price": "127000",
          "fee_recipient_amount": "string",
          "routes": [
              {
                  "type": "dex",
                  "protocol_name": "Uniswap_V3",
                  "amount_in": "1500000000",
                  "amount_out": "1497761574710071333259",
                  "percent": 100,
                  "pools": {
                      "protocol_name": "string",
                      "pool_address": "string",
                      "amount_in": "string",
                      "amount_out": "string",
                      "zero_for_one": true,
                      "token0": "string",
                      "token1": "string"
                  }
              }
          ]
      }
      🟢204No Content
      Modified at 2024-06-04 11:14:05
      Previous
      Gas prices
      Next
      Transaction allowance