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

# Build swap instructions

> Build swap instructions without transaction wrapper



## OpenAPI

````yaml /raptor/http/openapi.json post /swap-instructions
openapi: 3.0.3
info:
  title: Raptor DEX Aggregator API
  description: High-performance Solana DEX aggregation API and Websocket
  version: 1.0.0
  contact:
    name: Raptor API Support
servers:
  - url: https://raptor-beta.solanatracker.io
    description: Beta server endpoint
security: []
paths:
  /swap-instructions:
    post:
      summary: Build swap instructions
      description: Build swap instructions without transaction wrapper
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SwapRequest'
      responses:
        '200':
          description: Successful instruction build
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SwapInstructionsResponse'
components:
  schemas:
    SwapRequest:
      type: object
      required:
        - userPublicKey
        - quoteResponse
      properties:
        userPublicKey:
          type: string
          description: User's wallet public key
        wrapUnwrapSol:
          type: boolean
          description: Automatically wrap/unwrap SOL
          default: true
        txVersion:
          type: string
          enum:
            - legacy
            - v0
          description: Transaction version
          default: v0
        computeUnitPriceMicroLamports:
          type: integer
          description: Priority fee in microlamports
        computeUnitLimit:
          type: integer
          description: Compute unit limit
        priorityFee:
          type: string
          description: Priority fee mode or microlamports
        maxPriorityFee:
          type: integer
          description: Maximum priority fee cap
        tipAccount:
          type: string
          description: Tip account pubkey
        tipLamports:
          type: integer
          description: Tip amount in lamports
        feeAccount:
          type: string
          description: Platform fee recipient
        feeBps:
          type: integer
          description: Platform fee in basis points
        feeFromInput:
          type: boolean
          description: Take fee from input
          default: false
        chargeBps:
          type: integer
          description: Extra charge on positive slippage
        quoteResponse:
          $ref: '#/components/schemas/QuoteResponse'
    SwapInstructionsResponse:
      type: object
      properties:
        tokenLedgerInstruction:
          $ref: '#/components/schemas/SerializedInstruction'
        computeBudgetInstructions:
          type: array
          items:
            $ref: '#/components/schemas/SerializedInstruction'
        setupInstructions:
          type: array
          items:
            $ref: '#/components/schemas/SerializedInstruction'
        swapInstruction:
          $ref: '#/components/schemas/SerializedInstruction'
        cleanupInstruction:
          $ref: '#/components/schemas/SerializedInstruction'
        addressLookupTableAddresses:
          type: array
          items:
            type: string
    QuoteResponse:
      type: object
      required:
        - inputMint
        - outputMint
        - amountIn
        - amountOut
        - minAmountOut
        - feeAmount
        - priceImpact
        - slippageBps
        - routePlan
        - contextSlot
        - timeTaken
      properties:
        inputMint:
          type: string
          description: Input token mint address
        outputMint:
          type: string
          description: Output token mint address
        amountIn:
          type: string
          description: Input amount in lamports
        amountOut:
          type: string
          description: Expected output amount in lamports
        minAmountOut:
          type: string
          description: Minimum output amount after slippage
        feeAmount:
          type: string
          description: Total fees paid in lamports
        priceImpact:
          type: number
          description: Price impact percentage
        slippageBps:
          type: integer
          description: Slippage used in basis points
        routePlan:
          type: array
          items:
            $ref: '#/components/schemas/RouteStep'
          description: Array of routing steps
        swapUsdValue:
          type: string
          description: USD value of the input amount
        priorityFee:
          $ref: '#/components/schemas/PriorityFeeInfo'
        platformFee:
          $ref: '#/components/schemas/PlatformFeeConfig'
        contextSlot:
          type: integer
          description: Solana slot when quote was generated
        timeTaken:
          type: number
          description: Time taken to generate quote in seconds
    SerializedInstruction:
      type: object
      required:
        - programId
        - accounts
        - data
      properties:
        programId:
          type: string
          description: Program ID
        accounts:
          type: array
          items:
            $ref: '#/components/schemas/InstructionAccount'
        data:
          type: string
          description: Base64-encoded instruction data
    RouteStep:
      type: object
      required:
        - programId
        - dex
        - pool
        - inputMint
        - outputMint
        - amountIn
        - amountOut
        - feeAmount
        - priceImpact
      properties:
        programId:
          type: string
          description: DEX program ID
        dex:
          type: string
          description: DEX name
        pool:
          type: string
          description: Pool address
        inputMint:
          type: string
          description: Step input mint
        outputMint:
          type: string
          description: Step output mint
        amountIn:
          type: string
          description: Step input amount
        amountOut:
          type: string
          description: Step output amount
        feeAmount:
          type: string
          description: Step fees
        priceImpact:
          type: number
          description: Step price impact
        percent:
          type: integer
          description: Percentage of total input
    PriorityFeeInfo:
      type: object
      required:
        - recommended
        - level
      properties:
        recommended:
          type: integer
          description: Recommended priority fee in microlamports
        level:
          type: string
          description: Priority level used
        levels:
          $ref: '#/components/schemas/PriorityFeeLevels'
    PlatformFeeConfig:
      type: object
      required:
        - feeBps
        - feeAccount
      properties:
        feeBps:
          type: integer
          description: Fee in basis points
        feeAccount:
          type: string
          description: Fee recipient address
    InstructionAccount:
      type: object
      required:
        - pubkey
        - isSigner
        - isWritable
      properties:
        pubkey:
          type: string
          description: Account public key
        isSigner:
          type: boolean
          description: Whether account signs
        isWritable:
          type: boolean
          description: Whether account is writable
    PriorityFeeLevels:
      type: object
      properties:
        min:
          type: integer
          description: Minimum priority fee
        low:
          type: integer
          description: Low priority fee
        medium:
          type: integer
          description: Medium priority fee
        high:
          type: integer
          description: High priority fee
        veryHigh:
          type: integer
          description: Very high priority fee
        unsafeMax:
          type: integer
          description: Maximum priority fee

````