Trade Transaction
Get the buy and sell transaction for pumpfun tokens
To get a buy or sell transaction that you can self sign and send using your RPC for Pump.fun tokens, send a POST request to:
Note:
If you just need to skip this complex process & just place a buy/sell use Trade API endpoint instead.
Endpoint URL: https://pumpapi.fun/api/trade_transaction
Your request body must contain the following Parameters:
Parameter | Example | Description | Required |
---|---|---|---|
trade_type | Buy or sell | ”buy” or “sell” to specify trade type | Yes |
mint | Token mint address | Token mint address | Yes |
amount | Value in of SOL/Tokens | Amount of SOL or tokens to trade | Yes |
slippage | Desired slippage | Slippage allowed (integer) | Yes |
priorityFee | Value in SOL (optional) | Amount to use as priority fee (optional) In SOL | No |
userPublicKey | User wallet address | The wallet used the sign the transaction | Yes |
Accepted Parameters:
The API accepts all parameters listed in the table above.
Note Amount in SOL , if buying or of tokens if selling.
Examples Usage:
Response Type:
The API returns JSON data upon successful execution:
The transaction
object is a base58 encoded transaction which later you can sign and send it as per your needs.
Below shows how to do this:
Now below is the complete snippet to sign and send the transaction:
Error Codes
400 Bad Request
: Invalid request parameters or missing required fields.401 Unauthorized
: Authentication failed.404 Not Found
: The requested resource (endpoint) is not found.429 Too Many Requests
: Rate limit exceeded.500 Internal Server Error
: Unexpected server-side error.
API Codes
200 OK
: The request was successful.