> ## 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.

# Send Swap Transaction

> Broadcast a signed swap transaction to the blockchain network.

## 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](/rest-api-reference/endpoint/swap-quoting) endpoint and signing the transaction with your wallet.

<Warning>
  **Private Beta Access Only**

  This endpoint is not yet available to the general public. Please contact the Mobula team to request access.
</Warning>

## 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)

```bash theme={null}
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)

```bash theme={null}
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)

```bash theme={null}
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)

```bash theme={null}
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)

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

### Processed (Solana with awaitLanding)

```json theme={null}
{
  "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)

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

### Failed On-Chain

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

### Broadcast Error

```json theme={null}
{
  "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](/rest-api-reference/endpoint/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

| Status        | Meaning                                | Reliability       |
| ------------- | -------------------------------------- | ----------------- |
| `broadcasted` | Transaction sent, confirmation unknown | Pending           |
| `processed`   | Solana: processed by leader validator  | \~99.99% reliable |
| `confirmed`   | Fully confirmed on-chain               | 100% reliable     |
| `failed`      | Confirmed as failed/reverted           | Definitive        |
| `timeout`     | No confirmation within timeout         | Unknown           |

## 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


## OpenAPI

````yaml post /2/swap/send
openapi: 3.0.0
info:
  version: 1.0.0
  title: Mobula API
  description: >-
    Documentation of the Mobula API


    **Demo API**: The default server (demo-api.mobula.io) is a demo API with
    rate limits.

    For production use, please use api.mobula.io with an API key from
    https://admin.mobula.io
servers:
  - url: https://demo-api.mobula.io/api/
    description: Demo API (rate limited, for testing only)
  - url: https://api.mobula.io/api/
    description: Production API (requires API key)
security: []
tags:
  - name: V2 - Token
    description: Token details, price, security, ATH, and holder data
  - name: V2 - Market Data
    description: Market details, OHLCV history, and lighthouse metrics
  - name: V2 - Trades
    description: Token trades, enriched trades, and trade filters
  - name: V2 - Wallet
    description: Wallet positions, activity, trades, analysis, and labels
  - name: V2 - Assets
    description: Cross-chain asset details and price history
  - name: V2 - Swap
    description: Swap quoting and execution
  - name: V2 - Perps
    description: Perpetual futures quoting, execution, and positions
  - name: V2 - Bridge
    description: Cross-chain bridge quoting and intent status (Alpha Preview)
  - name: V2 - DeFi
    description: Bonding pools and pulse data
  - name: V2 - Search
    description: Universal fast search
  - name: V2 - Usage
    description: Per-key API and WebSocket usage history
  - name: V2 - Blockchains
    description: System metadata and chain listings
  - name: V2 - Prediction Markets
    description: >-
      Polymarket markets/events, wallet positions, and the full execution stack
      (auth, order build/submit/cancel, approvals, pUSD wrap/unwrap, deploy,
      deposit/withdraw, redeem). Alpha — see /api/2/pm/*.
  - name: V1 - Market Data
    description: Market prices, history, sparklines, pairs, and multi-data
  - name: V1 - Wallet
    description: Wallet portfolio, transactions, history, and NFTs
  - name: V1 - Token
    description: First buyers
  - name: V1 - Trades
    description: Market trades by pair
  - name: V1 - Metadata
    description: Token metadata, categories, and news
  - name: V1 - Assets
    description: List all assets
  - name: V1 - Search
    description: Search for assets, tokens, and pairs
  - name: V1 - DeFi
    description: Bonding pool pulse data
  - name: V1 - Blockchains
    description: Blockchain listings, pairs, and stats
  - name: V1 - Webhooks
    description: Webhook management
  - name: V1 - Feed
    description: Custom feed creation
paths:
  /2/swap/send:
    post:
      tags:
        - V2 - Swap
      summary: Send a swap transaction
      description: Submit a signed swap transaction to the blockchain
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                chainId:
                  type: string
                  description: >-
                    Chain dispatcher. Solana: `solana:solana`. EVM:
                    `evm:<chainId>` (e.g. `evm:8453` for Base). TON:
                    `ton:mainnet` or `ton:testnet`.
                  example: solana:solana
                signedTransaction:
                  type: string
                  minLength: 1
                  description: >-
                    Base64 of the signed payload. Solana: signed
                    `VersionedTransaction`/`Transaction` bytes. EVM: raw signed
                    RLP. TON: signed `external_in_message` BoC.
                  example: AQABAuObQ8Adqk1eqZxRMJg4r6vGtXq9k0...base64...
                candidates:
                  type: array
                  items:
                    $ref: '#/components/schemas/SwapSendCandidate'
                  minItems: 1
                  description: >-
                    Multi-lander batch (Solana only). One signed candidate per
                    lander, sharing a durable nonce — only one will commit.
                    Mutually exclusive with `signedTransaction`.
                awaitLanding:
                  type: boolean
                  description: >-
                    When `true`, the endpoint blocks until on-chain confirmation
                    and returns swap data.
                  example: false
                feeWallet:
                  type: string
                  description: >-
                    Wallet that receives the referral fee on this swap. Echo
                    from the original /quote request.
                feeAmountUsd:
                  type: number
                  nullable: true
                  minimum: 0
                  description: >-
                    Referral fee amount in USD for this swap (feePercentage ×
                    amountInUsd from the /quote response). Persisted for
                    dashboard attribution; not re-validated against the signed
                    transaction.
                  example: 1.25
              required:
                - chainId
      responses:
        '200':
          description: Swap send response
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      success:
                        type: boolean
                      transactionHash:
                        type: string
                      requestId:
                        type: string
                      lander:
                        type: string
                      landingTimeMs:
                        type: number
                      status:
                        type: string
                        enum:
                          - broadcasted
                          - processed
                          - confirmed
                          - failed
                          - timeout
                      onchainLandingTimeMs:
                        type: number
                      swap:
                        type: object
                        properties:
                          tokenIn:
                            type: object
                            properties:
                              address:
                                type: string
                              amount:
                                type: string
                            required:
                              - address
                              - amount
                          tokenOut:
                            type: object
                            properties:
                              address:
                                type: string
                              amount:
                                type: string
                            required:
                              - address
                              - amount
                        required:
                          - tokenIn
                          - tokenOut
                    required:
                      - success
                      - requestId
                  error:
                    type: string
                required:
                  - data
components:
  schemas:
    SwapSendCandidate:
      type: object
      properties:
        lander:
          type: string
          minLength: 1
          description: Lander id — `jito`, `nozomi`, `zeroslot`, …
          example: jito
        signedTransaction:
          type: string
          minLength: 1
          description: >-
            Base64 of the signed payload. Solana: signed
            `VersionedTransaction`/`Transaction` bytes. EVM: raw signed RLP.
            TON: signed `external_in_message` BoC.
          example: AQABAuObQ8Adqk1eqZxRMJg4r6vGtXq9k0...base64...
      required:
        - lander
        - signedTransaction

````