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

# Update leverage setting

> **Limit: 5 requests per 60 second per user**

`POST /v1/client/leverages`

Update leverage settings. This endpoint supports two modes:

**Single symbol mode:** When `symbol` is provided, update leverage for that specific symbol.

**Batch mode:** When `symbol` is omitted, set leverage for all symbols in a single atomic operation. Each symbol's new leverage will be adjusted to `min(requested_leverage, symbol_max_leverage)`.

For example, if BTC max leverage is 100, ETH max leverage is 100, and NEAR max leverage is 10, and the user requests leverage = 20, the result will be: BTC = 20, ETH = 20, NEAR = 10.

Batch update behavior with margin modes:
- **Cross margin symbols:** A margin check is performed assuming all cross-margin symbols are updated to the new leverage. Either all cross-margin symbol leverages are updated successfully, or none are updated.
- **Isolated margin symbols:** The leverage update will only apply to symbols with no active isolated positions or pending orders. The update for isolated margin symbols will always go through for eligible symbols.

Validation Logic:

1. Check the leverage range is eligible

2. Check if the position notional under the updated leverage is acceptable
   - `max_notional = (1 / (symbol_leverage * imr_factor)) ^ (1/0.8)`
   - `symbol_leverage_max = round down to int → min(1 / (imr_factor * notional ^ 0.8), 1/base_imr)`

3. Check if the margin is enough




## OpenAPI

````yaml orderly.openapi post /v1/client/leverages
openapi: 3.0.1
info:
  title: EVM
  description: ''
  version: 1.0.0
servers:
  - url: https://api.orderly.org
    description: Mainnet
  - url: https://testnet-api.orderly.org
    description: Testnet
security: []
tags:
  - name: public
  - name: private
paths:
  /v1/client/leverages:
    post:
      tags:
        - private
      summary: Update leverage setting
      description: >
        **Limit: 5 requests per 60 second per user**


        `POST /v1/client/leverages`


        Update leverage settings. This endpoint supports two modes:


        **Single symbol mode:** When `symbol` is provided, update leverage for
        that specific symbol.


        **Batch mode:** When `symbol` is omitted, set leverage for all symbols
        in a single atomic operation. Each symbol's new leverage will be
        adjusted to `min(requested_leverage, symbol_max_leverage)`.


        For example, if BTC max leverage is 100, ETH max leverage is 100, and
        NEAR max leverage is 10, and the user requests leverage = 20, the result
        will be: BTC = 20, ETH = 20, NEAR = 10.


        Batch update behavior with margin modes:

        - **Cross margin symbols:** A margin check is performed assuming all
        cross-margin symbols are updated to the new leverage. Either all
        cross-margin symbol leverages are updated successfully, or none are
        updated.

        - **Isolated margin symbols:** The leverage update will only apply to
        symbols with no active isolated positions or pending orders. The update
        for isolated margin symbols will always go through for eligible symbols.


        Validation Logic:


        1. Check the leverage range is eligible


        2. Check if the position notional under the updated leverage is
        acceptable
           - `max_notional = (1 / (symbol_leverage * imr_factor)) ^ (1/0.8)`
           - `symbol_leverage_max = round down to int → min(1 / (imr_factor * notional ^ 0.8), 1/base_imr)`

        3. Check if the margin is enough
      parameters:
        - $ref: '#/components/parameters/orderly_timestamp'
        - $ref: '#/components/parameters/orderly_account_id'
        - $ref: '#/components/parameters/orderly_key'
        - $ref: '#/components/parameters/orderly_signature'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                symbol:
                  type: string
                  example: PERP_BTC_USDC
                leverage:
                  type: integer
                  description: Integer between 1 to 100
                margin_mode:
                  type: string
                  description: 'Default: `CROSS`. Margin mode for the leverage update.'
                  enum:
                    - CROSS
                    - ISOLATED
              required:
                - leverage
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LeverageResponse'
      deprecated: false
components:
  parameters:
    orderly_timestamp:
      name: orderly-timestamp
      in: header
      description: Timestamp of the signed request in milliseconds.
      required: true
      style: simple
      explode: false
      schema:
        type: string
      example: '1649920583000'
    orderly_account_id:
      name: orderly-account-id
      in: header
      description: Account ID of the authenticated account.
      required: true
      style: simple
      explode: false
      schema:
        type: string
      example: 6.858456565150415e+75
    orderly_key:
      name: orderly-key
      in: header
      description: Public orderly key used to sign the request.
      required: true
      style: simple
      explode: false
      schema:
        type: string
      example: ed25519:8tm7dnKYkSc3FzgPuJaw1wztr79eeZpN35nHW5pL5XhX
    orderly_signature:
      name: orderly-signature
      in: header
      description: Signature of the request payload generated with the orderly key.
      required: true
      style: simple
      explode: false
      schema:
        type: string
      example: >-
        dG4bkKiqG0dUYLzViRZkvbI6Sy239JxAdNMIBxFZ4w030Jofr0ORV06GHtvXZkaZaWUXE+XAU3fnzKN/5fDeBQ==
  schemas:
    LeverageResponse:
      allOf:
        - $ref: '#/components/schemas/BasicResponse'
        - type: object
          properties:
            data:
              type: object
              properties:
                symbol:
                  description: Trading symbol for the leverage setting.
                  type: string
                  example: PERP_BTC_USDC
                margin_mode:
                  description: Margin mode for the returned leverage setting.
                  type: string
                  enum:
                    - CROSS
                    - ISOLATED
                  example: ISOLATED
                leverage:
                  description: Configured leverage value for the symbol.
                  type: integer
                  example: 19
    BasicResponse:
      required:
        - success
      type: object
      properties:
        success:
          description: Indicates whether the request was successful.
          type: boolean
          example: true
        timestamp:
          description: Server timestamp in milliseconds.
          type: integer
          example: 1702989203989

````