Swap API

API Reference

Dexlab Swap API is completely free and offers a highly intuitive and secure REST API.

As a powerful aggregator integrating various DEXs (Decentralized Exchanges) within the Solana ecosystem, Dexlab partners with the trusted global exchange, OKX, to provide a stable and efficient trading environment.

Developers and project teams can leverage Dexlab Swap API to easily access liquidity, optimize trading routes, and experience cost savings with high trading performance.

API Endpoint

All APIs are free to use, but the Pro API requires an API key(Free) issuance.

  • Open API: https://open-api.dexlab.space/

    • There is a rate limit of 10 RPS. If you need more, get a free API key.

  • Pro API( API key required ): https://pro-api.dexlab.space/

    • The rate limit is increased and free.

Token Swap

When using the Open API endpoint, the x-api-key is not required.

post
Body
userWalletAddressstringRequired

The wallet address of the user initiating the swap.

amountstringRequired

The amount to swap. Must include precision (e.g., 1.00 USDT -> 1000000, 1.00 SOL -> 1000000000).

fromTokenAddressstringRequired

The public key of the token to swap from.

toTokenAddressstringRequired

The public key of the token to swap to.

slippageBpsnumber Β· max: 10000Required

The maximum acceptable slippage in bps (basis points). Default is 500 (5%).

referrerWalletAddressstringOptional

Optional wallet address to receive referrer fees.

referrerFeeBpsnumber Β· max: 300Optional

Optional referrer fee in bps (basis points). Range: 0-300 for Open API, For Pro API, the limit varies depending on the contract.

Responses
200
200 response
application/json
post
POST /dex/swap HTTP/1.1
Host: open-api.dexlab.space
Content-Type: application/json
Accept: */*
Content-Length: 160

{
  "userWalletAddress": "text",
  "amount": "text",
  "fromTokenAddress": "text",
  "toTokenAddress": "text",
  "slippageBps": 1,
  "referrerWalletAddress": "text",
  "referrerFeeBps": 1
}
{
  "data": {
    "bestRouter": {
      "router": "text",
      "subRouters": [
        {
          "protocol": [
            {
              "name": "text",
              "percent": "text"
            }
          ],
          "fromTokenAddress": "text",
          "toTokenAddress": "text"
        }
      ]
    },
    "requester": "text",
    "fromTokenAddress": "text",
    "toTokenAddress": "text",
    "fromTokenAmount": "text",
    "toTokenAmount": "text",
    "maxSpendAmount": "text",
    "minReceiveAmount": "text",
    "slippage": "text",
    "requestAmount": "text",
    "useBoost": true,
    "tx": "text"
  }
}

Last updated