Skip to main content
GET
/
2
/
swap
/
quoting
Get swap quote with transaction details
curl --request GET \
  --url https://demo-api.mobula.io/api/2/swap/quoting
{
  "data": {
    "requestId": "<string>",
    "solana": {
      "transaction": {
        "serialized": "AQABAuObQ8Adqk1eqZxRMJg4r6vGtXq9k0...base64...",
        "variant": "versioned"
      },
      "lastValidBlockHeight": 269450123
    },
    "amountOutTokens": "245.123",
    "slippagePercentage": 1,
    "amountInUSD": 200.45,
    "amountOutUSD": 199.87,
    "marketImpactPercentage": 0.04,
    "poolFeesPercentage": 0.25,
    "tokenIn": {
      "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "decimals": 6,
      "name": "USD Coin",
      "symbol": "USDC",
      "logo": "https://metadata.mobula.io/assets/logos/evm_8453_0x8335…"
    },
    "tokenOut": {
      "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
      "decimals": 6,
      "name": "USD Coin",
      "symbol": "USDC",
      "logo": "https://metadata.mobula.io/assets/logos/evm_8453_0x8335…"
    },
    "details": {
      "route": {
        "hops": [
          {
            "poolAddress": "<string>",
            "tokenIn": {
              "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
              "decimals": 6,
              "name": "USD Coin",
              "symbol": "USDC",
              "logo": "https://metadata.mobula.io/assets/logos/evm_8453_0x8335…"
            },
            "tokenOut": {
              "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
              "decimals": 6,
              "name": "USD Coin",
              "symbol": "USDC",
              "logo": "https://metadata.mobula.io/assets/logos/evm_8453_0x8335…"
            },
            "amountInTokens": "1.0",
            "amountOutTokens": "245.1",
            "exchange": "Raydium",
            "poolType": "CLMM",
            "feePercentage": 0.25,
            "feeBps": 25
          }
        ],
        "totalFeePercentage": 0.25,
        "aggregator": "jupiter"
      },
      "aggregator": "<string>",
      "raw": {}
    },
    "fee": {
      "amount": "0.001",
      "percentage": 0.5,
      "wallet": "0xCALLER…",
      "deductedFrom": "input"
    },
    "evm": null,
    "ton": null
  },
  "error": "<string>"
}

Documentation Index

Fetch the complete documentation index at: https://docs.mobula.io/llms.txt

Use this file to discover all available pages before exploring further.

GET /api/2/swap/quoting returns the cheapest route for a token-in → token-out trade plus the calldata to execute it. Same envelope across chains; per-chain extension under data.evm / data.solana / data.ton.

EVM

Ethereum, Base, Arbitrum, BNB Chain, Polygon + 25 chains

Solana

Jupiter, Raydium, Orca, Meteora, Pump.fun + multi-lander

TON

Stonfi v2, DeDust v2, pTON v2 — multi-message envelope

Arguments

Required

ParamTypeDescription
chainIdstringevm:<N> (e.g. evm:8453), solana:solana, or ton:mainnet
tokenInstringSell token address. Native sentinel varies per chain (see below).
tokenOutstringBuy token address
amount or amountRawstringEither the human amount ("1.5") or the raw amount ("1500000"). Exactly one.
walletAddressstringThe user’s address (used as recipient + fee context)

Common optional

ParamTypeDefaultDescription
slippagestring %10-100
feePercentagestring %Caller referral fee 0-99% (Mobula skims 20% off the top)
feeWalletstringRequired when feePercentage > 0
minFeesNativestringMinimum caller referral fee in the chain’s native token. Currently honored on TON native-input swaps.
excludedProtocolscsv stringDEX-level deny list (e.g. pump-amm,raydium)
onlyProtocolscsv stringDEX-level allow list
onlyRouterscsv stringAggregator filter — jupiter, kyberswap, lifi, naos
poolAddressstringPin routing to a single pool

Solana-only

ParamDescription
priorityFeeauto / low / medium / high / veryHigh / microLamports number
computeUnitLimittrue (dynamic) or fixed CU (default 400 000)
jitoTipLamportsAdds a Jito tip transfer for fast landing
multiLandertrue returns N candidates over a durable nonce
landerTipLamportsPer-lander tip when multiLander=true
payerAddressFee abstraction — separate fee payer from walletAddress

Native sentinel addresses

ChainSentinel
EVM0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
SolanaSo11111111111111111111111111111111111111112
TONEQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c

Response

{
  "data": {
    "amountOutTokens": "245.123",
    "amountInUSD": 200.45,
    "amountOutUSD": 199.87,
    "slippagePercentage": 1,
    "marketImpactPercentage": 0.04,
    "poolFeesPercentage": 0.25,
    "tokenIn":  { "address": "…", "symbol": "…", "decimals": 9, "logo": "…" },
    "tokenOut": { "address": "…", "symbol": "…", "decimals": 6, "logo": "…" },
    "requestId": "f8b2…",
    "details": {
      "route": {
        "hops": [
          { "poolAddress": "…", "tokenIn": { /* … */ }, "tokenOut": { /* … */ }, "amountInTokens": "1.0", "amountOutTokens": "245.1", "exchange": "Raydium", "poolType": "CLMM", "feeBps": 25 }
        ],
        "totalFeePercentage": 0.25,
        "aggregator": "jupiter"
      }
    },
    "fee": { "amount": "0.001", "percentage": 0.5, "wallet": "…", "deductedFrom": "input" },
    "evm":    null,
    "solana": { /* … */ },
    "ton":    null
  }
}
Exactly one of evm / solana / ton is populated, the others are null. See the per-chain pages above for the calldata shape.

