Live Trade API

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

Please do NOT use your main wallet private key for transactions on our API. If anybody has access to your API key or privateKey, they can access your funds. If you would prefer to build transactions instead of sending your Private Key through an HTTPS request, please refer to our Local Trade API

Request Body

if {parameter} contains ⚠️, the data may be sensitive and you should double check what you are doing.

ParameterTypeRequiredDescription

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 ⚠️)

privateKey ⚠️

string

Yes

Your Wallet Private Key (use a fresh wallet)

Example Request

curl -X POST "https://api.dangeracorn.com/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"
}

Notes

  • Rate Limiting: This endpoint is rate-limited according to your plan's API key limits. Ensure that you handle these limits in your application.

Last updated