Quote (optional): GET /v1/quote?mint&side&amount. Buys take lamports in, sells take raw token units (6 decimals).
Build: POST /v1/swap. The server quotes fresh, builds, simulates, then sets the compute limit to the simulated use x 1.2 + 5000 and the priority fee ("auto" by default).
Sign the base64 v0 transaction in the wallet. Wallets may add their own instructions; the swap instruction must stay as built.
Submit: POST /v1/submit. It is rebroadcast every 2 s (and sent to Jito when built with a tip) until it confirms, fails or expires. Or send it with your own RPC: the trade is indexed either way.
Track: GET /v1/swaps/{id} or GET /v1/tx/{signature}.
const r = await justi.buy({ mint, sol: 0.25, signer: wallet, slippageBps: 800 });
if (r.status === "failed" && r.error?.code === "slippage") {
// retry with r.error.suggestSlippageBps
}
After graduation: a direct swap on the coin's Meteora DAMM v2 pool.
jupiter
Only as a fallback (fallback: true) when a direct build fails for a reason that is not the trader's, or between curve full and migrated if Jupiter has a route. Otherwise that short window answers graduating (409).
Measured on mainnet by simulation: a curve buy is about 660 bytes and 50,000 compute units; a DAMM v2 swap about 680 to 730 bytes and 36,000 to 42,000 units.
Every quote has fee.total and fee.parts, which sum to the total: creator, holders, platformBurnJusti, platformWallet, sniperBurnCoin, sniperBurnJusti, sniperPlatform, meteora, liquidityProviders, referral. In the sniper window, fee.windowSecondsLeft and fee.windowExtra show the opening fee. On DAMM v2 the fee goes to the locked LP positions and Meteora, and a both-token pool takes the buy fee in the coin (fee.token = "TOKEN").
A trade that fails on chain is a 200 from submit with status: "failed" and error.code. For slippage, error.suggestSlippageBps is the slippage that would have passed. An expired blockhash gives expired: build again.
Submit answer
{ "swapId": "...", "status": "failed", "signature": "...", "mint": "...", "side": "buy", "route": "curve",
"error": { "code": "slippage", "message": "The price moved past your slippage. Try again with a little more room.", "suggestSlippageBps": 1500 } }
#Build an unsigned v0 swap transaction for a wallet
POST/v1/swap
Key optionalRate class buildBody 8kbbuildSwap
Quotes fresh, builds, simulates and sets the compute limit. Sign the returned transaction with the wallet and send it to POST /v1/submit (or send it yourself). The wallet may add instructions, but the swap instruction must stay as built.
Body
Field
Type
About
mintrequired
address
walletrequired
address
Fee payer and signer.
siderequired
"buy" | "sell"
buy: SOL in, coin out. sell: coin in, SOL out.
amountrequired
u64 string
Lamports to spend on a buy, raw tokens to sell.
slippageBps
integer
Basis points, 10 to 5000. Default 1000 (10%).
priorityFee
"auto" | integer
"auto" (Helius estimate or recent fees on the pool) or micro-lamports per compute unit. default "auto"
computeUnitLimit
"auto" | integer
"auto": simulated use x 1.2 + 5000. default "auto"
jitoTipLamports
u64 string
Adds a tip transfer to a Jito tip account; submit then also sends through Jito. 0 or 1000 to 100000000.
Checks it is paid and signed by the building wallet and carries the exact swap instruction built, then sends it (RPC rebroadcast every 2s, plus Jito when built with a tip) until confirmed, failed or expired. Answers when it settles or after waitMs (default 20000, max 25000) with status submitted; poll GET /v1/tx/{signature}. A trade that fails on chain is a 200 with status failed and an error.