🚧Webhooks
This API allows users to trade SunPump tokens using TRX. This includes Buy and Sell transactions.
Endpoint
URL:
/sunpump/trade
Method:
POST
Content-Type:
application/json
API Key Header:
api-key: your-api-key-here
Request Body
Parameter
Type
Required
Description
action
string
Yes
Type of transaction:
buy
or sell
tokenAddress
string
Yes
Token Contract Address
amount
number
Yes
Amount to trade (TRX for Buys)
slippage
number
No
Max allowed price change before transaction is reverted
priorityFee
number
No
Tip to speed up transactions (experimental ⚠️)
Example Request
curl -X POST "https://api.dangeracorn.bot/sunpump/trade" \
-H "Content-Type: application/json" \
-H "api-key: your-api-key" \
-d '{
"action": "buy",
"tokenAddress": "TXu7ZTRhX5FqGbVNGg81DovGHedZXPQB1A",
"amount": 100,
"slippage": 5,
"priorityFee": 10,
"privateKey": "your-private-key"
}'
Example Response JSON
{
"signature": "b69f27c7bfcf54a464294f1df99aaeff1b53714a12a80460709b20923a24486c",
"status": "success",
"code": "200"
}
Example Error Responses
Invalid Parameters:
jsonCopy code{
"error": "Invalid parameters",
"message": "You must provide action, tokenAddress, amount, and privateKey",
"code": "400"
}
Max Slippage Reached:
jsonCopy code{
"error": "Simulation failed",
"message": "Max slippage reached",
"code": "500"
}
Insufficient Funds:
jsonCopy code{
"error": "Insufficient funds",
"message": "Your account does not have enough funds to perform this transaction.",
"code": "400"
}
Invalid Action:
jsonCopy code{
"error": "Invalid action",
"message": "Action must be either 'buy' or 'sell'",
"code": "400"
}
Last updated
Was this helpful?