---
title: "Swap Solana Tokens"
method: POST
path: "/v1/solana/swap"
tags: ["Solana"]
---

# Swap Solana Tokens

`POST /v1/solana/swap`

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.

## Request body

- object — Request payload for executing a token swap on Solana. The endpoint handles swap routing, transaction signing, execution, and confirmation polling.
  - `address` string, required — Solana wallet address that will execute the swap.
  - `tokenIn` string, required — Input token mint address (the token being sold).
  - `tokenOut` string, required — Output token mint address (the token being purchased).
  - `amount` string, required — Amount of input token to swap, expressed in the smallest unit (e.g., lamports for SOL).
  - `chainId` string, required

## Response `200`

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

- object — Response containing the confirmed swap transaction signature and swap details.
  - `result` object, required
    - `signature` string, required — Transaction signature for the confirmed swap on the Solana network.
    - `inputMint` string, required — Input token mint address.
    - `outputMint` string, required — Output token mint address.
    - `inputAmount` string, required — Amount of input token swapped.
    - `outputAmount` string, required — Amount of output token received.
    - `inputUsdValue` number — USD value of the input amount.
    - `outputUsdValue` number — USD value of the output amount.
    - `requestId` string, required — Request ID for this swap.

## Other responses

- `400` — Invalid request parameters, swap API error, or transaction failed on-chain. Check the error message for details.
- `401` — Authentication required. Include x-secret-key or Authorization headers.
- `500` — Internal server error occurred during swap execution or confirmation.
- `504` — Transaction was not confirmed within the 30 second timeout period. The swap may still be pending or dropped.

---

[API](https://skmtc.net/thirdweb/apis/thirdweb-api.md) · [All operations](https://skmtc.net/thirdweb/apis/thirdweb-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/thirdweb/thirdweb-api/revisions/fb4cb67da1c7/schema)
