> ## Documentation Index
> Fetch the complete documentation index at: https://docs.raydium.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Build swap transaction (base input)

> Generate a serialized swap transaction for a fixed input amount.
Requires a successful compute response from `/compute/swap-base-in`.




## OpenAPI

````yaml /api-reference/openapi/route-api-v2.yaml post /transaction/swap-base-in
openapi: 3.0.3
info:
  title: Raydium Transaction API (Route V2)
  version: 1.0.0
  description: >
    Server-side swap transaction builder for Solana. This API generates
    serialized swap transactions without requiring clients to run an RPC
    connection or the full Raydium SDK.


    Responses follow a standard envelope format:

    - **Success**: `{ id: string, success: true, data: {...} }`

    - **Error**: `{ id: string, success: false, msg: string }`
  contact:
    name: Raydium
    url: https://raydium.io
servers:
  - url: https://transaction-v1.raydium.io
    description: Mainnet
  - url: https://transaction-v1-devnet.raydium.io
    description: Devnet
security: []
tags:
  - name: Compute
    description: Read-only endpoints for swap quote computation (no transaction building).
  - name: Transaction
    description: Build serialized swap transactions ready to sign and broadcast.
paths:
  /transaction/swap-base-in:
    post:
      tags:
        - Transaction
      summary: Build swap transaction (base input)
      description: |
        Generate a serialized swap transaction for a fixed input amount.
        Requires a successful compute response from `/compute/swap-base-in`.
      operationId: buildSwapTransactionBaseIn
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BuildTransactionRequest'
      responses:
        '200':
          description: Serialized transaction built successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TransactionResponse'
        '400':
          description: Invalid request body or computation state.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    BuildTransactionRequest:
      type: object
      required:
        - wallet
        - swapResponse
        - txVersion
        - computeUnitPriceMicroLamports
      properties:
        wallet:
          type: string
          description: Signer wallet address (base58).
          example: '11111111111111111111111111111111'
        swapResponse:
          type: object
          description: The complete response object from the compute endpoint.
          properties:
            id:
              type: string
            success:
              type: boolean
            version:
              type: string
            data:
              type: object
        txVersion:
          type: string
          enum:
            - V0
            - LEGACY
          description: Solana transaction version.
          example: V0
        computeUnitPriceMicroLamports:
          type: string
          description: Compute unit price in micro-lamports (for priority fees).
          example: '1000'
        wrapSol:
          type: boolean
          description: Whether to wrap SOL if the input is native SOL.
          example: false
        unwrapSol:
          type: boolean
          description: Whether to unwrap WSOL to SOL in the output.
          example: false
        inputAccount:
          type: string
          description: >-
            Optional token account address for input. Required if not wrapping
            SOL.
          example: TokenAccount1111111111111111111111111111111111
        outputAccount:
          type: string
          description: Optional token account address for output.
          example: TokenAccount2222222222222222222222222222222222
        jitoInfo:
          type: object
          description: Optional Jito bundle params for MEV protection.
          properties:
            address:
              type: string
              description: Jito bundle submission address.
            amount:
              type: string
              description: Bundle tip amount in lamports.
        referrerWallet:
          type: string
          description: Optional referrer wallet address for fee collection.
          example: ReferrerWallet1111111111111111111111111111111111
    TransactionResponse:
      type: object
      properties:
        id:
          type: string
          description: Unique request identifier.
          example: 550e8400-e29b-41d4-a716-446655440000
        success:
          type: boolean
          description: Whether transaction building succeeded.
          example: true
        version:
          type: string
          example: V1
        data:
          type: object
          description: Transaction data.
          properties:
            transaction:
              type: string
              description: Base64-encoded versioned transaction (ready to sign).
            addressLookupTableAddresses:
              type: array
              description: Address lookup table addresses (if txVersion=V0).
              items:
                type: string
    ErrorResponse:
      type: object
      properties:
        id:
          type: string
          description: Unique request identifier.
        success:
          type: boolean
          example: false
        version:
          type: string
          example: V1
        msg:
          type: string
          description: Error message code (e.g., REQ_SLIPPAGE_BPS_ERROR, REQ_WALLET_ERROR).

````