Carbium /api and rpc reference

Quote and execute Solana token swaps, stream accounts over WebSocket/gRPC, and hit the RPC with a live try-it on every endpoint.

Live
Endpoints 10 total · 2 API · 4 RPC · 4 discontinued
Access & auth

Authenticate every request with your key in the X-API-KEY header. The API and the RPC use separate keys paste each below to drive the try it panels.

Quote and execute Solana swaps. The /quote endpoint routes across multiple AMM families and returns a signed ready transaction in a single call. Quote, route, and (optionally) fee collection happen in one step. Include user_account to get a built txn ready to sign and submit.

Integrator fee

Pass treasury and fee_bps on /quote. The returned transaction collects the fee atomically inside the swap instruction. One tx, one signature, no client side bundling.

  • Fee is computed on the gross output (post-swap, pre delivery) and rounded down.
  • Range 0 to 500 bps, enforced both server side and onchain via MAX_FEE_BPS.
  • SPL output: fee paid in the destination mint to ATA(treasury, dst_mint). The API auto-prepends a create_idempotent_ata the first time a treasury is seen for a mint (user pays ~0.002 SOL rent, one-time).
  • SOL output: fee paid as wrapped SOL via the same idempotent pattern. The treasury can unwrap by closing the ATA.
  • Slippage stays on the gross output, and the fee is deterministic on top.

Verify after landing

  • Treasury ATA balance increases by floor(quoted_out * fee_bps / 10000).
  • User destination balance increases by delivered_out minus expected_fee.
  • Program log contains carbium fee: <bps> bps to treasury.
GET /quote

New improved quote endpoint. Returns a detailed quote and transaction package for performing a token swap. The response includes calculated output amounts, slippage, routing plan and a serialized transaction ready to be submitted to the blockchain.

Base URL · https://api.carbium.io/api/v2

Query parameters

Name Type Req Description
src_mint string REQUIRED Input token address · default So11111111111111111111111111111111111111112
dst_mint string REQUIRED Output token address · default AT79ReYU9XtHUTF5vM6Q4oa9K8w7918Fp5SU7G1MDMQY
amount_in integer REQUIRED Input amount (in smallest units / lamports) · default 1000000000
slippage_bps integer REQUIRED Slippage tolerance (in basis points, e.g. 50 = 0.5%) · default 50
user_account string OPTIONAL User wallet address (if included, the response returns a base64 txn)
treasury string OPTIONAL Treasury address for fee collection
fee_bps integer OPTIONAL Fee in basis points (e.g. 30 = 0.3%)

Try it

no key You can test without an API key. If you prefer, use your own key.

Request

ready

Response

awaiting request
// Hit Send to see live output
curl --request GET \
  --url 'https://api.carbium.io/api/v2/quote?src_mint=So11111111111111111111111111111111111111112&dst_mint=AT79ReYU9XtHUTF5vM6Q4oa9K8w7918Fp5SU7G1MDMQY&amount_in=1000000000&slippage_bps=50' \
  --header 'X-API-KEY: <your-api-key>'

Response shape

{
  "success": true,
  "data": {
    "amount_out": "...",
    "slippage_bps": 50,
    "route": [ ... ],
    "transaction": "<base64-encoded-transaction>"
  }
}
GET /quote-usd

Returns the USD value of the source and destination amounts for a swap. Internally reuses the v2 /quote and CQ1 rates to derive prices.

Base URL · https://api.carbium.io/api/v2

Query parameters

Name Type Req Description
src_mint string REQUIRED Source token mint address · default So11111111111111111111111111111111111111112
dst_mint string REQUIRED Destination token mint address · default EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
amount_in integer REQUIRED Input amount (in smallest units / lamports) · default 1000000000
slippage_bps integer REQUIRED Slippage tolerance (in basis points, e.g. 50 = 0.5%) · default 50
user_account string OPTIONAL User wallet address

Try it

no key You can test without an API key. If you prefer, use your own key.

Request

ready

Response

awaiting request
// Hit Send to see live output
curl --request GET \
  --url 'https://api.carbium.io/api/v2/quote-usd?src_mint=So11111111111111111111111111111111111111112&dst_mint=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v&amount_in=1000000000&slippage_bps=50' \
  --header 'X-API-KEY: <your-api-key>'

Response shape

{
  "srcAmountUsd": 84.12,
  "dstAmountUsd": 83.97
}

