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

# Set Leverage

> Set leverage for a specific trading pair on a perpetual connector.

Args:
    account_name: Name of the account
    connector_name: Name of the perpetual connector
    request: Leverage request with trading pair and leverage value
    accounts_service: Injected accounts service

Returns:
    Dictionary with success status and message

Raises:
    HTTPException: 400 for invalid parameters or non-perpetual connector, 404 for account/connector not found, 500 for execution errors



## OpenAPI

````yaml /api-reference/openapi.json post /trading/{account_name}/{connector_name}/leverage
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:
  /trading/{account_name}/{connector_name}/leverage:
    post:
      tags:
        - Trading
      summary: Set Leverage
      description: |-
        Set leverage for a specific trading pair on a perpetual connector.

        Args:
            account_name: Name of the account
            connector_name: Name of the perpetual connector
            request: Leverage request with trading pair and leverage value
            accounts_service: Injected accounts service

        Returns:
            Dictionary with success status and message

        Raises:
            HTTPException: 400 for invalid parameters or non-perpetual connector, 404 for account/connector not found, 500 for execution errors
      operationId: set_leverage_trading__account_name___connector_name__leverage_post
      parameters:
        - name: account_name
          in: path
          required: true
          schema:
            type: string
            title: Account Name
        - name: connector_name
          in: path
          required: true
          schema:
            type: string
            title: Connector Name
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LeverageRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBasic: []
components:
  schemas:
    LeverageRequest:
      properties:
        trading_pair:
          type: string
          title: Trading Pair
          description: Trading pair (e.g., BTC-USDT)
        leverage:
          type: integer
          maximum: 125
          minimum: 1
          title: Leverage
          description: Leverage value (typically 1-125)
      type: object
      required:
        - trading_pair
        - leverage
      title: LeverageRequest
      description: Request model for setting leverage on perpetual connectors
    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

````