Trade tokens

Make trade and sign

Method is used to execute a trade. It processes a trade request and returns the signature of the transaction.

Attention! If you want to use the generated one-time wallet to sign transactions, just leave parameter "private" blank

If you want to sign transaction via API using you own private key - fill in the field "private" in base58 format.

If you want to use your own node to sign transactions - read Trade tokens [local RPC]

POST /trade

Method is used to generate a swap action

Headers

Name
Value

Content-Type

application/json

x-api-key

The API key for authentication

Parameters

Parameter
Description
Required

mode

Mode of the trade (e.g., “buy”, “sell”)

Yes

token

Token to be traded

Yes

amount

Amount of the token to trade (lamports)

Yes

amountInSol

Boolean indicating if amount is in SOL

Yes

slippage

Allowed slippage percentage (basis points)

Yes

priorityFee

Priority fee for the transaction (microlamports)

Yes

private

Private key (optional)

Body

Response

{
  "signature": "your_transaction_signature"
}

Examples

curl --location 'https://rpc.api-pump.fun/trade' \
--header 'Content-Type: application/json' \
--header 'x-api-key: your_api_key' \
--data '{
  "mode": "buy",
  "token": token_contract,
  "amount": 100000,
  "amountInSol": false,
  "slippage": 500, 
  "priorityFee": 100000
}'

Last updated