Carbium API

Q1

Use Carbium Q1 to request live Solana swap quotes and, when needed, an executable transaction payload from the current /api/v2/quote flow.

Use Q1 when you need Carbium's current executable quote flow, not the older v1 quote and swap request family.

Q1 is the documented GET /api/v2/quote surface for:

  • live route and output calculation
  • route-plan inspection before signing
  • an executable txn payload when user_account is included

Part of the Carbium Solana infrastructure stack.


What this page owns

This page owns the current v2 quote flow only:

Surface What it does
GET https://api.carbium.io/api/v2/quote Returns quote data for a swap request and can include a base64 transaction payload

Use other pages when the question changes:

If you are maintaining the older parameter family with fromMint, toMint, and amount, stay on the older v1 reference pages instead of mixing request styles.


Request shape

Method: GET

URL:

https://api.carbium.io/api/v2/quote

Header:

X-API-KEY: YOUR_API_KEY
Parameter Required Meaning
src_mint Yes Input token mint
dst_mint Yes Output token mint
amount_in Yes Raw input amount in smallest units
slippage_bps Yes Slippage tolerance in basis points
user_account No Wallet address for an executable transaction response

๐Ÿ“˜ Q1 uses src_mint, dst_mint, amount_in, and slippage_bps. Do not mix these with fromMint, toMint, amount, or slippage from the older v1 surfaces.


Minimal quote request

Use this when you only need pricing and route data:

curl --request GET \
  --url 'https://api.carbium.io/api/v2/quote?src_mint=So11111111111111111111111111111111111111112&dst_mint=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&amount_in=1000000&slippage_bps=50' \
  --header 'X-API-KEY: YOUR_API_KEY'

Use this when you need an executable transaction back:

curl --request GET \
  --url 'https://api.carbium.io/api/v2/quote?src_mint=So11111111111111111111111111111111111111112&dst_mint=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&amount_in=1000000&slippage_bps=50&user_account=YOUR_WALLET' \
  --header 'X-API-KEY: YOUR_API_KEY'

The important difference is user_account:

  • without it, Q1 can behave like a quote-only surface
  • with it, the response can include txn, a base64-encoded transaction payload ready for deserialization and signing

Response fields that matter

Typical Q1 responses include fields like these:

Field Why it matters
srcAmountIn Confirms the raw input amount used for routing
destAmountOut Expected output amount
destAmountOutMin Minimum output after slippage
priceImpactPct Quick price-impact sanity check
routePlan Route composition before signing
txn Base64 transaction payload when user_account is present

Example response shape:

{
  "srcAmountIn": "1000000",
  "destAmountOut": "1257091",
  "destAmountOutMin": "1257091",
  "slippage": "50",
  "priceImpactPct": "0",
  "routePlan": [
    {
      "swap": "Raydium",
      "percent": 100
    }
  ],
  "txn": "AQAAAA..."
}

Treat txn as the handoff into your signing and submission flow, not as proof that the swap already landed on-chain.


Typical integration flow

Use this order for most new integrations:

  1. request a quote from Q1
  2. inspect output amount, minimum amount, and route plan
  3. include user_account when you need an executable transaction
  4. deserialize and sign the returned txn
  5. submit and confirm through Carbium RPC
const url = new URL("https://api.carbium.io/api/v2/quote");
url.searchParams.set("src_mint", inputMint);
url.searchParams.set("dst_mint", outputMint);
url.searchParams.set("amount_in", amountIn);
url.searchParams.set("slippage_bps", "50");
url.searchParams.set("user_account", wallet.publicKey.toBase58());

const quote = await fetch(url, {
  headers: { "X-API-KEY": process.env.CARBIUM_API_KEY! },
}).then((r) => r.json());

if (!quote.txn) {
  throw new Error("Missing executable transaction in Q1 response");
}

This page stops at the quote-build boundary. Move to Executing Swaps for the signing and RPC submission stage.


Validation checklist before production

  • send X-API-KEY on every request
  • use src_mint, dst_mint, amount_in, and slippage_bps together
  • send amounts in smallest units
  • require user_account if your integration expects txn
  • fail fast if the quote returns no route or no executable payload

๐Ÿ”ถ Use Q1 for the current executable quote flow, then move into Executing Swaps once the quote response looks correct. For platform setup and product access, start at carbium.io.