Skip to main content

Lightning Transactions

The one-call flow. You click Generate, we create a wallet just for you and store an encrypted copy. After that, send us an API key with each trade request and we sign + submit on your behalf - optionally through Jito and other validators for fastest landing.

Use this if you don't want to manage signing or run your own RPC.

Generate a wallet

How it works

  1. Generate - pumpdata creates a Solana wallet just for you. We give you the public key, the private key (shown once), and an API key. The private key is encrypted with a server-side key before it touches the database.
  2. Fund - send some SOL to the publicKey. That's the wallet pumpdata will trade with.
  3. Trade - call /api/lightning-trade with your API key + the trade you want. We sign and submit immediately.

Example

The apiKey goes in the request body (not a header). amount is in SOL when buying and tokens when selling.

const res = await fetch("https://api.pumpdata.fun/api/lightning-trade", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
apiKey: "pd_xxxxxxxx…", // from Generate, above
action: "buy", // "buy" or "sell"
mint: "<token mint>", // base58 token mint
amount: 0.01, // SOL when buying, tokens when selling
slippage: 10, // percent (default 5)
priorityFee: 0.0001, // SOL (optional)
pool: "pumpfun", // pumpfun | pumpswap | bonk | raydium_cpmm | raydium_amm_v4 | meteora_damm_v2
// poolAddress: "...", // base58, optional - auto-resolves to largest WSOL/USDC pool on raydium_cpmm | raydium_amm_v4 | meteora_damm_v2
swqos: true, // route via Jito etc. for faster landing
}),
});
const { success, signature, error } = await res.json();
console.log(success ? "https://solscan.io/tx/" + signature : error);

Try it

Live mode: this widget submits the request to /api/lightning-trade and prints the response. Your custodial wallet WILL be used. Paste your API key (we never log it). poolAddress is optional - if omitted on raydium_cpmm / raydium_amm_v4 / meteora_damm_v2, we auto-resolve to the cached pool with the largest WSOL or USDC vault balance for the mint.

Response

{
"signature": "5xZ…",
"success": true,
"error": null,
"fee_lamports": 30000
}

Why this is convenient (and what you give up)

  • One round-trip per trade - no client-side signing, no RPC of your own.
  • Optional SWQOS routing through providers like Jito for faster landing.
  • Tradeoff: we hold the encrypted private key. If you want zero custodial risk, use the Local Trade API instead, where your private key never leaves your machine.

If something goes wrong

You'll get { "success": false, "error": "...", "signature": null }. Usual causes: invalid mint, wallet not funded, slippage exceeded.