CrowdSwap
CrowdSwapProductWhitepaperFAQ
  • Introduction
  • Brand Assets
    • Brand Assets
  • Walkthroughs (Product)
    • Search
    • Swap
    • Cross-Chain
  • Core concepts
    • Architecture
    • Protocol
    • Governance
    • Crowd Token
    • Security
    • VIP Program
  • WhitePaper
  • FAQ
  • Tokenomics
    • Overview
  • Community
    • Twitter
    • Telegram
    • Discord
  • Developers
    • Overview
    • Swagger
    • Swap & Cross-Chain
    • Swap Widget
    • Smart Contract
    • GitLab
Powered by GitBook
On this page

Was this helpful?

  1. Developers

Swagger

PreviousOverviewNextSwap & Cross-Chain

Last updated 1 year ago

Was this helpful?

This endpoint provides estimates for all integrated dexes based on profit

get

This endpoint retrieves a list of decentralized exchanges (dexes) where the selected pair can be swapped. The list is sorted by profit, so we recommend choosing the first dex in the list.

Authorizations
Query parameters
fromTokenobjectRequired

Source token. (Supported values for chainId are 1, 56, 137, 43114, 42161 and 324)

Example: {"fromToken[address]":"0x0000000000000000000000000000000000001010","fromToken[chainId]":137,"fromToken[decimals]":18,"fromToken[name]":"Matic Token","fromToken[symbol]":"MATIC"}
toTokenobjectRequired

Destination token. (Supported values for chainId are 1, 56, 137, 43114, 42161 and 324)

Example: {"toToken[address]":"0x483dd3425278C1f79F377f1034d9d2CaE55648B6","toToken[chainId]":137,"toToken[decimals]":18,"toToken[name]":"Crowd Token","toToken[symbol]":"CROWD"}
amountstringRequired

An amount of fromToken to be swapped (The decimal of token must be considered in the amount)

Example: {"value":"1000000000000000000"}
networkCoinPricestringOptional

The price of the selected network's coin based on USD. Example: price of BNB = 245.82

slippagestringOptional

A slippage constraint (in %) is a safeguard during swaps. It is used to calculate the minimum possible outcome during estimation.

Default: 0.5
gasPricestringOptional

Gas Price based on selected network (The unit is gwei)

filteredDexNamesstring[]Optional

filters dexes to be searched for an estimation, providing results only from these selected dexes.

