v1

latestOpenAPI 3.1.02026-07-13570316.1 KB
Solana

Swap Solana Tokens

Execute a token swap on Solana. This endpoint handles the full swap flow: fetching the optimal swap route, signing the transaction with your server wallet, executing the swap, and polling until confirmation.

The swap uses aggregated liquidity across Solana DEXs to provide optimal routing. The endpoint waits for the transaction to reach 'confirmed' or 'finalized' status before returning (up to 30 seconds).

Important: Swaps are only available on Solana mainnet.

Authentication: This endpoint requires backend authentication using the x-secret-key header.

post/v1/solana/swap

Request body

addressstring required

Solana wallet address that will execute the swap.

tokenInstring required

Input token mint address (the token being sold).

tokenOutstring required

Output token mint address (the token being purchased).

amountstring required

Amount of input token to swap, expressed in the smallest unit (e.g., lamports for SOL).

chainIdstring required

Example request

{
  "address": "8JBLmveV4YF5AQ7EVnKJgyj6etGgVkPp3tYqQMTu3p5B",
  "tokenIn": "So11111111111111111111111111111111111111112",
  "tokenOut": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
  "amount": "100000000",
  "chainId": "solana:mainnet"
}

Response

Swap executed and confirmed successfully. Returns the transaction signature and swap details including input/output amounts.

Example response

{
  "result": {
    "signature": "5ttCNobho7nk5F1Hh4pU4d9T2o1yAFn3p1w8z8jk2jKd9KWCKN6dzyuT5xP1ny4wz9f5xCLjAF6Y9s9EoTW4aE1X",
    "inputMint": "So11111111111111111111111111111111111111112",
    "outputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
    "inputAmount": "100000000",
    "outputAmount": "95423156",
    "inputUsdValue": 10.5,
    "outputUsdValue": 10.48,
    "requestId": "uuid-1234-5678"
  }
}