Skip to main content
POST
/
2
/
swap
/
send
Send a swap transaction
curl --request POST \
  --url https://demo-api.mobula.io/api/2/swap/send \
  --header 'Content-Type: application/json' \
  --data '
{
  "chainId": "<string>",
  "signedTransaction": "<string>",
  "candidates": [
    {
      "lander": "<string>",
      "signedTransaction": "<string>"
    }
  ],
  "awaitLanding": true
}
'
{
  "data": {
    "success": true,
    "requestId": "<string>",
    "transactionHash": "<string>",
    "lander": "<string>",
    "landingTimeMs": 123,
    "status": "broadcasted",
    "onchainLandingTimeMs": 123,
    "swap": {
      "tokenIn": {
        "address": "<string>",
        "amount": "<string>"
      },
      "tokenOut": {
        "address": "<string>",
        "amount": "<string>"
      }
    }
  },
  "error": "<string>"
}

Overview

The Swap Send endpoint allows you to broadcast a signed transaction to the blockchain network. This endpoint should be used after obtaining a quote from the Swap Quoting endpoint and signing the transaction with your wallet.
Private Beta Access OnlyThis endpoint is not yet available to the general public. Please contact the Mobula team to request access.

Request Body

The request body must be a JSON object with the following fields:

Single Mode

  • chainId (required) — The blockchain identifier. Examples: solana:solana, evm:1 (Ethereum), evm:42161 (Arbitrum), evm:8453 (Base), evm:137 (Polygon), evm:56 (BNB Chain)
  • signedTransaction (required) — Base64-encoded signed transaction bytes
  • awaitLanding (optional, boolean) — When true, the endpoint blocks until the transaction is confirmed on-chain and returns detailed confirmation data including landing time and swap amounts. Default: false

Batch Mode (Solana MEV)

  • chainId (required) — The blockchain identifier
  • candidates (required) — Array of candidate transactions targeting different block engines (landers)
    • lander (string) — Lander identifier (e.g. jito, nozomi, zeroslot)
    • signedTransaction (string) — Base64-encoded signed transaction
  • awaitLanding (optional, boolean) — Same as single mode

Usage Examples

Fire-and-Forget (Default)

curl -X POST "https://api.mobula.io/api/2/swap/send" \
  -H "Content-Type: application/json" \
  -d '{
    "chainId": "solana:solana",
    "signedTransaction": "<base64-signed-tx>"
  }'

Await Landing (Solana)

curl -X POST "https://api.mobula.io/api/2/swap/send" \
  -H "Content-Type: application/json" \
  -d '{
    "chainId": "solana:solana",
    "signedTransaction": "<base64-signed-tx>",
    "awaitLanding": true
  }'

Await Landing (EVM)

curl -X POST "https://api.mobula.io/api/2/swap/send" \
  -H "Content-Type: application/json" \
  -d '{
    "chainId": "evm:42161",
    "signedTransaction": "<base64-signed-tx>",
    "awaitLanding": true
  }'

Batch Mode (Solana MEV)

curl -X POST "https://api.mobula.io/api/2/swap/send" \
  -H "Content-Type: application/json" \
  -d '{
    "chainId": "solana:solana",
    "candidates": [
      { "lander": "jito", "signedTransaction": "<base64-jito-tx>" },
      { "lander": "nozomi", "signedTransaction": "<base64-nozomi-tx>" }
    ],
    "awaitLanding": true
  }'

Response Format

Response Fields

Data Object

  • success (boolean) — Whether the transaction was successfully broadcast
  • transactionHash (string, optional) — Transaction hash/signature on the blockchain
  • requestId (string) — Unique identifier for the request
  • status (string, optional) — Landing status, present when awaitLanding is used:
    • broadcasted — Transaction sent to the network (default when awaitLanding is false)
    • processed — Transaction processed by a Solana validator (fast, ~500ms, not yet confirmed by supermajority)
    • confirmed — Transaction fully confirmed on-chain (EVM receipt or Solana RPC fallback)
    • failed — Transaction landed on-chain but reverted/failed
    • timeout — Confirmation not received within the timeout period (30s Solana, 60s EVM)
  • onchainLandingTimeMs (number, optional) — Time in milliseconds from broadcast to on-chain confirmation
  • lander (string, optional) — Which block engine landed the transaction (batch mode only, e.g. jito, nozomi)
  • landingTimeMs (number, optional) — Time in milliseconds from send to first RPC acceptance
  • swap (object, optional) — Parsed swap data from the confirmed transaction (Solana only):
    • tokenIn{ address: string, amount: string } — Token sent
    • tokenOut{ address: string, amount: string } — Token received

