Discontinued (v1)
Older v1 Swap API endpoints, kept for reference. Prefer the current API on the reference page.
Authenticate every request with your API key in the X-API-KEY header. Paste it below to drive the try
it panels.
Returns the quote of all providers for the given details.
Base URL · https://api.carbium.io/api/v1
Query parameters
| Name | Type | Req | Description |
|---|---|---|---|
| fromMint | string | REQUIRED | Address of the token that is used to buy the other token
· default So11111111111111111111111111111111111111112 |
| toMint | string | REQUIRED | Receiving address of token
· default AT79ReYU9XtHUTF5vM6Q4oa9K8w7918Fp5SU7G1MDMQY |
| amount | integer | REQUIRED | Swap amount (in lamports)
· default 100000000 |
| slippage | integer | REQUIRED | Slippage value (in BPS)
· default 100 |
Try it
Request
Response
curl --request GET \
--url 'https://api.carbium.io/api/v1/quote/all?fromMint=So11111111111111111111111111111111111111112&toMint=AT79ReYU9XtHUTF5vM6Q4oa9K8w7918Fp5SU7G1MDMQY&amount=100000000&slippage=100' \
--header 'X-API-KEY: <your-api-key>'const res = await fetch("https://api.carbium.io/api/v1/quote/all?fromMint=So11111111111111111111111111111111111111112&toMint=AT79ReYU9XtHUTF5vM6Q4oa9K8w7918Fp5SU7G1MDMQY&amount=100000000&slippage=100", {
headers: { "X-API-KEY": "<your-api-key>" },
});
console.log(await res.json());import requests
res = requests.get(
"https://api.carbium.io/api/v1/quote/all",
params={"fromMint": "So11111111111111111111111111111111111111112", "toMint": "AT79ReYU9XtHUTF5vM6Q4oa9K8w7918Fp5SU7G1MDMQY", "amount": "100000000", "slippage": "100"},
headers={"X-API-KEY": "<your-api-key>"},
)
print(res.json()) Response shape
{
"success": true,
"data": "<base64-encoded-transaction>"
} Returns a base64-encoded string representing the transaction which has an instruction for the fee amount.
Base URL · https://api.carbium.io/api/v1
Query parameters
| Name | Type | Req | Description |
|---|---|---|---|
| payer | string | REQUIRED | Address of the payer |
| receiver | string | REQUIRED | Address of the receiver |
| lamports | integer | REQUIRED | Fee amount in lamports |
Try it
Request
Response
curl --request GET \
--url 'https://api.carbium.io/api/v1/fee/custom?payer=%3Cpayer%3E&receiver=%3Creceiver%3E&lamports=%3Clamports%3E' \
--header 'X-API-KEY: <your-api-key>'const res = await fetch("https://api.carbium.io/api/v1/fee/custom?payer=%3Cpayer%3E&receiver=%3Creceiver%3E&lamports=%3Clamports%3E", {
headers: { "X-API-KEY": "<your-api-key>" },
});
console.log(await res.json());import requests
res = requests.get(
"https://api.carbium.io/api/v1/fee/custom",
params={"payer": "<payer>", "receiver": "<receiver>", "lamports": "<lamports>"},
headers={"X-API-KEY": "<your-api-key>"},
)
print(res.json()) Response shape
{
"success": true,
"data": "<base64-encoded-transaction>"
} Returns the bundle id and transaction hash for the provided signed transaction.
Base URL · https://api.carbium.io/api/v1
Query parameters
| Name | Type | Req | Description |
|---|---|---|---|
| signedTransaction | string | REQUIRED | Base64 encoded signed transaction |
Try it
Request
Response
curl --request GET \
--url 'https://api.carbium.io/api/v1/swap/bundle?signedTransaction=%3CsignedTransaction%3E' \
--header 'X-API-KEY: <your-api-key>'const res = await fetch("https://api.carbium.io/api/v1/swap/bundle?signedTransaction=%3CsignedTransaction%3E", {
headers: { "X-API-KEY": "<your-api-key>" },
});
console.log(await res.json());import requests
res = requests.get(
"https://api.carbium.io/api/v1/swap/bundle",
params={"signedTransaction": "<signedTransaction>"},
headers={"X-API-KEY": "<your-api-key>"},
)
print(res.json()) Response shape
{
"success": true,
"data": {
"bundleId": "...",
"txHash": "..."
}
} Returns a base64-encoded string representing the transaction that can be submitted to the Solana blockchain to perform the token swap.
Base URL · https://api.carbium.io/api/v1
Query parameters
| Name | Type | Req | Description |
|---|---|---|---|
| owner | string | REQUIRED | Wallet address of the user. |
| fromMint | string | REQUIRED | Address of the token that is used to buy the other token
· default So11111111111111111111111111111111111111112 |
| toMint | string | REQUIRED | Receiving address of token
· default AT79ReYU9XtHUTF5vM6Q4oa9K8w7918Fp5SU7G1MDMQY |
| amount | integer | REQUIRED | Swap amount (in lamports)
· default 100000000 |
| slippage | integer | REQUIRED | Slippage value (in BPS)
· default 100 |
| provider | string | REQUIRED | Liquidity provider / DEX to route through
· default raydium |
| pool | string | OPTIONAL | Custom pool address for swapping. |
| feeLamports | integer | OPTIONAL | Fee amount for custom fee instruction (in lamports) |
| feeReceiver | string | OPTIONAL | Account which receives the custom fee (required if feeLamports is provided) |
| priorityMicroLamports | integer | OPTIONAL | Transaction compute unit price used for prioritization fees |
| mevSafe | boolean | OPTIONAL | If true, the swap transaction will include an instruction for a jito tip |
| gasless | boolean | OPTIONAL | If true, the swap transaction will be gasless (only valid if output token is SOL) |
Try it
Request
Response
curl --request GET \
--url 'https://api.carbium.io/api/v1/swap?owner=%3Cowner%3E&fromMint=So11111111111111111111111111111111111111112&toMint=AT79ReYU9XtHUTF5vM6Q4oa9K8w7918Fp5SU7G1MDMQY&amount=100000000&slippage=100&provider=raydium' \
--header 'X-API-KEY: <your-api-key>'const res = await fetch("https://api.carbium.io/api/v1/swap?owner=%3Cowner%3E&fromMint=So11111111111111111111111111111111111111112&toMint=AT79ReYU9XtHUTF5vM6Q4oa9K8w7918Fp5SU7G1MDMQY&amount=100000000&slippage=100&provider=raydium", {
headers: { "X-API-KEY": "<your-api-key>" },
});
console.log(await res.json());import requests
res = requests.get(
"https://api.carbium.io/api/v1/swap",
params={"owner": "<owner>", "fromMint": "So11111111111111111111111111111111111111112", "toMint": "AT79ReYU9XtHUTF5vM6Q4oa9K8w7918Fp5SU7G1MDMQY", "amount": "100000000", "slippage": "100", "provider": "raydium"},
headers={"X-API-KEY": "<your-api-key>"},
)
print(res.json()) Response shape
{
"success": true,
"data": "<base64-encoded-transaction>"
}