Low level Solana access. Standard JSON-RPC, real time streams over WebSocket, and gRPC (Yellowstone) for high throughput subscriptions, all behind a separate RPC key (not the API key).

What's here

  • RPC: standard Solana JSON-RPC (getSlot, getBalance, getAccountInfo, …) over an HTTPS POST.
  • WSS: subscribe to account and transaction changes in real time (accountSubscribe, transactionSubscribe). The socket stays open and pushes notifications.
  • gRPC / HTTPS-gRPC: Yellowstone Geyser streams for the lowest latency and highest throughput.

Notes

  • Use your RPC key, not the API key.
  • WebSocket and gRPC keep a long lived connection. Reconnect on close and resubscribe.
  • gRPC isn't callable from a browser. Use grpcurl or a native client (Rust / Go).
WSS wss

Subscribe in real time to a Solana account's changes over WebSocket. Connect and send the accountSubscribe message; you'll receive an accountNotification on each change.

Base URL · wss://wss-rpc.carbium.io/?apiKey=

Try it

Request

ready

Response

awaiting request
// Hit Send to see live output
wscat -c wss://wss-rpc.carbium.io/?apiKey=
# luego envía:
> {"jsonrpc":"2.0","id":1,"method":"accountSubscribe","params":["So11111111111111111111111111111111111111112",{"encoding":"jsonParsed","commitment":"confirmed"}]}

Response shape

{"jsonrpc":"2.0","method":"accountNotification","params":{"subscription":1,"result":{"context":{"slot":12345678},"value":{"lamports":1000000000}}}}
gRPC grpc

gRPC stream (Yellowstone Geyser) of Solana accounts and transactions. Not testable from the browser: copy the grpcurl command and run it in your terminal.

Base URL · grpc.carbium.io/?apiKey=0197123c-801c

How to test gRPC from your terminal

gRPC streams over HTTP/2 and a binary protocol, so a browser tab can't open them — but it takes one command from your machine:

  1. Install grpcurl (or use a native client in Rust, Go or Node).
  2. Copy the grpcurl snippet below and pass your RPC key in the x-token metadata.
  3. Point it at the server above and stream with the Yellowstone Subscribe method.

Read the gRPC / HTTP2 streaming guide ↗

# gRPC — no testeable desde el navegador
grpcurl -d '{}' \
  grpc.carbium.io/?apiKey=0197123c-801c \
  geyser.Geyser/Subscribe

Response shape

{"filters":["accounts"],"account":{"pubkey":"...","lamports":"1000000000","owner":"..."}}
HTTPS/2 https - grpc dev

gRPC over HTTP/2 (same Yellowstone service). Not testable from the browser: use grpcurl with your .proto.

Base URL · https://dev-grpc.carbium.io

How to test HTTPS/2 from your terminal

gRPC streams over HTTP/2 and a binary protocol, so a browser tab can't open them — but it takes one command from your machine:

  1. Install grpcurl (or use a native client in Rust, Go or Node).
  2. Copy the grpcurl snippet below and pass your RPC key in the x-token metadata.
  3. Point it at the server above and stream with the Yellowstone Subscribe method.

Read the gRPC / HTTP2 streaming guide ↗

# HTTP/2 gRPC — no testeable desde el navegador
grpcurl -d '{}' \
  dev-grpc.carbium.io \
  geyser.Geyser/Subscribe

Response shape

{"filters":["transactions"],"transaction":{"signature":"...","slot":"12345678"}}
RPC json-rpc

Solana JSON-RPC via Carbium RPC. The tester sends a live POST with the body below.

Base URL · https://rpc-service.carbium.io/?apiKey=

Try it

Request

ready

Response

awaiting request
// Hit Send to see live output
curl --request POST \
  --url 'https://rpc-service.carbium.io/?apiKey=' \
  --header 'Content-Type: application/json' \
  --data '{"jsonrpc":"2.0","id":1,"method":"getSlot"}'

Response shape

{"jsonrpc":"2.0","result":12345678,"id":1}
We got more! Check it out

The full Carbium documentation | guides for the Swap API, RPC, Data and the wider stack. Browse by topic below open any page for the complete walkthrough.

Overview 11
DEVELOPMENT 25
Carbium API 16
Carbium DEX 8
Carbium RPC 17
Carbium Data 7
SPDR 8