Example: CrowdswapAggregator,CrowdSwapV2,Quickswap
Responses
200
OK
application/json
400
Invalid body attribute
401
Unauthorized
404
No estimation found for the given pair
get
GET /api/v1/swap/estimate-all?fromToken=[object+Object]&toToken=[object+Object]&amount=text HTTP/1.1
Host: 
x-api-key: YOUR_API_KEY
Accept: */*
{
  "successfulEstimationsList": [
    {
      "swapName": "text",
      "delegatedDex": "text",
      "fromToken": "text",
      "fromTokenPrice": "text",
      "toToken": "text",
      "toTokenPrice": "text",
      "amountIn": "text",
      "amountOut": "text",
      "minAmountOut": "text",
      "route": "text",
      "reserves": [
        "text"
      ],
      "priceImpact": "text",
      "poolInfo": "text",
      "swapFee": "text",
      "networkFee": "text",
      "gasPrice": "text",
      "currentDexFeePercentage": "text",
      "crowdswapFeePercentage": "text",
      "swapFeeInUSDT": "text",
      "networkFeeInUSDT": "text",
      "crowdswapFeeInUSDT": "text",
      "totalFeeInUSDT": "text",
      "pricePerToken": "number",
      "cost": "number",
      "totalPaidInUSDT": "text",
      "totalIncomeInUSDT": "text",
      "amountOutInUSDT": "text",
      "amountInInUSDT": "text",
      "amountOutPerAmountInRatio": "text",
      "amountInPerAmountOutRatio": "text",
      "approveAddress": "text",
      "tradeType": "number",
      "trade": {}
    }
  ]
}

This endpoint returns the data for a swap transaction

get

This endpoint returns from, to, data, value, and gasLimit, all of which needed for executing a swap transaction

  • A dex name must be added to the url. The dex name can be found in estimation e.g CrowdSwapV2, Quickswap
Authorizations
Path parameters
dexstringRequired

The dex name which will be used for the swap transaction. This value is available in the estimation result as swapName

Query parameters
fromTokenobjectRequired

Source token. (Supported values for chainId are 1, 56, 137, 43114, 42161 and 324)

Example: {"fromToken[address]":"0x0000000000000000000000000000000000001010","fromToken[chainId]":137,"fromToken[decimals]":18,"fromToken[name]":"Matic Token","fromToken[symbol]":"MATIC"}
toTokenobjectRequired

Destination token. (Supported values for chainId are 1, 56, 137, 43114, 42161 and 324)

Example: {"toToken[address]":"0x483dd3425278C1f79F377f1034d9d2CaE55648B6","toToken[chainId]":137,"toToken[decimals]":18,"toToken[name]":"Crowd Token","toToken[symbol]":"CROWD"}
amountstringRequired

An amount of fromToken to be swapped (The decimal of token must be considered in the amount)

Example: {"value":"1000000000000000000"}
networkCoinPricestringOptional

The price of the selected network's coin based on USD. Example: price of BNB = 245.82

slippagestringOptional

A slippage constraint (in %) is a safeguard during swaps. It is used to calculate the minimum possible outcome during estimation.

Default: 0.5
userAddressstringRequired

Address of the user who initiates the swap transaction

receiverAddressstringOptional

Address of the recipient

amountOutMinstringRequired

The minimum amount out expected from a swap (This amount is available in the estimation result. Also the decimal of token must be considered in the amount)

deadlinestringRequired

Swap estimation will be expired after this deadline (The unit of deadline is based on minutes)

Default: 30Example: {"value":"15"}
Responses
200
OK
application/json
400
Invalid body attribute
401
Unauthorized
get
GET /api/v1/swap/{dex}?fromToken=[object+Object]&toToken=[object+Object]&amount=text&userAddress=text&amountOutMin=text&deadline=text HTTP/1.1
Host: 
x-api-key: YOUR_API_KEY
Accept: */*
{
  "from": "text",
  "to": "text",
  "data": "text",
  "value": "text",
  "gasLimit": "text"
}

This endpoint returns the estimation of a cross-chain swap

get

This endpoint finds a route with the potentially best possible outcome for the requested cross-chain pair and returns an estimation.

Authorizations
Query parameters
fromTokenobjectRequired

Source token. (Supported values for chainId are 1, 56, 137, 43114, 42161 and 324)

Example: {"fromToken[address]":"0x0000000000000000000000000000000000001010","fromToken[chainId]":137,"fromToken[decimals]":18,"fromToken[name]":"Matic Token","fromToken[symbol]":"MATIC"}
amountInstringRequired

An amount of fromToken to be swapped (The decimal of token must be considered in the amount)

Example: {"value":"1000000000000000000"}
slippagestringOptional

A slippage constraint (in %) is a safeguard during swaps. It is used to calculate the minimum possible outcome during estimation.

Default: 3
toTokenobjectRequired

Destination token. (Supported values for chainId are 1, 56, 137, 43114, 42161 and 324)

Example: {"toToken[address]":"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE","toToken[chainId]":56,"toToken[decimals]":18,"toToken[name]":"Binance Coin","toToken[symbol]":"BNB"}
userAddressstringOptional

Address of the user who initiates the cross-chain swap transaction

