Skip to main content
POST
/
swap
Build swap transaction
curl --request POST \
  --url https://raptor-beta.solanatracker.io/swap \
  --header 'Content-Type: application/json' \
  --data '
{
  "userPublicKey": "<string>",
  "quoteResponse": {
    "inputMint": "<string>",
    "outputMint": "<string>",
    "amountIn": "<string>",
    "amountOut": "<string>",
    "minAmountOut": "<string>",
    "feeAmount": "<string>",
    "priceImpact": 123,
    "slippageBps": 123,
    "routePlan": [
      {
        "programId": "<string>",
        "dex": "<string>",
        "pool": "<string>",
        "inputMint": "<string>",
        "outputMint": "<string>",
        "amountIn": "<string>",
        "amountOut": "<string>",
        "feeAmount": "<string>",
        "priceImpact": 123,
        "percent": 123
      }
    ],
    "contextSlot": 123,
    "timeTaken": 123,
    "swapUsdValue": "<string>",
    "priorityFee": {
      "recommended": 123,
      "level": "<string>",
      "levels": {
        "min": 123,
        "low": 123,
        "medium": 123,
        "high": 123,
        "veryHigh": 123,
        "unsafeMax": 123
      }
    },
    "platformFee": {
      "feeBps": 123,
      "feeAccount": "<string>"
    }
  },
  "wrapUnwrapSol": true,
  "txVersion": "v0",
  "computeUnitPriceMicroLamports": 123,
  "computeUnitLimit": 123,
  "priorityFee": "<string>",
  "maxPriorityFee": 123,
  "tipAccount": "<string>",
  "tipLamports": 123,
  "feeAccount": "<string>",
  "feeBps": 123,
  "feeFromInput": false,
  "chargeBps": 123
}
'
{
  "swapTransaction": "<string>",
  "lastValidBlockHeight": 123,
  "contextSlot": 123,
  "prioritizationFeeLamports": 123
}

Body

application/json
userPublicKey
string
required

User's wallet public key

quoteResponse
object
required
wrapUnwrapSol
boolean
default:true

Automatically wrap/unwrap SOL

txVersion
enum<string>
default:v0

Transaction version

Available options:
legacy,
v0
computeUnitPriceMicroLamports
integer

Priority fee in microlamports

computeUnitLimit
integer

Compute unit limit

priorityFee
string

Priority fee mode or microlamports

maxPriorityFee
integer

Maximum priority fee cap

tipAccount
string

Tip account pubkey

tipLamports
integer

Tip amount in lamports

feeAccount
string

Platform fee recipient

feeBps
integer

Platform fee in basis points

feeFromInput
boolean
default:false

Take fee from input

chargeBps
integer

Extra charge on positive slippage

Response

Successful transaction build

swapTransaction
string
required

Base64-encoded transaction

lastValidBlockHeight
integer
required

Block height until transaction is valid

contextSlot
integer
required

Solana slot when built

prioritizationFeeLamports
integer
required

Priority fee included