Swap
Swap Token
POST
/trade/local/swap
Create a local transaction to trade a token.
Body
action
"buy" | "sell"
Yes
buy or sell the token
mint
string
Yes
Contract address of token to trade
publicKey
string
Yes
bs58 public key of the wallet that is buying/selling
amount
number
Either amount OR percentage must be provided
Amount to buy/sell denominated by ccy field.
ccy
"sol" | "lamports" | "token" | "usd"
Yes IF amount is provided; No IF using percentage
Denomination for amount field (buy 1 sol, buy 1 usd, etc...)
percentage
number > 0 & <=100
Either amount OR percentage must be provided
Percentage of account to buy/sell (1 =1%, 10=10%). Buying 10% means spending 10% of sol in your wallet; Selling 10% means selling 10% of the tokens you own. There is a known bug when buying super high percentages due to fees. We have acknowledged this issue and are actively working on a fix. We recommend not buying more than 80%; Sells are unaffected you may sell 100% still.
slippage
number ≥ 0
No - defaults to 5
% tolerated slippage for transaction (10 = 10%, 1 = 1%. Recommended value is 5%.
priorityFee
number > 0.00001
No - defaults to 0.001
pool
"pump" | "raydium" | "auto"
No - defaults to auto
Response
Tutorial
Last updated