Skip to main content
GET
Swap
Get the best route and transaction for swapping between two tokens on Solana via Kamino’s swap aggregator.

Example

1

Import Dependencies

2

Configure and Initialize

3

Fetch Swap Transaction

Call the KSwap API to get the best route and a pre-built transaction. This example swaps 1 SOL to USDC with 50bps max slippage.
4

Decode, Sign, and Send

Decode the base64 transaction, sign it locally, and submit to the network.

Query Parameters

tokenIn
string
required
tokenOut
string
required
amountIn
string
required
maxSlippageBps
number
required
wallet
string
required
includeSetupIxs
boolean
default:true
wrapAndUnwrapSol
boolean
default:true

Response

200 - application/json

Default Response

data
object
required
traceId
string