Responses
200
OK
application/json
400
Invalid body attribute
401
Unauthorized
get
GET /api/v1/crossChainSwap/estimate-all?fromToken=[object+Object]&amountIn=text&toToken=[object+Object] HTTP/1.1
Host: 
x-api-key: YOUR_API_KEY
Accept: */*
{
  "crossChainName": "text",
  "tokenIn": {
    "address": "string",
    "chainId": "number",
    "decimals": "number",
    "name": "string",
    "symbol": "string"
  },
  "tokenOut": {
    "address": "string",
    "chainId": "number",
    "decimals": "number",
    "name": "string",
    "symbol": "string"
  },
  "amountIn": "text",
  "amountOut": "text",
  "minAmountOut": "text",
  "approveAddress": "text",
  "status": "number",
  "msg": "text",
  "swapTx": {
    "to": "string",
    "data": "number",
    "value": "number",
    "gasLimit": "string"
  },
  "fees": {
    "token": {
      "address": "string",
      "chainId": "number",
      "decimals": "number",
      "name": "string",
      "symbol": "string"
    },
    "amount": "string",
    "type": "number"
  },
  "includedInOutputFees": {
    "token": {
      "address": "string",
      "chainId": "number",
      "decimals": "number",
      "name": "string",
      "symbol": "string"
    },
    "amount": "string",
    "type": "number"
  },
  "swapSpecData": {}
}

This endpoint returns the data for investing in an opportunity by a token except TokenA or Token B

get

This endpoint returns from, to, data, value, and gasLimit, all of which needed for investing in an opportunity. Also it returns amountDesiredTokenA, amountDesiredTokenB, and amountLP to show to the investors.

  • An opportuniry name must be added to the url. e.g CROWD_USDT_LP_STAKE, mai-usdc-mimatic,and CAKE_WBNB_PANCAKE
Path parameters
opportunitystringRequired
Query parameters
userAddressstringRequired

User address who submits input tokens for an investment

tokenobjectRequired

The token that user choose to invest with. (In investByTokenATokenB, we choose the token that user enter its amount first)

Example: {"token[address]":"0x0000000000000000000000000000000000001010","token[chainId]":137,"token[decimals]":18,"token[name]":"Matic Token","token[symbol]":"MATIC","token[price]":0.94036}
amountstringRequired

An amount of input tokens to invest (The decimal of token must be considered in the amount)

Example: {"value":"1000000000000000000"}
networkCoinPricestringRequired

The price of selected network's coin based on USD. Example: price of BNB = 279.22

slippagestringRequired

A slippage constraint (in %) is a safeguard during swaps. It is used to calculate the minimum possible outcome during estimation.

Default: 0.5
deadlinenumberRequired

swap estimation will be expired after this deadline (the unit of deadline is based on minutes)

Default: 30Example: {"value":"15"}
Header parameters
x-correlation-idstringRequired
Responses
default
application/json
get
GET /api/v1/opportunity/{opportunity}/investByToken?userAddress=text&token=[object+Object]&amount=text&networkCoinPrice=text&slippage=text&deadline=1 HTTP/1.1
Host: 
x-correlation-id: text
Accept: */*
default
{
  "from": "text",
  "to": "text",
  "data": "text",
  "value": "text",
  "gasLimit": "text",
  "amountDesiredTokenA": "text",
  "amountDesiredTokenB": "text",
  "amountLP": "text"
}

This endpoint returns the data for investing in an opportunity by a tokenA and Token B

get

This endpoint returns from, to, data, value, and gasLimit, all of which needed for investing in an opportunity. Also it returns amountDesiredTokenA, amountDesiredTokenB, and amountLP to show to the investors.

  • An opportuniry name must be added to the url. e.g CROWD_USDT_LP_STAKE, mai-usdc-mimatic,and CAKE_WBNB_PANCAKE
Path parameters
opportunitystringRequired
Query parameters
userAddressstringRequired

User address who submits input tokens for an investment

tokenobjectRequired

The token that user choose to invest with. (In investByTokenATokenB, we choose the token that user enter its amount first)

