Solana

Get Solana Swap Quote

Get a quote for swapping tokens on Solana. This endpoint returns the expected output amount and swap details without executing the transaction.

Important: Swaps are only available on Solana mainnet.

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

get/v1/solana/swap

Request

  • Base URL
    https://api.thirdweb.com
  • Auth
    API key in header x-secret-key

Query parameters

addressstring required

Solana wallet address that will execute the swap.

Example:8JBLmveV4YF5AQ7EVnKJgyj6etGgVkPp3tYqQMTu3p5B
tokenInstring required

Input token mint address (the token being sold).

Example:8JBLmveV4YF5AQ7EVnKJgyj6etGgVkPp3tYqQMTu3p5B
tokenOutstring required

Output token mint address (the token being purchased).

Example:8JBLmveV4YF5AQ7EVnKJgyj6etGgVkPp3tYqQMTu3p5B
amountstring required

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

chainIdstring required
Example:eip155:1

Response

Quote fetched successfully. Returns expected output amount and swap details.

Example response

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

Changes

No recorded changes to this operation across all 5 revisions of this API.