Generate PumpFun trade transactions via a single API call
Send a POST request, get a serialized Solana transaction back. Sign it with your private key and send through your own RPC. Full control, zero custody.
โธ How it works
Request transaction
POST to /api/trade with your wallet pubkey, token mint, amount, and trade direction.
Sign locally
Receive a serialized transaction. Deserialize and sign it with your private key โ never leaves your machine.
Send via your RPC
Submit the signed transaction through your preferred Solana RPC endpoint. Full control over execution.
โธ Endpoint
/api/tradeReturns a base64-encoded serialized Solana transaction. Content-Type: application/json
โธ Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
publicKey | string | โ yes | Your wallet public key |
action | "buy" | "sell" | โ yes | Trade direction |
mint | string | โ yes | Token contract address (CA) |
amount | number | string | โ yes | SOL or token amount. Sell supports "100%" syntax |
denominatedInSol | "true" | "false" | โ yes | "true" if amount is SOL, "false" if tokens |
slippage | number | โ yes | Percent slippage allowed (0โ100) |
priorityFee | number | โ yes | Priority fee in SOL |
pool | string | no | Currently implemented: "pump". Planned: "pumpswap", "launchlab", "raydium", "raydium-cpmm", "bonk", "auto" |
โธ Response
{
"success": true,
"action": "buy",
"pool": "pump",
"transaction": "base64...",
"estimatedTokens": 12345.678,
"maxSolCost": 0.011,
"tokenStandard": "SPL",
"createsAta": true
}{
"success": true,
"action": "sell",
"pool": "pump",
"transaction": "base64...",
"estimatedSol": 0.05,
"minSolOutput": 0.045,
"sellAmount": 10000,
"tokenBalance": 10000
}โธ Try it out
โ Interactive Demo
curl -X POST /api/trade \
-H "Content-Type: application/json" \
-d '{
"publicKey": "YOUR_PUBLIC_KEY",
"action": "buy",
"mint": "TOKEN_MINT_ADDRESS",
"amount": 0.01,
"denominatedInSol": "true",
"slippage": 10,
"priorityFee": 0.005,
"pool": "auto"
}'โ Code Examples
import { Connection, Keypair, VersionedTransaction } from '@solana/web3.js';
import bs58 from 'bs58';
async function trade() {
// 1. Request serialized transaction from Plugy API
const response = await fetch('https://your-domain.com/api/trade', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
publicKey: "YOUR_WALLET_PUBLIC_KEY",
action: "buy", // "buy" or "sell"
mint: "TOKEN_MINT_ADDRESS", // token contract address
amount: 0.01, // SOL amount or token amount
denominatedInSol: "true", // "true" = SOL, "false" = tokens
slippage: 10, // percent slippage
priorityFee: 0.005, // priority fee in SOL
pool: "auto" // "pump", "raydium", "auto", etc.
})
});
const data = await response.json();
// 2. Decode and sign the transaction
const txBytes = Buffer.from(data.transaction, 'base64');
const tx = VersionedTransaction.deserialize(txBytes);
const keypair = Keypair.fromSecretKey(bs58.decode('YOUR_PRIVATE_KEY'));
tx.sign([keypair]);
// 3. Send via your own RPC
const connection = new Connection('YOUR_RPC_ENDPOINT');
const sig = await connection.sendRawTransaction(tx.serialize(), {
skipPreflight: false,
maxRetries: 3,
});
console.log(`TX: https://solscan.io/tx/${sig}`);
}import requests
from solders.transaction import VersionedTransaction
from solders.keypair import Keypair
from solders.commitment_config import CommitmentLevel
from solders.rpc.requests import SendVersionedTransaction
from solders.rpc.config import RpcSendTransactionConfig
import base64
# 1. Request serialized transaction from Plugy API
response = requests.post(
url="https://your-domain.com/api/trade",
json={
"publicKey": "YOUR_WALLET_PUBLIC_KEY",
"action": "buy",
"mint": "TOKEN_MINT_ADDRESS",
"amount": 0.01,
"denominatedInSol": "true",
"slippage": 10,
"priorityFee": 0.005,
"pool": "auto"
}
)
data = response.json()
# 2. Decode and sign
tx_bytes = base64.b64decode(data["transaction"])
keypair = Keypair.from_base58_string("YOUR_PRIVATE_KEY")
tx = VersionedTransaction(
VersionedTransaction.from_bytes(tx_bytes).message,
[keypair]
)
# 3. Send via your RPC
commitment = CommitmentLevel.Confirmed
config = RpcSendTransactionConfig(preflight_commitment=commitment)
tx_payload = SendVersionedTransaction(tx, config)
rpc_response = requests.post(
url="YOUR_RPC_ENDPOINT",
headers={"Content-Type": "application/json"},
data=tx_payload.to_json()
)
print(f"TX: {rpc_response.json()['result']}")# Buy tokens
curl -X POST https://your-domain.com/api/trade \
-H "Content-Type: application/json" \
-d '{
"publicKey": "YOUR_WALLET_PUBLIC_KEY",
"action": "buy",
"mint": "TOKEN_MINT_ADDRESS",
"amount": 0.01,
"denominatedInSol": "true",
"slippage": 10,
"priorityFee": 0.005,
"pool": "auto"
}'
# Sell all tokens (100%)
curl -X POST https://your-domain.com/api/trade \
-H "Content-Type: application/json" \
-d '{
"publicKey": "YOUR_WALLET_PUBLIC_KEY",
"action": "sell",
"mint": "TOKEN_MINT_ADDRESS",
"amount": "100%",
"denominatedInSol": "false",
"slippage": 10,
"priorityFee": 0.005,
"pool": "auto"
}'โธ Supported Pools
pumpLIVEPumpFun bonding curve
pumpswapSOONPumpSwap AMM
launchlabSOONLaunchLab pools
raydiumSOONRaydium AMM
raydium-cpmmSOONRaydium CPMM
bonkSOONBonk pools
autoSOONAuto-detect best pool
โธ For AI Agents
Send Your AI Agent to Plugy
Teach your agent to trade on PumpFun
Read https://plugy.fun/skill.md and follow the instructions to add the Plugy Trade skill to your agent.
Send your agent to https://plugy.fun/skill.md
Agent reads the skill file and learns how to call the Plugy Trade API
Agent can now generate buy/sell transactions on PumpFun autonomously