Example: {"token[address]":"0x0000000000000000000000000000000000001010","token[chainId]":137,"token[decimals]":18,"token[name]":"Matic Token","token[symbol]":"MATIC","token[price]":0.94036}
amountstringRequired

An amount of input tokens to invest (The decimal of token must be considered in the amount)

Example: {"value":"1000000000000000000"}
networkCoinPricestringRequired

The price of selected network's coin based on USD. Example: price of BNB = 279.22

slippagestringRequired

A slippage constraint (in %) is a safeguard during swaps. It is used to calculate the minimum possible outcome during estimation.

Default: 0.5
deadlinenumberRequired

swap estimation will be expired after this deadline (the unit of deadline is based on minutes)

Default: 30Example: {"value":"15"}
Header parameters
x-correlation-idstringRequired
Responses
default
application/json
get
GET /api/v1/opportunity/{opportunity}/investByTokenAAndTokenB?userAddress=text&token=[object+Object]&amount=text&networkCoinPrice=text&slippage=text&deadline=1 HTTP/1.1
Host: 
x-correlation-id: text
Accept: */*
default
{
  "from": "text",
  "to": "text",
  "data": "text",
  "value": "text",
  "gasLimit": "text",
  "amountDesiredTokenA": "text",
  "amountDesiredTokenB": "text",
  "amountLP": "text"
}

This endpoint returns the data for investing in an opportunity by a tokenA or Token B

get

This endpoint returns from, to, data, value, and gasLimit, all of which needed for investing in an opportunity. Also it returns amountDesiredTokenA, amountDesiredTokenB, and amountLP to show to the investors.

  • An opportuniry name must be added to the url. e.g CROWD_USDT_LP_STAKE, mai-usdc-mimatic,and CAKE_WBNB_PANCAKE
Path parameters
opportunitystringRequired
Query parameters
userAddressstringRequired

User address who submits input tokens for an investment

tokenobjectRequired

The token that user choose to invest with. (In investByTokenATokenB, we choose the token that user enter its amount first)

Example: {"token[address]":"0x0000000000000000000000000000000000001010","token[chainId]":137,"token[decimals]":18,"token[name]":"Matic Token","token[symbol]":"MATIC","token[price]":0.94036}
amountstringRequired

An amount of input tokens to invest (The decimal of token must be considered in the amount)

Example: {"value":"1000000000000000000"}
networkCoinPricestringRequired

The price of selected network's coin based on USD. Example: price of BNB = 279.22

slippagestringRequired

A slippage constraint (in %) is a safeguard during swaps. It is used to calculate the minimum possible outcome during estimation.

Default: 0.5
deadlinenumberRequired

swap estimation will be expired after this deadline (the unit of deadline is based on minutes)

Default: 30Example: {"value":"15"}
Header parameters
x-correlation-idstringRequired
Responses
default
application/json
get
GET /api/v1/opportunity/{opportunity}/investByTokenAOrTokenB?userAddress=text&token=[object+Object]&amount=text&networkCoinPrice=text&slippage=text&deadline=1 HTTP/1.1
Host: 
x-correlation-id: text
Accept: */*
default
{
  "from": "text",
  "to": "text",
  "data": "text",
  "value": "text",
  "gasLimit": "text",
  "amountDesiredTokenA": "text",
  "amountDesiredTokenB": "text",
  "amountLP": "text"
}

This endpoint returns the data for investing in an opportunity by LP token of the opportunity

get

This endpoint returns from, to, data, value, and gasLimit, all of which needed for investing in an opportunity. Also it returns amountDesiredTokenA, amountDesiredTokenB, and amountLP to show to the investors.

  • An opportuniry name must be added to the url. e.g CROWD_USDT_LP_STAKE, mai-usdc-mimatic,and CAKE_WBNB_PANCAKE
Path parameters
opportunitystringRequired
Query parameters
userAddressstringRequired

User address who submits input tokens for an investment

tokenobjectRequired

