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

# Execute Swap

> Execute a swap transaction via router (Jupiter, 0x).

Example:
    connector: 'jupiter'
    network: 'solana-mainnet-beta'
    trading_pair: 'SOL-USDC'
    side: 'BUY'
    amount: 1
    slippage_pct: 1  (optional; omit to use the connector's configured slippagePct)
    wallet_address: (optional, uses default if not provided)
    extra_params: {"approximateIfNoExactOut": false}  # Solana routers

Returns:
    Transaction hash and swap details



## OpenAPI

````yaml /api-reference/openapi.json post /gateway/swap/execute
openapi: 3.1.0
info:
  title: Hummingbot API
  description: API for managing Hummingbot trading instances
  version: 1.0.1
servers:
  - url: http://localhost:8000
    description: Local development server
security: []
paths:
  /gateway/swap/execute:
    post:
      tags:
        - Gateway Swaps
      summary: Execute Swap
      description: |-
        Execute a swap transaction via router (Jupiter, 0x).

        Example:
            connector: 'jupiter'
            network: 'solana-mainnet-beta'
            trading_pair: 'SOL-USDC'
            side: 'BUY'
            amount: 1
            slippage_pct: 1  (optional; omit to use the connector's configured slippagePct)
            wallet_address: (optional, uses default if not provided)
            extra_params: {"approximateIfNoExactOut": false}  # Solana routers

        Returns:
            Transaction hash and swap details
      operationId: execute_swap_gateway_swap_execute_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SwapExecuteRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SwapExecuteResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBasic: []
components:
  schemas:
    SwapExecuteRequest:
      properties:
        connector:
          type: string
          title: Connector
          description: DEX router connector (e.g., 'jupiter', '0x')
        network:
          type: string
          title: Network
          description: Network ID in 'chain-network' format (e.g., 'solana-mainnet-beta')
        trading_pair:
          type: string
          title: Trading Pair
          description: Trading pair (e.g., 'SOL-USDC')
        side:
          type: string
          title: Side
          description: 'Trade side: ''BUY'' or ''SELL'''
        amount:
          anyOf:
            - type: number
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Amount
          description: >-
            Amount denominated in the BASE token (SELL: base to sell; BUY: base
            to receive)
        slippage_pct:
          anyOf:
            - type: number
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Slippage Pct
          description: >-
            Maximum slippage percentage; omit to use the connector's configured
            slippagePct
        wallet_address:
          anyOf:
            - type: string
            - type: 'null'
          title: Wallet Address
          description: Wallet address (optional, uses default if not provided)
        extra_params:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Extra Params
          description: >-
            Connector-specific params passed through to Gateway under its own
            names: approximateIfNoExactOut (Solana routers). Unknown keys are
            rejected.
      type: object
      required:
        - connector
        - network
        - trading_pair
        - side
        - amount
      title: SwapExecuteRequest
      description: Request to execute a swap
    SwapExecuteResponse:
      properties:
        transaction_hash:
          type: string
          title: Transaction Hash
          description: Transaction hash
        trading_pair:
          type: string
          title: Trading Pair
          description: Trading pair
        side:
          type: string
          title: Side
          description: Trade side
        amount:
          type: string
          pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Amount
          description: >-
            Amount REQUESTED, denominated in the base token (SELL: base sold;
            BUY: base wanted). This is the request echoed back, not the fill —
            see input_amount / output_amount for what actually moved.
        input_amount:
          anyOf:
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Input Amount
          description: >-
            Amount actually spent, denominated in the input token (quote for
            BUY, base for SELL). None until the transaction confirms.
        output_amount:
          anyOf:
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Output Amount
          description: >-
            Amount actually received, denominated in the output token (base for
            BUY, quote for SELL). None until the transaction confirms.
        price:
          anyOf:
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Price
          description: >-
            Executed price in quote per base, computed from the amounts that
            moved. None until the transaction confirms.
        status:
          type: string
          title: Status
          description: Transaction status
          default: submitted
      type: object
      required:
        - transaction_hash
        - trading_pair
        - side
        - amount
      title: SwapExecuteResponse
      description: >-
        Response after executing swap.


        `amount` is what was asked for; the three fill fields are what happened.
        They were

        missing entirely, so a caller reconciling a position against this
        response was

        reconciling against its own intent: a BUY of 1000 tokens that delivered
        951.68

        answered `amount: 1000` under the description "Amount swapped". Every
        one of these

        numbers was already in hand — the same call writes them to the swap
        history — so the

        only way to learn what a swap did was to execute it, discard the answer,
        and search

        the history by transaction hash.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    HTTPBasic:
      type: http
      scheme: basic

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.