Skip to content

POST /v1/tx/swap

Builds an unsigned transaction to trade a token against a supported quote asset. This is the single endpoint for buys and sells.

  • Method: POST
  • Path: /v1/tx/swap
Authorization: Bearer api_your_key_here
Content-Type: application/json

Every swap has two sides:

  • inputMint: the mint that goes into the DEX
  • outputMint: the mint that comes out of the DEX

For most trades, one side is your token and the other side is one of the supported assets:

AssetMint
SOLSo11111111111111111111111111111111111111111
WSOLSo11111111111111111111111111111111111111112
USDCEPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
{
"inputMint": "<mint going into the DEX>",
"outputMint": "<mint coming out of the DEX>",
"amount": 0.1,
"swapMode": "exactIn",
"slippage": 0.05,
"priority": "fast"
}
  • inputMint (string, required): mint that goes into the DEX.
  • outputMint (string, required): mint that comes out of the DEX.
  • amount (number, required): Human unit amount for the side selected by swapMode.
  • swapMode (string, required):
    • exactIn: amount is the exact input amount. Use this for most buys and sells.
    • exactOut: amount is the exact output amount. Use this when you need to receive exactly a specific amount.
  • slippage (number, required): max allowed slippage as a decimal (0 ≤ slippage < 1). Example: 0.05 = 5%
  • priority (string, required): see Priority (economy | fast | faster | fastest)
{
"success": true,
"data": {
"submissionToken": "txn_…",
"unsignedTransaction": "BASE64_WIRE_TRANSACTION",
"expiresAt": "2025-01-01T00:00:00.000Z",
"platform": "pump_fun",
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "TOKEN_MINT",
"estimates": {
"inputAmount": 0.1,
"outputAmount": 3529922.965,
"priceImpact": 0.00346
},
"priorityCost": 0.000005125
}
}
  • submissionToken links this built transaction for submission via POST /v1/tx/submit.
  • inputMint / outputMint in the response match what you sent in the request.
  • estimates are best-effort outputs assuming the market doesn’t move between build and execution.
  • priceImpact shows how much your trade will move the price; 0.1 means ~10% price impact.
  • priorityCost is the actual priority fee for this transaction. Check this before signing if you have cost limits.

Supported quote assets are SOL, WSOL and USDC.

Spend exactly 0.1 SOL to receive as many tokens as possible. The quote asset goes in, your token comes out.

{
"inputMint": "So11111111111111111111111111111111111111112",
"outputMint": "TOKEN_MINT",
"amount": 0.1,
"swapMode": "exactIn",
"slippage": 0.05,
"priority": "fast"
}

Sell exactly 1 000 000 tokens and receive as much SOL as possible. Your token goes in, the quote asset comes out.

{
"inputMint": "TOKEN_MINT",
"outputMint": "So11111111111111111111111111111111111111112",
"amount": 1000000,
"swapMode": "exactIn",
"slippage": 0.05,
"priority": "fast"
}

Spend exactly 10 USDC to buy a token on a USDC pair.

{
"inputMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
"outputMint": "TOKEN_MINT",
"amount": 10,
"swapMode": "exactIn",
"slippage": 0.05,
"priority": "fast"
}