Skip to main content

Buy and Sell – API

Use this to buy and sell tokens.
Supported pools

  • Pump.fun
  • Raydium LaunchPad (including bonk)
  • Meteora LaunchPad (including Bags.fm, moonshot)
  • PumpSwap
  • Raydium CPMM
  • Meteora DAMM V1
  • Meteora DAMM V2
  • Meteora DLMM

Endpoint

POST https://api.pumpapi.io

⚡ Lightning Transaction

Lightning transaction is a method of sending transactions where we broadcast the transaction on your behalf.
This approach allows for:

  • 🚀 Maximum transaction speed
  • 🧩 Minimal code complexity

By handling the transaction process internally, you don’t have to construct the transaction manually — we do it for you.

To use this feature, simply provide a wallet privateKey — it’s needed to sign and broadcast the transaction on your behalf.

🔑 Don't want to send your private key? Use apiKey instead (optional)

This step is completely optional — it's only for users who prefer not to send their private key over the network. An apiKey is an AES-256 encrypted form of your wallet's private key. Generate it once below, then simply pass apiKey instead of privateKey in any API request — everything else stays exactly the same.

import requests

response = requests.post("https://wallet.pumpapi.io", json={
# "privateKey": "base58_private_key", # uncomment if you want to get an apiKey for your existing private key
})
print(response.json()) # {"apiKey": "...", "publicKey": "...", "privateKey": "..."}

Request Body

FieldDescription
privateKeyNot required if apiKey is provided. Private key in Base58 format.
apiKeyNot required if privateKey is provided. Encrypted alternative to privateKey — pass it instead if you don't want to send a raw private key. All other fields and behavior stay exactly the same. Generate one in the spoiler above.
action"buy" or "sell"
mintMint address of the token
quoteMintOptional. Not required. Use this only when you want to limit pool selection to pools where mint is paired with a specific quote token. If you do not provide quoteMint, we automatically choose the best available pool for mint; the quote token of that selected pool will be spent when buying or received when selling.
poolIdOptional. Not required. provide this if you need to trade token from the specific pool.
amountAmount to trade. Use '100%' to sell all and get a 0.002 sol refund from the network
denominatedInQuote"true" if amount is in SOL (or any other quote token), "false" for token amount
slippageSlippage in percent (recommended: 20)
maxQuoteAmountIn
minBaseAmountOut
maxBaseAmountIn
minQuoteAmountOut
Optional. Not required. Pre-calculate exact bounds and pass them directly. Unlike slippage (a percent applied to the current market price — so if the price shifts before your tx lands, your effective bounds shift with it), these fields are absolute values that stay exactly as you set them. Useful when the price may move between your decision and your tx landing on-chain. Buy: maxQuoteAmountIn (max quote spent), minBaseAmountOut (min tokens received). Sell: maxBaseAmountIn (max tokens spent), minQuoteAmountOut (min quote received). slippage must always be present in the request: if you provide only one of the two fields, the other is derived from slippage; if you provide both, slippage is not used but still required. We recommend providing both fields.
priorityFeeOptional. Not required. Extra fee (in SOL) to speed up your transaction and increase its chance it lands in the current block.

There are two modes of operation:

1️⃣ Automatic Jito split (≥ 0.00023 SOL):
If the value is 0.00023 SOL or higher, PumpAPI automatically splits it:
90% → jitoTip (used by ~90% of validators)
10% → priorityFee (for non-Jito validators)

2️⃣ No split (< 0.00023 SOL):
If the value is less than 0.00023 SOL, no split occurs. The full amount is treated as priorityFee, and the transaction is sent via SWQOS (fast non-Jito route).
jitoTipOptional. Use this if you don’t want automatic priorityFee split.
Example: 'jitoTip': 0.0002.
Minimum required to join Jito auction: 0.0002 SOL. Anything below that is ignored, and the transaction is sent without Jito participation. When jitoTip is provided, your entire priorityFee remains intact (not split).
guaranteedDeliveryOptional experimental feature "true" tells the server to rebroadcast the transaction for up to 10 seconds and respond with confirmed: true if it appears on-chain within that time. Otherwise, you receive confirmed: false. ⚠️ This affects response time: if you want an immediate reply (without confirmation of success), set this to false!
partnerAddressOptional. Run your own service and want to receive a fee from your users? Set this field. The fee defined in partnerFeeRatio + partnerFeeFixed will be sent to this address.
You can also use it if your strategy requires sending funds somewhere after the operation.
partnerFeeRatioOptional. Percentage of the trade you want to send to partnerAddress. Example: 0.005 = 0.5%, 0.01 = 1%.
partnerFeeFixedOptional. A fixed amount (in SOL) you want to send to partnerAddress for the operation. Example: 0.0001.
mintRefOptional. When using Jito Bundles or Actions and creating tokens, you don’t yet know the token address assigned to you (unless you provide mintPrivateKey). To handle this, within a single request you can set "mintRef": "any value" (the default is "0") and reuse it across related transactions inside the same Jito Bundle or Actions. When buying the token, specify "mintRef": "the value you set earlier", and the backend will understand which token you’re referring to. Works within a single request; a second request requires providing the mint address.

import requests

url = "https://api.pumpapi.io"

data = {
"privateKey": "base58_private_key", # or pass "apiKey": "your_api_key" instead — see the 🔑 spoiler above
"action": "buy",
"mint": "token_address",
"amount": 0.01,
"denominatedInQuote": "true",
"slippage": 20,
"priorityFee": 0.0001,
}

response = requests.post(url, json=data)
print(response.json())

Response Format

Request typeResponse
Single transaction{"signature": "...", "err": "", "timestamp": "timestamp_ms"}, 'trades': [{'poolId': 'pool_id_used', 'mint': 'mint_address_used', 'quoteMint': 'quote_mint_address_used', 'pool': 'name_of_the_amm'}]
Jito Bundle (up to 5 txs){"signatures": ["...", "..."], "err": "", "timestamp": "timestamp_ms", "bundleUUIDs": ["bundle_uuid]}, 'trades': [{'poolId': 'pool_id_used', 'mint': 'mint_address_used', 'quoteMint': 'quote_mint_address_used', 'pool': 'name_of_the_amm'}]

err is an empty string "" on success, or the error message on failure. Extra fields may appear depending on the action (e.g. createdMints when creating tokens).


Need help? Join our Telegram group.