The token that user choose to invest with. (In investByTokenATokenB, we choose the token that user enter its amount first)

Example: {"token[address]":"0x0000000000000000000000000000000000001010","token[chainId]":137,"token[decimals]":18,"token[name]":"Matic Token","token[symbol]":"MATIC","token[price]":0.94036}
amountstringRequired

An amount of input tokens to invest (The decimal of token must be considered in the amount)

Example: {"value":"1000000000000000000"}
networkCoinPricestringRequired

The price of selected network's coin based on USD. Example: price of BNB = 279.22

slippagestringRequired

A slippage constraint (in %) is a safeguard during swaps. It is used to calculate the minimum possible outcome during estimation.

Default: 0.5
deadlinenumberRequired

swap estimation will be expired after this deadline (the unit of deadline is based on minutes)

Default: 30Example: {"value":"15"}
Header parameters
x-correlation-idstringRequired
Responses
default
application/json
get
GET /api/v1/opportunity/{opportunity}/investByLP?userAddress=text&token=[object+Object]&amount=text&networkCoinPrice=text&slippage=text&deadline=1 HTTP/1.1
Host: 
x-correlation-id: text
Accept: */*
default
{
  "from": "text",
  "to": "text",
  "data": "text",
  "value": "text",
  "gasLimit": "text",
  "amountDesiredTokenA": "text",
  "amountDesiredTokenB": "text",
  "amountLP": "text"
}

This endpoint returns the data for leave from an opportunity

get

This endpoint returns from, to, data, value, and gasLimit, all of which needed for leaving from an opportunity.

  • An opportuniry name must be added to the url. e.g CROWD_USDT_LP_STAKE, mai-usdc-mimatic,and CAKE_WBNB_PANCAKE
Path parameters
opportunitystringRequired
Query parameters
userAddressstringRequired

User address who submits input tokens for an investment

tokenobjectRequired

The token that user choose to invest with. (In investByTokenATokenB, we choose the token that user enter its amount first)

Example: {"token[address]":"0x0000000000000000000000000000000000001010","token[chainId]":137,"token[decimals]":18,"token[name]":"Matic Token","token[symbol]":"MATIC","token[price]":0.94036}
amountstringRequired

An amount of input tokens to invest (The decimal of token must be considered in the amount)

Example: {"value":"1000000000000000000"}
networkCoinPricestringRequired

The price of selected network's coin based on USD. Example: price of BNB = 279.22

slippagestringRequired

A slippage constraint (in %) is a safeguard during swaps. It is used to calculate the minimum possible outcome during estimation.

Default: 0.5
deadlinenumberRequired

swap estimation will be expired after this deadline (the unit of deadline is based on minutes)

Default: 30Example: {"value":"15"}
Header parameters
x-correlation-idstringRequired
Responses
default
application/json
get
GET /api/v1/opportunity/{opportunity}/leaveByLP?userAddress=text&token=[object+Object]&amount=text&networkCoinPrice=text&slippage=text&deadline=1 HTTP/1.1
Host: 
x-correlation-id: text
Accept: */*
default
{
  "from": "text",
  "to": "text",
  "data": "text",
  "value": "text",
  "gasLimit": "text",
  "amountDesiredTokenA": "text",
  "amountDesiredTokenB": "text",
  "amountLP": "text"
}

This endpoint returns the details of an opportunity

get

This endpoint returns tvl, apy, dailyInterest to inform users about how much the opportuniy profitable

  • An opportuniry name must be added to the url. e.g CROWD_USDT_LP_STAKE, mai-usdc-mimatic,and CAKE_WBNB_PANCAKE
Path parameters
opportunitystringRequired
Query parameters
tokenAobjectRequired

tokenA

Example: {"fromToken[address]":"0x0000000000000000000000000000000000001010","fromToken[chainId]":137,"fromToken[decimals]":18,"fromToken[name]":"Matic Token","fromToken[symbol]":"MATIC","fromToken[price]":0.94036}
tokenBobjectRequired

