To place a buy or sell trade for Pump.fun tokens, send a POST request to:

We will try to land your transaction as fast as possible!

Endpoint URL: https://pumpapi.fun/api/trade

Your request body must contain the following Parameters:

ParameterExampleDescriptionRequired
trade_typeBuy or sell“buy” or “sell” to specify trade typeYes
mintToken mint addressToken mint addressYes
amountValue in of SOL/TokensAmount of SOL or tokens to tradeYes
slippageDesired slippageSlippage allowed (integer)Yes
priorityFeeValue in SOL (optional)Amount to use as priority fee (optional) In SOLNo
userPrivateKeywallet privatekeyThe wallet used the sign the transaction in string format (Phantom wallet’s key format)Yes

Note Amount in SOL , if buying or of tokens if selling.

Accepted Parameters:

The API accepts all parameters listed in the table above.

Examples Usage:

import requests

url = "https://pumpapi.fun/api/trade"
payload = {
    "trade_type": "buy",                    # Buy or sell 
    "mint": "YOUR_MINT_ADDRESS",            # Token mint address
    "amount": 0.01,                         # Amount in SOL , if buying or of tokens if selling.
    "slippage": 5,                          # Desired slippage 
    "priorityFee": 0.003,                   # Value in SOL
    "userPrivateKey: "WALLET_PRIVATEKEY"   # Wallet private key 
}

response = requests.post(url, json=payload)

if response.status_code == 200:
    transaction_id = response.json()["tx_hash"]
    print(f"Transaction ID: {transaction_id}")
else:
    print(f"Error: {response.status_code} - {response.text}")

Response Type:

The API returns JSON data upon successful execution:

{
  "tx_hash": "2wJWJW4Ln7N5EA8WnThaq4m4tgH6TPxcPYMP9ZN1VhyD...."
}

It returns the transaction hash.

Note:

This endpoint requires private key to sign the Tx, our server don’t store the keys. If you need to self sign then get a transaction on Trade Transaction endpoint instead.

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.