https://api.easypumpfun.com/buy
import requests
url = "https://api.easypumpfun.com/buy"
data = {
"keypair": "2oPQn9z1OaXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXNwt02aoMW7",
"mint": "9BB6NFEcjBCtnNLFko2FqVQBq8HHM13kCyYcdQbgpump",
"sol_in": 0.5,
"slippage": 2,
"sol_fee": 0.0001
}
response = requests.post(url, json=data)
print("Status Code:", response.status_code)
print("Response:", response.json())
https://api.easypumpfun.com/sell
import requests
url = "https://api.easypumpfun.com/sell"
data = {
"keypair": "2oPQn9z1OaXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXNwt02aoMW7",
"mint": "9BB6NFEcjBCtnNLFko2FqVQBq8HHM13kCyYcdQbgpump",
"percentage": 75,
"slippage": 2,
"sol_fee": 0.0001
}
response = requests.post(url, json=data)
print("Status Code:", response.status_code)
print("Response:", response.json())
A response status code 200 means the API is functioning correctly and handling requests as expected. Any other status code indicates an issue with the API. Even if the status code is 200 the transaction can still fail. This indicates that the API is functioning correctly but the transaction failed due to an incorrect setup or another issue.
{
"failed": {
"message": null,
"status": false
},
"signature": "4ci6dTW6D6ocnKiT8qzD9Bg89wpWx5KeXW2h8JTqeZfk6zKF81AbYUnKuEcTQmdma7Q2mBnutZEW89ZCYpADfzo1"
}
This field provides information about whether the transaction failed. It contains two subfields:
Hash for the completed transaction. If the transaction fails, this field might still be present if the API successfully processed the request but encountered an issue with the transaction completion.
#FOR BUY
data = {
"keypair": "2oPQn9z1OaXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXNwt02aoMW7",
"mint": "9BB6NFEcjBCtnNLFko2FqVQBq8HHM13kCyYcdQbgpump",
"sol_in": 0.5,
"slippage": 2,
"sol_fee": 0.0001
}
9BB6NFEcjBCtnNLFko2FqVQBq8HHM13kCyYcdQbgpump
0.5 SOL
2%
0.0001 SOL
#FOR SELL
data = {
"keypair": "2oPQn9z1OaXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXNwt02aoMW7",
"mint": "9BB6NFEcjBCtnNLFko2FqVQBq8HHM13kCyYcdQbgpump",
"percentage": 100,
"slippage": 2,
"compute": 100_000,
"mlamports": 2_000_000
}
9BB6NFEcjBCtnNLFko2FqVQBq8HHM13kCyYcdQbgpump
100%
2%
100_000
2_000_000
Your private key for the wallet you want to use.
DO NOT SHARE THIS WITH ANYONE!
"keypair": 2oPQn9z1OaXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXNwt02aoMW7
Token's contract address (CA).
"mint": 9BB6NFEcjBCtnNLFko2FqVQBq8HHM13kCyYcdQbgpump
Amount of SOL you want to spend buying the token.
"sol_in": 0.3 (buy for 0.3 SOL)
Percentage of token holdings you want to sell.
"percentage": 50 (sell 50% of your tokens)
The acceptable slippage percentage for the transaction. Higher values increase the likelihood of a successful transaction.
"slippage": 2 (if unsure set it to 2%)
Slippage is like agreeing to a small price change while buying or selling. Let's say you set slippage to 0% while buying X amount of tokens for 1 SOL. But by the time your transaction is completed other people might also be buying, which drives the price up. If the price of the token increases by 1% during that time, the cost for X tokens would now be 1.01 SOL. Since your transaction is only set to pay 1 SOL for now 1.01 SOL worth of tokens, it will fail. In the same example if you were to set slippage to 2%, you are basically saying you are willing to pay up to 2% more than 1 SOL for that X amount of tokens. So if the price increases to 1.01 SOL, your transaction will succeed and you will pay 1.01 SOL for X amount of tokens. Notice that you only paid 1% more, meaning not all of the available slippage was used. If the price change is greater than 2%, for example 1.03 SOL, your transaction will still fail. Slippage is essentially like saying you are willing to paying up to 2% more for X tokens to make sure my transaction goes through, even if the price changes while it's being processed. Higher slippage is needed for tokens with a lot of trading activity. But don't set it too high to avoid overpaying. If you didn't understand any of this just set it to 2%
All the parameters listed above are required and the API cannot function without them. When determining transaction fee costs you have two options. Either set the fee automatically by specifying the desired amount in SOL. Or configure it manually by providing the Compute Units and microLamports. One of these two methods must be used. Otherwise the transaction cannot be completed without setting up the fees
Easy Pump Fun API doesn't charge you any fees. However for every transaction you'll pay an additional 1% of the transaction value to Pump Fun (nothing you can do about it). Plus if you're buying a token for the first time a little bit more than 0.002 SOL will be charged to create the token account in your wallet (also nothing you can do about it).
Amount of SOL you want to use for fees. It will be added on top of the transaction cost.
"sol_fee": 0.0001
Keep in mind that if you configure fees this way, the actual cost may not be exact but will be approximately around the specified value.
Maximum number of compute units to be used for the transaction.
If you set "sol_fee" you don't need to set this.
"compute": 100_000
Cost of a single compute unit in microLamports.
If you set "sol_fee" you don't need to set this.
"mlamports": 2_000_000
Priority Fee Tracker