Common fields (every chain)

FieldTypeDescription
amountOutTokensstringEstimated output, human-readable
amountInUSD / amountOutUSDnumberUSD value at quote time
slippagePercentagenumberEcho of the input parameter
marketImpactPercentagenumberEstimated price impact at this trade size
poolFeesPercentagenumberSum of LP fees paid across the route
tokenIn / tokenOutobject{address, symbol?, name?, decimals, logo?}
requestIdstringUnique per quote — pass to support / analytics
details.route.hops[]arrayOne entry per pool used (multi-hop)
details.route.aggregatorstringWhich aggregator picked the route
feeobject?Echoed when feePercentage was set: {amount, percentage, wallet, deductedFrom: 'input'|'output'}

Chain-specific calldata

The data.evm, data.solana, data.ton blocks carry the chain-specific transaction shape:
ChainBlockShape
EVMdata.evm.transaction{ to, from, data, value, gasLimit?, chainId, approvalAddress?, approvals[]? } — see EVM Quoting
Solanadata.solana.transaction + lastValidBlockHeight{ serialized: base64, variant: 'versioned' | 'legacy' } — see Solana Quoting
TONdata.ton.transactions[1..4] + data.ton.fees{ to, value, body, bounce, stateInit? }[] — see TON Quoting
When multiLander=true (Solana only), data.candidates[] replaces data.solana.transaction — see the Solana page.

Quick example

const r = await fetch(
  `https://api.mobula.io/api/2/swap/quoting?` + new URLSearchParams({
    chainId: 'evm:8453',
    tokenIn:  '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
    tokenOut: '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913',
    amount:   '0.1',
    walletAddress: '0xUSER…',
    slippage: '1',
  }),
  { headers: { Authorization: 'Bearer YOUR_API_KEY' } },
);
const quote = await r.json();
Sign + broadcast via the /swap/send endpoint, or — for EVM — directly from your wallet.

Errors

200 with data: null, error: "<message>" for routing failures (no route, slippage too tight, …). 4xx for validation, 5xx for upstream RPC issues. The requestId field always survives — include it when reporting issues.

Query Parameters

chainId
string

Mobula chain id. EVM: evm:<integer> (e.g. evm:1, evm:8453, evm:42161). Solana: solana:solana. TON: ton:mainnet or ton:testnet.

tokenIn
string
required

Sell token address. Native sentinels — EVM: 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE (EIP-7528). Solana: So11111111111111111111111111111111111111112 (wSOL). TON: EQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAM9c.

Minimum string length: 1
tokenOut
string
required

Buy token address. Same sentinel rules as tokenIn.

Minimum string length: 1
amount
string

Human-readable amount (e.g. "1.5" for 1.5 tokens). Converted server-side: raw = amount × 10^decimals. Mutually exclusive with amountRaw.

amountRaw
string

Raw amount as a digit-only string (e.g. "1500000" for 1.5 USDC at 6 decimals). Use this when you already have the bigint to avoid float precision loss. Mutually exclusive with amount.

slippage
string

Slippage tolerance in % (0-100, default 1). Quote rejects if expected output drops below this threshold.

walletAddress
string
required

User wallet address — recipient of tokenOut, signer for the broadcast tx, fee context.

Minimum string length: 1
excludedProtocols

DEX-level deny list (CSV). Example: pump-amm,raydium.

onlyProtocols

DEX-level allow list (CSV). Example: uniswap-v3,uniswap-v4.

poolAddress
string

Pin routing to a single pool (e.g. when you want a specific Uniswap V3 fee tier).

onlyRouters
string

Aggregator filter (CSV) — jupiter, kyberswap, lifi, naos. Omit to let the API pick.

priorityFee
string

Solana only. auto, low, medium, high, veryHigh, or microLamports per CU as a number string.

computeUnitLimit
string

Solana only. true for dynamic CU limit, or a fixed integer (default 400 000).

jitoTipLamports
string

Solana only. Jito tip in lamports — adds a transfer to one of the Jito tip accounts for fast landing.

feePercentage

Caller referral fee in % (0-99). Mobula skims a 20% platform cut off the top. Requires feeWallet.

feeWallet
string

Wallet that receives the caller referral fee. Required when feePercentage > 0.

minFeesNative

Minimum caller referral fee in native-token units. Currently honored on TON native-input swaps; requires feeWallet.

payerAddress
string

Solana only. Fee abstraction — wallet that signs/pays for the tx (separate from walletAddress).

multiLander
string

Solana only. true returns N candidate transactions over a durable nonce — race them across landers (Jito, Nozomi, 0slot). Only one commits.

landerTipLamports
string

Per-lander tip when multiLander=true. Defaults to each lander's minimum.

Response

Swap quoting response

data
object
required
error
string

Set on routing failures (no route, slippage too tight, upstream timeout). The data block still carries requestId for support.