an unsigned transaction you sign and send through any RPC
Send a quoteId and the signing wallet; get one unsigned transaction. A v1 (quote asked txVersion: 1) puts the message before the signatures: sign it with a v1-capable SDK (web3.js 3.0, kit 8.4) and read it with getTransaction maxSupportedTransactionVersion 1. Send with sendTransaction (skipPreflight: true) on any RPC, then confirm with getTransaction.
# swap method: the unsigned transaction for a quoteId, which you sign and sendcurl https://services.carbium.sh \ -H 'content-type: application/json' -H 'x-api-key: <YOUR_KEY>' \ -d '{"jsonrpc":"2.0","id":1,"method":"swap","params":[{ "quote_id":"65a5c08fd08b79ea9ffd4290a229a5fb", "user_pubkey":"<YOUR_PUBKEY>", "compute_unit_price_micro_lamports":10000}]}'# -> {"jsonrpc":"2.0","result":{# "transaction":"AQAAAAAA...",# "blockhash":"81rLLeUpqEwSf2ULSrPDiUFjSVuvz15VcEChu56ieJD7","lastValidBlockHeight":432979660,# "minAmountOut":"109035778","computeUnitLimit":224249,"priorityFeeLamports":"2243",# "rentLamports":"1488440","ataCreates":1},"id":1}# after a reroute the result also carries "routeRerouted":{"why":"pool_state_missing","deadPool":"<pool>","quotedOut":"109583697","reroutedOut":"109401234","floor":"109035778"}# Sign it as user_pubkey, send it with sendTransaction (skipPreflight: true), confirm with getTransaction.
request and result
| field | type | meaning |
|---|---|---|
| params · positional [{...}] or by name | ||
| quote_id | 32 hex | quoteId from quote, within 30 s |
| user_pubkey | base58 | wallet that signs and pays |
| compute_unit_price_micro_lamports | 0 to 300000, optional | priority price per compute unit. Omitted: the 75th percentile of recent priority fees on the router's busiest pools, refreshed every 10 s, held within 10,000 to 300,000, 10,000 when the sample is over 60 s old. A value you pass always wins, 0 included |
| result | ||
| transaction | string | unsigned, base64: v0 with lookup tables by default, v1 without when the quote asked txVersion: 1 |
| txVersion | number; v1 only | 1 on a v1 build; absent on v0 |
| blockhash, lastValidBlockHeight | string, number | blockhash, and the height it expires at |
| minAmountOut | string | floor it enforces |
| computeUnitLimit, priorityFeeLamports | number, string | compute limit, and priority fee: limit × price (yours, or the network's) ÷ 1,000,000, rounded up on v0, down on v1 (which carries the fee in lamports) |
| rentLamports, ataCreates | string or null, number | max rent for the token accounts it creates (refundable on close), and their count |
| routeRerouted | object; after a reroute only | {why, deadPool, quotedOut, reroutedOut, floor}: why the refusal behind it (pool_state_missing, pool_keys_missing, fee_recipient_ata_missing, pcurve_graduated, transaction_too_large or accounts_over_cap); deadPool the pool held out for 30 s, absent when the route was too large or over the cap; quotedOut the quote's destAmountOut; reroutedOut the new expected out; floor equals minAmountOut. Amounts are strings |
| swapTag | number; tagged only | 1 when asked; absent otherwise. No plain form: -32093, error.data.code swap_tag_unroutable; pin dex, change the amount, or quote without swapTag |
refusals
| code | http | meaning |
|---|---|---|
| fix the request | ||
| -32602 | 400 | quote_id and user_pubkey required; compute_unit_price_micro_lamports a whole number 0 to 300000; nothing else is read |
| -32600 | 400 | quote is not batchable: one swap per request |
| quote again | ||
| -32095 | 400 | quote_id unknown or past 30 s |
| -32074 | 400 | route has a family the builder will not build: pin others with dex |
| -32081 … -32083, -32096 | 200 | route cannot be built now (pool not loaded, mint not resolvable, transaction too large, a leg that would fail on chain) |
| -32093 | 200 or 503 | builder refused, reason in error.data.code: at 200 quote again, at 503 retry |
| -32098 | 200 | hook admits only wallets holding its gate token; error.data: gate_mint, gate_min (base units), holding, gate_decimals |
| -32099 | 200 | builder cannot derive the route's hook account; final for this quote |
| -32055 | 200 | route over the quote's account cap, already re-routed once under it: quote again with a higher cap or a smaller amount_in |
| -32056 | 503 | builder refused the quote's account cap: quote again, never the same quote_id |
| retry later | ||
| -32011, -32060 … -32097 (the rest) | 503 | retry with backoff |
methods
swapreturns {transaction (unsigned, base64), blockhash, lastValidBlockHeight, minAmountOut, computeUnitLimit, priorityFeeLamports, rentLamports, ataCreates, txVersion?, routeRerouted?, swapTag?}