Solana Token Swaps via API
FirekeeperWhat's New
GET /v1/solana/swap - Get Swap Quote
Get a quote for swapping Solana tokens without executing the transaction. See the expected output amount, USD values, and slippage before committing.
Example: Get quote to swap 0.1 SOL for USDC
Response:
POST /v1/solana/swap - Execute Swap
Execute a complete token swap with automatic signing, execution, and on-chain confirmation. The swap is confirmed on Solana within 30 seconds or returns a timeout error.
Example: Swap 0.1 SOL for USDC
Response:
View transaction: https://solscan.io/tx/5ttCNobho7nk5F1Hh4pU4d9T2o1yAFn3p1w8z8jk2jKd9KWCKN6dzyuT5xP1ny4wz9f5xCLjAF6Y9s9EoTW4aE1X
Key Features
✨ Aggregated Liquidity - Best prices across multiple DEXs and liquidity sources
💰 USD Value Display - See real-time USD values for input and output amounts
⚡ Automatic Execution - No need to manually sign or submit transactions
🔒 Confirmed Results - Returns only after transaction is confirmed on-chain
🌐 Mainnet Only - Swaps available on Solana mainnet (solana:mainnet)
💸 Gasless Support - Qualifying swaps ($10+ with <0.01 SOL) may be gasless
Common Token Addresses
| Token | Mint Address |
|---|---|
| SOL | So11111111111111111111111111111111111111112 |
| USDC | EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v |
| USDT | Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB |
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
address | string | Yes | Wallet address executing the swap |
tokenIn | string | Yes | Input token mint address (token being sold) |
tokenOut | string | Yes | Output token mint address (token being bought) |
amount | string | Yes | Amount in smallest unit (e.g., lamports for SOL) |
chainId | string | Yes | Must be solana:mainnet |
Response Fields
| Field | Type | Description |
|---|---|---|
signature | string | Transaction signature (POST only) |
inputMint | string | Input token mint address |
outputMint | string | Output token mint address |
inputAmount | string | Amount of input token swapped |
outputAmount | string | Amount of output token received |
inputUsdValue | number | USD value of input amount |
outputUsdValue | number | USD value of output amount |
slippageBps | number | Slippage tolerance in basis points |
requestId | string | Unique request identifier |
Amount Formatting
Amounts must be in the token's smallest unit (before decimals):
- SOL (9 decimals): 1 SOL =
1000000000lamports ="1000000000" - USDC (6 decimals): 1 USDC =
1000000="1000000" - 0.1 SOL:
"100000000"(100 million lamports) - 10 USDC:
"10000000"(10 million)
Error Handling
The API returns detailed error messages for common issues:
Insufficient Balance:
Minimum Swap Amount ($10+ for gasless):
Transaction Timeout:
Ready to start swapping? Check out the full API documentation for more details.