Skip to main content

Lightning Trading API

Buy and sell Pump.fun tokens instantly — one HTTP call = done. No client-side signing, no RPC management — just send the request and get the signature.

API Endpoint: POST https://pumpdev.io/api/trade-lightning?api-key=YOUR_KEY


Request Parameters​

ParameterTypeRequiredDescription
actionstringYes"buy" or "sell"
mintstringYesToken mint address
amountnumber/stringYesAmount to trade
denominatedInSolstringNoLegacy field name. Set "true" when a buy amount is in the pair's quote asset: SOL for SOL pairs, USDC for USDC pairs. Keep "false" for sell percentages or exact token amounts
slippagenumberNoSlippage percentage (default: 90)
priorityFeenumberNoPriority fee in SOL (default: 0.00005)
jitoTipnumberNoMEV tip in SOL routed to a Jito tip account (default: 0). Add it only when you intentionally want Jito-tip behavior
computeUnitsnumberNoOverride compute unit limit. If omitted, PumpDev auto-selects a trade-specific limit
creatorstringNoCreator public key. Used only as a fallback when the bonding curve is not readable yet (a just-created mint). When PumpDev can read the curve, the on-chain creator wins — a stale value here would make pump.fun reject the transaction with a creator_vault seeds error
closeTokenAccountbooleanNoClose the token ATA after selling to reclaim ~0.002 SOL rent. Auto-enabled on "100%" sells. Set false to disable

Quote mint handling: You do not pass quoteMint to trade-lightning. PumpDev resolves the pair quote mint from the token on-chain and uses the correct V2 trade path automatically. Buying a non-SOL pair spends that token (USDC, PUMP, xStocks…) from your wallet, so hold enough of it first — otherwise the request fails with Insufficient quote token balance.

Amount Formats​

For buy transactions:

  • 0.1 with denominatedInSol: "true" = Buy with 0.1 SOL
  • 25 with denominatedInSol: "true" on a USDC-quoted token = Buy with 25 USDC

For sell transactions:

  • "100%" = Sell all tokens
  • "50%" = Sell half your tokens
  • 1000000 with denominatedInSol: "false" = Sell exact token amount

Response​

{
"signature": "5x7...",
"mint": "TokenMintAddress",
"action": "buy",
"publicKey": "YourWalletPublicKey",
}

Buy Example​

const response = await fetch(
'https://pumpdev.io/api/trade-lightning?api-key=YOUR_KEY',
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
action: 'buy',
mint: 'TokenMintAddress',
amount: 0.1,
denominatedInSol: 'true'
})
}
);
const { signature } = await response.json();
console.log('Buy executed:', signature);

Buy a USDC-Quoted Coin​

await fetch(
'https://pumpdev.io/api/trade-lightning?api-key=YOUR_KEY',
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
action: 'buy',
mint: 'UsdcQuotedTokenMint',
amount: 25,
denominatedInSol: 'true'
})
}
);

Sell Examples​

Sell 100% of tokens​

const response = await fetch(
'https://pumpdev.io/api/trade-lightning?api-key=YOUR_KEY',
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
action: 'sell',
mint: 'TokenMintAddress',
amount: '100%'
})
}
);
const { signature } = await response.json();

Sell 50% of tokens​

body: JSON.stringify({
action: 'sell',
mint: 'TokenMintAddress',
amount: '50%'
})

Sell exact token amount​

body: JSON.stringify({
action: 'sell',
mint: 'TokenMintAddress',
amount: 1000000,
denominatedInSol: 'false'
})

Automated Bot Example​

Combine WebSocket + Lightning for a fully automated sniper bot:

import WebSocket from 'ws';

const API_URL = 'https://pumpdev.io';
const WS_URL = 'wss://pumpdev.io/ws';
const API_KEY = 'pk_xxxxxxxxxxxxxxxx';

const BUY_AMOUNT_SOL = 0.01;
const MAX_MARKET_CAP_SOL = 50;

let isBuying = false;

const ws = new WebSocket(WS_URL);

ws.on('open', () => {
ws.send(JSON.stringify({ method: 'subscribeNewToken' }));
console.log('Watching for new tokens...');
});

ws.on('message', async (data) => {
const event = JSON.parse(data.toString());

const marketCap = event.marketCapQuote ?? event.marketCapSol ?? 0;

if (
event.txType === 'create' &&
event.quoteMint === 'So11111111111111111111111111111111111111112' &&
marketCap <= MAX_MARKET_CAP_SOL &&
!isBuying
) {
console.log(`New token: ${event.name} (${event.symbol})`);
await buyToken(event.mint);
}
});

async function buyToken(mint) {
isBuying = true;
try {
const response = await fetch(
`${API_URL}/api/trade-lightning?api-key=${API_KEY}`,
{
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
action: 'buy',
mint: mint,
amount: BUY_AMOUNT_SOL,
denominatedInSol: 'true'
})
}
);

const result = await response.json();
if (result.signature) {
console.log('Buy executed:', result.signature);
} else {
console.log('Error:', result.error);
}
} catch (err) {
console.error('Error:', err.message);
} finally {
isBuying = false;
}
}
No Signing Required

With Lightning, your bot never touches private keys. One HTTP call = done — perfect for server-side bots and automated systems.


Error Handling​

ErrorRoot CauseSolution
Missing required fields: action, mint, amountOne or more required fields missingInclude all required fields
action must be 'buy' or 'sell'Invalid action parameterUse "buy" or "sell"
Invalid mint addressMint address malformedVerify mint address format
Token bonding curve not foundToken doesn't exist on Pump.funVerify the mint address
PumpSwap pool not found. Use Jupiter or Raydium for this token.Graduated token without a PumpSwap poolUse Jupiter or Raydium instead
No token balance foundWallet doesn't hold tokens for sellEnsure you have tokens for this mint
Insufficient quote token balance: this coin is priced in <mint>, not SOL…The coin trades against a token other than SOL and the wallet holds less of it than the buy amountGet that token into the wallet first, or pick a SOL-paired coin
Invalid percentage valueSell percentage is invalidUse a valid percentage like "50%" or "100%"
Calculated sell amount is zeroToken balance too small for the percentageUse "100%" or a larger percentage

trade-local vs trade-lightning​

Featuretrade-localtrade-lightning
SigningYou sign locallyServer signs
BroadcastingYou send via your RPCServer sends for you
SetupNeed wallet + RPCNeed API key only
ControlFull controlKeys on server
SpeedDepends on your RPCOptimized for fastest execution
Use caseClient-side, secure keysServer-side bots, instant trades
When to Use Each
  • trade-local: Your keys never leave your machine. Best for client-side apps or when you need maximum security.
  • trade-lightning: One HTTP call, server handles everything. Best for server-side bots, snipers, and automated trading where speed matters.

Next Steps​