served on the RPC endpoint
Route quotes from the router across 17 Solana pool families, on the RPC endpoint and key. POST quote to https://services.carbium.sh, then call swap for the unsigned transaction. Bought per account; the plan's rate is shared by its keys.
# Quotecurl https://services.carbium.sh \ -H 'content-type: application/json' -H 'x-api-key: <YOUR_KEY>' \ -d '{"jsonrpc":"2.0","id":1,"method":"quote","params":[{ "src_mint":"So11111111111111111111111111111111111111112", "dst_mint":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "amount_in":"1000000000","slippage_bps":50}]}'# -> {"jsonrpc":"2.0","result":{# "srcAmountIn":"1000000000","destAmountOut":"109583697","minAmountOut":"109035778",# "slippageBps":50,"swapMode":"BaseIn",# "inputMint":"So11111111111111111111111111111111111111112",# "outputMint":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",# "routePlan":[{"hop":0,"percent":"100","swapInfo":{# "ammKey":"DJNtGuBGEQiUCWE8F981M2C3ZghZt2XLD8f2sQdZ6rsZ","label":"pancakeswap-v3",# "inputMint":"So11111111111111111111111111111111111111112",# "outputMint":"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",# "inAmount":"999500000","outAmount":"109583697"}}],# "quoteId":"65a5c08fd08b79ea9ffd4290a229a5fb",# "platformFee":{"amount":"500000","feeBps":5,"mint":"So11111111111111111111111111111111111111112"}},"id":1}# Pin venues with "dex":"o-whirlpool" or "dex":["o-whirlpool","r-clmm"].
request and result
| field | type | meaning |
|---|---|---|
| params · required, positional [{...}] or by name | ||
| src_mint | base58 | input mint |
| dst_mint | base58 | output mint; not src_mint |
| amount_in | u64, number or string | input amount, base units; a string keeps precision past 2^53 |
| slippage_bps | 0 to 5000 | sets minAmountOut: 50 is 0.5% |
| params · optional | ||
| dex | label, or array of labels; alias: dexes | only these families (table below), one hop src_mint to dst_mint, may split across their pools; no such route: -32051 no_route_in_pinned_dex, never another venue's route. Omit to search every family, multi-hop and split |
| txVersion | number, optional | 0 (default): v0 with address lookup tables, at most 1,232 B. 1: v1 with every address inline, at most 4,096 B, for routes v0 cannot fit. Over 64 accounts is refused in both |
| swapTag | number, optional | 0 (default): the router picks the form. 1: the plain form: data starts with tag 0x01, no middle block, each middle token account made by its own idempotent instruction, paid and owned by your wallet, left open; same route, price, fee and floor. v0 only: with txVersion 1, -32602 (the quote upstream refused the request) with error.data.code swap_tag_format |
| maxAccounts | number, optional | the account cap, 1 to 64. A route fits when its transaction loads at most that many accounts, lookup tables included, or its router instruction lists at most that many; the swap is built under the same cap. Omitted: no cap, except 64 with swapTag 1, where the instruction's entries alone count, repeats included. No route fits: -32055; out of range: -32602 (the quote upstream refused the request) with error.data.code bad_max_accounts |
| integrator_fee_bps | 0 to 5000, optional; alias: fee_bps | your own fee, in basis points: 50 is 0.5%. 0 or omitted: none. Send it with integrator_fee_account, or neither. One alone, out of range, or above 0 with swapTag 1: -32602 |
| integrator_fee_account | base58, optional; alias: treasury | the wallet that receives your fee: a wallet address, not a token account. Counts as one more account toward maxAccounts |
| result | ||
| srcAmountIn | string | input amount, base units |
| destAmountOut | string | expected output, base units, net of platformFee, of integratorFee when you asked one, and of any Token-2022 transfer fee on the route's mints; do not take them off again |
| minAmountOut | string | the exact floor swap sets, rounded down; the transaction never fills below it. Fee off the output (SOL out, or USDC or USDT out with no SOL in): G = floor(gross × (10000 − slippageBps) / 10000), then G − floor(G × feeBps / 10000), gross being destAmountOut plus platformFee.amount; with an integratorFee both fees come off G together, floor(G × (10000 − feeBps − integratorFee.feeBps) / 10000), gross being destAmountOut plus both amounts. Otherwise: floor(destAmountOut × (10000 − slippageBps) / 10000) |
| slippageBps, swapMode | number, string | your slippage; always BaseIn |
| inputMint, outputMint | base58 | the pair |
| routePlan[] | array | legs: hop (depth), percent (share of the hop's input), swapInfo {ammKey, label, inputMint, outputMint, inAmount, outAmount} |
| quoteId | 32 hex | for swap; valid 30 s |
| platformFee | object, when charged | {amount, feeBps, mint}: router fee, rounded down. Mint: SOL when SOL is at either end, else USDC or USDT when that is the output, else the input token. Taken off the input before the route, except on SOL out, or USDC or USDT out with no SOL in, where destAmountOut and minAmountOut are net of it. Absent when it rounds to 0 (a base under 2,000 atoms), or on an input-token route whose input is a Token-2022 mint with a transfer hook program set (an empty hook still pays), frozen by default or non-transferable |
| integratorFee | object, when asked | {amount, feeBps, mint, account}: your own fee, set by integrator_fee_bps, rounded down; amount a string in base units of mint, account the wallet you sent. Same mint and side as platformFee, on the same base, and inside destAmountOut and minAmountOut like it. Present whenever integrator_fee_bps is above 0, even when amount is 0; absent otherwise. The transaction can still skip paying it: see Integrator fee, below |
| txVersion | number; v1 only | 1 when asked; its transaction is v1. Absent on v0 |
| swapTag | number; tagged only | 1 when asked; its transaction is the plain form. Absent otherwise |
| partial, requestedAmountIn | boolean, string; partial only | only part of amount_in can fill: past what its one pool pays out (any family; that bound less 3%), or a SOL-input route that cannot fill it whole (why first_hop_unfilled; halved up to 6 times, down to 1/64, the first part that fills served). srcAmountIn is the part, requestedAmountIn your ask; swap builds the part |
venues
| dex label | venue |
|---|---|
| r-amm | Raydium AMM v4 |
| r-cpmm | Raydium CPMM |
| r-clmm | Raydium CLMM |
| r-lpad | Raydium LaunchLab |
| o-whirlpool | Orca Whirlpool |
| o-orca-v1 | Orca legacy pools (token-swap v1) |
| o-orca-v2 | Orca legacy pools (token-swap v2) |
| m-dlmm | Meteora DLMM |
| m-damm | Meteora DAMM v1 |
| m-damm-v2 | Meteora DAMM v2 |
| m-dbc | Meteora Dynamic Bonding Curve |
| m-dbc-hook | Meteora DBC, Token-2022 transfer-hook mints |
| pump-curve | pump.fun bonding curve |
| pump-amm | PumpSwap |
| manifest | Manifest |
| pancakeswap-v3 | PancakeSwap v3 |
| byreal | Byreal CLMM |
errors
| http | code | message | what to do |
|---|---|---|---|
| 400 | -32602 | params accepts only … / params must carry … / … must be … | the four params plus optional dex, txVersion, swapTag, maxAccounts, and integrator_fee_bps with integrator_fee_account (or fee_bps with treasury); amount_in non-zero, base units; slippage_bps 0 to 5000; two different valid mints |
| 400 | -32602 | txVersion must be 0 or 1 | 0, 1 or omit |
| 400 | -32602 | swapTag must be 0 or 1 | 0, 1 or omit |
| 400 | -32602 | maxAccounts must be a whole number | 1 to 64, or omit |
| 400 | -32602 | integrator_fee_bps (a whole number 0 to 5000) and integrator_fee_account (a base58 32-byte pubkey) go together | send both, valid, or neither |
| 400 | -32602 | swapTag 1 carries no integrator fee | drop swapTag or the fee |
| 400 | -32602 | send integrator_fee_bps or fee_bps, not both / send integrator_fee_account or treasury, not both | send one name for each value |
| 400 | -32602 | dex must name venue families: … / dex must be a venue-family label … | a venue table label, or an array |
| 400 | -32602 | amount too small: the output rounds to nothing | error.data.code dust_amount or sell_below_one_atom: send amount_in of at least error.data.min_amount_in when given, or a clearly larger amount |
| 400 | -32602 | the quote upstream refused the request | error.data.code says why; bad_max_accounts: maxAccounts 1 to 64. Change the request before sending it again |
| 400 | -32052 | dex names a venue family the quote upstream does not have | family unavailable now: pin another or omit dex |
| 400 | -32600 | quote is not batchable | one quote per request |
| 401 | -32001 | unknown api key / api key is not enabled for quote | send the whole key; give it the QUOTE scope |
| 403 | -32050 | module not enabled for this account | the account needs the quote module |
| 429 | -32005 | rate limit exceeded / quote lane capacity exceeded / free quote plan at capacity / free tier limit for your network reached | already waited up to 1 s (rate) and 3 s (lane permit): retry after Retry-After; upgrade from free for your own budget |
| 200 | -32051 | no route | no path for this pair and size; error.data.message, when sent, gives the reason. error.data.why hook_launch_window: the transfer hook admits only allowlisted wallets, retry later; hook_market_closed: retry when its transfer schedule allows; hook_sells_only: routes only as the input; no_route_in_pinned_dex: drop the pin or pin others; dust_gate: every pool holds under 0.001 SOL on its SOL side (direct_why names the pool and reserve), stop until it refills |
| 200 | -32053 | sell exceeds what the curve can pay | input exceeds one pool's payout in any family, and the payable part (error.data.max_amount_in less 3%) failed too. max_out: the most it pays at max_amount_in. why partial_below_fee: that part pays less than the transaction costs, stop. max_amount_in 0: nothing pays, stop. No why: the part did not route or the bound moved; quote well under max_amount_in, or stop |
| 200 | -32054 | token has no live pool | stop until it lists again |
| 200 | -32055 | no route fits the account cap | the cap (maxAccounts, or 64 with swapTag 1) left no route: raise maxAccounts (at most 64), lower amount_in, or quote with neither |
| 503 | -32011 | quote upstream stale | price feed reloading: retry after Retry-After. error.data.why graduating: a migrated curve's new pool is not serving yet, retry after about 3 s |
| 503 | -32011 | quote upstream … | retry with backoff, after Retry-After when sent |
| 503 | -32057 | the upstream has the integrator fee switched off | retry later, or quote without the fee |
plans
| plan | price | quotes / account |
|---|---|---|
| FREE | $0 | 10 / s |
| STARTER | $7 | 50 / s |
| PRO | $28 | 150 / s |
| ELITE | $104 | 500 / s |
methods
quotereturns {srcAmountIn, destAmountOut, minAmountOut, slippageBps, swapMode, inputMint, outputMint, routePlan: [{hop, percent, swapInfo}], quoteId?, partial?, requestedAmountIn?, platformFee?, integratorFee?, txVersion?, swapTag?}