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

# Build Swap

> POST /api/v1/swap — Build an unsigned swap transaction ready to sign and submit.



## OpenAPI

````yaml POST /api/v1/swap
openapi: 3.1.0
info:
  title: Argyros API
  description: >-
    Swap aggregator API on Fogo. Get quotes, build swap transactions, and
    retrieve raw instructions for multi-hop token swaps across Vortex, Fluxbeam,
    Fogo.fun, and Moonit. Solana support coming soon.
  version: 1.0.0
  contact:
    name: Argyros
    url: https://argyros.finance
servers:
  - url: https://api.argyros.xyz
    description: Production
security: []
paths:
  /api/v1/swap:
    post:
      tags:
        - Swap
      summary: Build swap transaction
      description: >-
        Build an unsigned Solana transaction for a token swap. The returned
        base64-encoded transaction must be signed by the user's wallet and
        submitted to the network. Optionally runs a simulation to validate the
        transaction before returning it.
      operationId: buildSwap
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SwapRequest'
      responses:
        '200':
          description: Swap transaction built successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  data:
                    $ref: '#/components/schemas/SwapResponse'
        '400':
          description: Invalid request parameters or insufficient liquidity.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: No route found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Transaction build failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    SwapRequest:
      type: object
      description: Parameters for building a swap transaction.
      properties:
        userWallet:
          type: string
          description: User's wallet address that will sign and execute the transaction.
          example: 9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM
        inputMint:
          type: string
          description: Input token mint address.
          example: So11111111111111111111111111111111111111112
        outputMint:
          type: string
          description: Output token mint address.
          example: uSd2czE61Evaf76RNbq4KPpXnkiL3irdzgLFUMe3NoG
        amount:
          type: string
          description: Amount in smallest token units.
          example: '1000000000'
        swapMode:
          type: string
          enum:
            - ExactIn
            - ExactOut
          description: >-
            ExactIn: amount is exact input. ExactOut: amount is exact desired
            output.
          example: ExactIn
        slippageBps:
          type: integer
          description: 'Slippage tolerance in basis points. Default: 50 (0.5%).'
          default: 50
          example: 50
        skipSimulation:
          type: boolean
          description: >-
            Skip transaction simulation. Faster but no pre-flight validation.
            Default: false.
          default: false
          example: false
      required:
        - userWallet
        - inputMint
        - outputMint
        - amount
        - swapMode
    SwapResponse:
      type: object
      description: Unsigned swap transaction and execution details.
      properties:
        transaction:
          type: string
          description: >-
            Base64-encoded unsigned transaction. Sign with user's wallet before
            submitting.
        lastValidBlockHeight:
          type: integer
          description: Transaction expires after this block height (~60 seconds).
          example: 245832190
        amountIn:
          type: string
          example: '1000000000'
        amountOut:
          type: string
          example: '145320000'
        minAmountOut:
          type: string
          description: >-
            Minimum output after slippage (ExactIn only). Transaction fails if
            actual output is less.
        maxAmountIn:
          type: string
          description: >-
            Maximum input after slippage (ExactOut only). Transaction fails if
            actual input exceeds this.
        feeAmount:
          type: string
          description: Aggregator fee in output token units.
          example: '0'
        simulation:
          $ref: '#/components/schemas/SimulationResult'
        computeUnitsEstimate:
          type: integer
          description: Estimated compute units for execution.
          example: 85000
        route:
          type: array
          items:
            type: string
          description: Token path from input to output.
        hopCount:
          type: integer
          example: 1
        pools:
          type: array
          items:
            type: string
          description: Pool addresses used in the route.
        isSplitRoute:
          type: boolean
          description: Whether liquidity is split across multiple pools.
          example: false
        splitPercents:
          type: array
          items:
            type: integer
          description: Percentage split across pools (only if isSplitRoute is true).
      required:
        - transaction
        - lastValidBlockHeight
        - amountIn
        - amountOut
        - feeAmount
        - route
        - hopCount
        - pools
    ErrorResponse:
      type: object
      properties:
        success:
          type: boolean
          example: false
        error:
          type: string
          example: no route found
      required:
        - success
        - error
    SimulationResult:
      type: object
      description: Transaction simulation result.
      properties:
        success:
          type: boolean
          example: true
        logs:
          type: array
          items:
            type: string
          description: Simulation log messages.
        computeUnitsConsumed:
          type: integer
          description: Compute units consumed during simulation.
          example: 85000
        error:
          type: string
          description: Error message if simulation failed.
        insufficientFunds:
          type: boolean
          description: True if the wallet has insufficient funds for the swap.
        slippageExceeded:
          type: boolean
          description: True if the price moved beyond slippage tolerance.
      required:
        - success
        - logs
        - computeUnitsConsumed
        - insufficientFunds
        - slippageExceeded

````