tokenB

Example: {"fromToken[address]":"0x0000000000000000000000000000000000001010","fromToken[chainId]":137,"fromToken[decimals]":18,"fromToken[name]":"Matic Token","fromToken[symbol]":"MATIC","fromToken[price]":0.94036}
Responses
default
application/json
get
GET /api/v1/opportunity/getDetails/{opportunity}?tokenA=[object+Object]&tokenB=[object+Object] HTTP/1.1
Host: 
Accept: */*
default
{
  "tvl": "text",
  "apy": "text",
  "dailyInterest": "text"
}

This endpoint returns the data for investing in an opportunity by cross-chain

get
  • An opportuniry name must be added to the url. e.g CROWD_USDT_LP_STAKE, mai-usdc-mimatic,and CAKE_WBNB_PANCAKE
Path parameters
opportunitystringRequired
Query parameters
srcChainIdnumberRequired

Source Chain Id

Default: 1Example: {"value":"1"}
srcChainTokenInAddressstringRequired

Source Chain Token Address

Default: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeEExample: {"value":"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"}
srcChainTokenInAmountstringRequired

An amount of input tokens to cross-chain swap (The decimal of token must be considered in the amount)

Example: {"value":"1000000000000000000"}
slippagestringRequired

A slippage constraint (in %) is a safeguard during swaps. It is used to calculate the minimum possible outcome during estimation.

Default: 3
dstChainIdnumberRequired

Destination Chain Id

Default: 56Example: {"value":"1"}
dstChainTokenOutAddressstringRequired

Destination Chain Token Address

Default: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeEExample: {"value":"0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE"}
userAddressstringRequired

User address who submits input tokens for a cross-chain swap

Header parameters
x-correlation-idstringRequired
Responses
default
application/json
get
GET /api/v1/opportunity/{opportunity}/crossChainEstimation?srcChainId=1&srcChainTokenInAddress=text&srcChainTokenInAmount=text&slippage=text&dstChainId=1&dstChainTokenOutAddress=text&userAddress=text HTTP/1.1
Host: 
x-correlation-id: text
Accept: */*
default
{
  "estimation": {
    "srcChainTokenIn": {
      "address": "text",
      "name": "text",
      "symbol": "text",
      "decimals": 1,
      "amount": "text"
    },
    "srcChainTokenOut": {
      "address": "text",
      "name": "text",
      "symbol": "text",
      "decimals": 1,
      "amount": "text",
      "minAmount": "text"
    },
    "dstChainTokenIn": {
      "address": "text",
      "name": "text",
      "symbol": "text",
      "decimals": 1,
      "amount": "text",
      "minAmount": "text"
    },
    "dstChainTokenOut": {
      "address": "text",
      "name": "text",
      "symbol": "text",
      "decimals": 1,
      "amount": "text",
      "minAmount": "text"
    },
    "executionFee": {
      "token": {
        "address": "text",
        "name": "text",
        "symbol": "text",
        "decimals": 1
      },
      "recommendedAmount": "text",
      "actualAmount": "text"
    }
  },
  "tx": {
    "to": "text",
    "data": "text",
    "value": "text"
  }
}
  • GETThis endpoint provides estimates for all integrated dexes based on profit
  • GETThis endpoint returns the data for a swap transaction
  • GETThis endpoint returns the estimation of a cross-chain swap
  • GETThis endpoint returns the data for investing in an opportunity by a token except TokenA or Token B
  • GETThis endpoint returns the data for investing in an opportunity by a tokenA and Token B
  • GETThis endpoint returns the data for investing in an opportunity by a tokenA or Token B
  • GETThis endpoint returns the data for investing in an opportunity by LP token of the opportunity
  • GETThis endpoint returns the data for leave from an opportunity
  • GETThis endpoint returns the details of an opportunity
  • GETThis endpoint returns the data for investing in an opportunity by cross-chain