Error Field

  • error (string, optional) — Error message if the transaction failed

Example Responses

Broadcasted (fire-and-forget)

{
  "data": {
    "success": true,
    "transactionHash": "5VERv8NMvzbJMEkV8xnrLkEaWRtSz9CosKDYjCJjBRnbJLgp8uirBgmQpjKhoR4tjF3ZpRzrFmBV6UjKdiSZkQUW",
    "requestId": "550e8400-e29b-41d4-a716-446655440000",
    "status": "broadcasted"
  }
}

Processed (Solana with awaitLanding)

{
  "data": {
    "success": true,
    "transactionHash": "563cifbEg4NXUmChZ8mPmXWcHYsSCQFE3nCZPuH8DPjT6TD8z425qoJvuyTwrEUAEveYqMnkZEaGnnLxELe2paGu",
    "requestId": "a0f6d6ad-8b1a-4156-8efa-5ec634cc83e5",
    "status": "processed",
    "onchainLandingTimeMs": 535,
    "swap": {
      "tokenIn": {
        "address": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",
        "amount": "100000"
      },
      "tokenOut": {
        "address": "So11111111111111111111111111111111111111112",
        "amount": "1116467"
      }
    }
  }
}

Confirmed (EVM with awaitLanding)

{
  "data": {
    "success": true,
    "transactionHash": "0xb1c87a9045eeed21b63071f31b3ec3e51543aac6b1ca823e2d984d717c27db96",
    "requestId": "8ab08aeb-ddb6-4fd8-aa0f-4fa7bd5b24c7",
    "status": "confirmed",
    "onchainLandingTimeMs": 1518
  }
}

Failed On-Chain

{
  "data": {
    "success": false,
    "transactionHash": "0x...",
    "requestId": "770e8400-e29b-41d4-a716-446655440002",
    "status": "failed",
    "onchainLandingTimeMs": 2100
  },
  "error": "Transaction failed on-chain"
}

Broadcast Error

{
  "data": {
    "success": false,
    "requestId": "880e8400-e29b-41d4-a716-446655440003",
    "status": "broadcasted"
  },
  "error": "Transaction simulation failed: insufficient funds"
}

Transaction Flow

  1. Get Quote: Call the Swap Quoting endpoint to get a serialized transaction
  2. Sign Transaction: Use your wallet to sign the transaction
    • For Solana: Use @solana/web3.js to deserialize, sign, and re-serialize
    • For EVM: Use viem, ethers.js, or web3.js to sign with gas estimation
  3. Encode to Base64: Convert the signed transaction bytes to base64
  4. Broadcast: Send the encoded transaction using this endpoint
  5. Track: Either use awaitLanding: true to get immediate confirmation, or track using the returned transaction hash on blockchain explorers

Status Semantics

StatusMeaningReliability
broadcastedTransaction sent, confirmation unknownPending
processedSolana: processed by leader validator~99.99% reliable
confirmedFully confirmed on-chain100% reliable
failedConfirmed as failed/revertedDefinitive
timeoutNo confirmation within timeoutUnknown

Important Notes

  • awaitLanding latency: Solana ~500ms (PROCESSED), EVM ~1-3s depending on chain block time
  • Timeouts: Solana gRPC timeout is 30s with RPC fallback, EVM polling timeout is 60s
  • Transaction Validity: Transactions may expire if not sent within a certain timeframe
  • Slippage: If market conditions change significantly, the transaction may fail
  • Batch Mode: Only supported for Solana. All candidates share a durable nonce so only one can land

Error Handling

Common error scenarios:
  • Insufficient Funds: Wallet doesn’t have enough balance to cover the swap + fees
  • Slippage Exceeded: Market moved beyond acceptable slippage tolerance
  • Invalid Signature: Transaction was not properly signed
  • Expired Transaction: Transaction validity period has passed
  • Network Congestion: Blockchain network is experiencing high load

Use Cases

  • Automated Trading: Execute swaps programmatically with confirmation tracking
  • Trading Bots: Use awaitLanding for real-time execution feedback
  • MEV Protection: Use batch mode with multiple landers for optimal landing
  • DeFi Integration: Complete swap flows with on-chain confirmation in your application

Body

application/json
chainId
string
required
signedTransaction
string
Minimum string length: 1
candidates
object[]
Minimum array length: 1
awaitLanding
boolean

Response

200 - application/json

Swap send response

data
object
required
error
string