QuickStart guide

  1. Sign Up: Request an API key. Choose the plan or contact us to discuss about your needs.

  2. Fetch a Single-Chain Swap Quote: just a simple call to our api passing the api key as header.

curl -X 'GET' \
  'https://api.zcx.com/trade/v1/56/quote/single?fromTokenAddress=0x0000000000000000000000000000000000000000&toTokenAddress=0x55d398326f99059ff775485246999027b3197955&amount=10000000000000000000&sender=0x54c47034887C582Fc1Af4a9a3b68180a8a9eF2d2&receiver=0x54c47034887C582Fc1Af4a9a3b68180a8a9eF2d2&slippage=0.005&excludedDexes=%7B%0A%20%20%221%22%3A%20%5B%0A%20%20%20%20%220x0000000000000%22%0A%20%20%5D%0A%7D&priceImpactProtectionPercentage=0.5&slippageProtectionPercentage=0.5' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer <YOUR API KEY>'
  1. The response is an array of quotes, choose the desired quote (the first is the best in terms of amount out) and take the transactionData and just a few fields and call the swap endpoint.

curl -X 'POST' \
  'https://api.zcx.com/trade/v1/56/swap/single' \
  -H 'accept: application/json' \
  -H 'Authorization: Bearer <YOUR API KEY>' \
  -H 'Content-Type: application/json' \
  -d '{
  "transactionData": {
      "info": {
        "feePercent": 0,
        "sharePercent": 0,
        "srcToken": "0x0000000000000000000000000000000000000000",
        "dstToken": "0x55d398326f99059fF775485246999027B3197955",
        "deadline": 1728640582,
        "slippage": 0.005,
        "tokenHasTaxes": false,
        "path": [
          "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c",
          "0x55d398326f99059ff775485246999027b3197955"
        ],
        "v3Path": "0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c00006455d398326f99059ff775485246999027b3197955",
        "tradeType": 0,
        "amountIn": "10000000000000000000",
        "amountOutMin": "5646899008721574387295",
        "actualQuote": "5675275385649823504819",
        "uuid": "UNIZEN-CLI",
        "apiId": "17",
        "userPSFee": 0
      },
      "call": [
        {
          "targetExchange": "0x13f4EA83D0bd40E75C8222255bc855a974568Dd4",
          "targetExchangeID": "pancakev3",
          "sellToken": "0x0000000000000000000000000000000000000000",
          "buyToken": "0x55d398326f99059fF775485246999027B3197955",
          "amountDelta": "5646899008721574387295",
          "amount": "10000000000000000000",
          "data": "0xb858183f00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000080000000000000000000000000880e0ce34f48c0cbc68bf3e745f17175ba8c650e0000000000000000000000000000000000000000000000008ac7230489e800000000000000000000000000000000000000000000000001321e7759e10ae35e5f000000000000000000000000000000000000000000000000000000000000002bbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c00006455d398326f99059ff775485246999027b3197955000000000000000000000000000000000000000000"
        }
      ]
    },
  "nativeValue": "10000000000000000000",
  "account": "0xF0Fbf42C54Ac40dA016003baD35E5AefaC6E1CE1",
  "receiver": "0xF0Fbf42C54Ac40dA016003baD35E5AefaC6E1CE1",
  "tradeType": 0
}'
  1. Finally in the response of this swap endpoint you have the data to conduct the trade on the user's wallet.

Check out our full API documentation in the next sections.

Last updated