Documentation Index
Fetch the complete documentation index at: https://docs.raydium.io/llms.txt
Use this file to discover all available pages before exploring further.
The Trade API is a thin set of endpoints on
transaction-v1.raydium.io (and some mirrored paths on api-v3.raydium.io) that quote a swap, build a signed-ready Solana transaction, and return it in one round trip. It is the same surface the Raydium UI uses. Use it when you want Raydium routing without bundling the TS SDK — backends, Blinks handlers, Telegram bots, third-party apps.When to use the Trade API vs the SDK
| You want to… | Use |
|---|---|
| Integrate swaps into a backend that cannot bundle npm packages (e.g. Python bot, Go service, Rust service) | Trade API |
| Render a swap Blink in a social post | Trade API |
| Build a browser app where shaving kilobytes matters | Trade API |
| Embed routing logic inside another Solana program (CPI) | Neither — use sdk-api/rust-cpi |
| Build a full DEX-like client with custom route preview, chart overlays, priority-fee heuristics | TS SDK |
| Need deterministic offline quoting without a network round trip | TS SDK (with local pool state) |
The three endpoints
1. GET /compute/swap-base-in
Given an input amount, pick a route and return a quote.
id field is an opaque quote handle passed to the next endpoint. The quote is stable for ~30 seconds; beyond that, re-quote.
2. GET /compute/swap-base-out
Inverted form: “I want to receive exactly N of the output; quote me the required input.”
swap-base-in; amount field semantics flip.
3. POST /transaction/swap-base-in and /transaction/swap-base-out
Takes the quote from step 1 and returns a signed-ready versioned transaction:
Minimal end-to-end example (Python)
Routing and pool selection
The Trade API routes across all Raydium programs (CPMM, CLMM, AMM v4) and picks the best execution for the quoted size. Characteristics:- Multi-hop supported. A SOL→USDC swap can route through wSOL→JUP→USDC if that’s cheaper.
- Same-program multi-pool splitting not supported. A single quote goes through exactly one path; if you want to split size across pools, do it client-side (two quotes, two txs).
- Stable vs concentrated. The router preferentially uses CLMM when in-range liquidity is adequate, falling back to CPMM for long-tail pairs.
- AMM v4 inclusion. AMM v4 pools are included in routing but only chosen when they offer better pricing than CPMM/CLMM alternatives.
Referrer parameter
Append&referrer=<wallet_pubkey> to the compute endpoint to take a 1% referral cut on the swap. See user-flows/referrals-and-blinks for semantics. When present:
referrerAmountin the quote response is the absolute amount (in input mint) that will be routed to the referrer.- The final transaction contains an extra SPL token transfer to the referrer’s ATA.
Priority fees
computeUnitPriceMicroLamports in the build request sets the priority fee for the returned transaction. Rule of thumb:
50_000(0.00005 lamports/CU × 200k CU ≈ 0.00001 SOL): minimal, fine for non-congested moments.200_000: moderate congestion.1_000_000: heavy congestion.
getRecentPrioritizationFees on your RPC first and pass the median. See integration-guides/priority-fee-tuning.
Transaction versions
"V0"returns a versioned (MessageV0) transaction with a lookup table for common accounts. Smaller, faster. Recommended."LEGACY"returns a legacy transaction. Larger; only use if your wallet/infra doesn’t handle V0.
Error shapes
The API returns HTTP 200 withsuccess: false for logical errors, HTTP 4xx/5xx for transport / infra errors.
Common logical errors:
"No route found"— no path between the two mints at this size. Reduceamountor reconsider pair."Insufficient liquidity"— a route exists but would blow pastslippageBps. Widen slippage."Quote expired"—swapResponseis >30s old. Re-quote."Unsupported mint"— mint is not in Raydium’s universe (unlisted, or on a deprecated program).
Rate limits
- Quote endpoints: 120 req/min per IP.
- Build endpoints: 60 req/min per IP (higher cost on the server).
- Exceeding limits returns HTTP 429 with
Retry-Afterheader.
Architectural pattern for integrators
Where to go next
sdk-api/typescript-sdk— richer programmatic interface with the same underlying programs.sdk-api/rest-api— read-side endpoints (pool info, mint info) to complement Trade API’s write side.user-flows/swap— end-to-end UI swap flow.integration-guides/aggregator— pattern for aggregators that route across many DEXes.
transaction-v1.raydium.iolive endpoints.- Raydium UI network-tab inspection (same surface consumed).


