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

# private/set_leverage

> Sets a custom leverage multiplier for a specified future instrument.

Custom leverage cannot exceed the effective `max_leverage` allowed by the account's risk profile. Passing `null` as the leverage value removes the custom leverage setting and restores the default leverage.

Custom leverage setting is disabled for isolated subaccounts. Setting leverage in isolated margin mode is restricted to main accounts.

 

[Try in API console](https://test.deribit.com/api_console?method=%2Fprivate%2Fset_leverage)





## OpenAPI

````yaml /api-reference/coinbase-deribit-app-api/adv-starbase-openapi.json get /private/set_leverage
openapi: 3.1.0
info:
  description: Coinbase Retail Advanced Trade API for derivatives trading.
  title: Coinbase Retail Advanced Trade (Deribit) API
  version: 2.1.1
servers:
  - url: https://drb.coinbase.com/api/v2
security: []
tags:
  - description: Can only be used over websockets.
    name: WebSocket Only
  - description: Public methods can be used without authentication.
    name: Public
  - description: >-
      <p>Private methods require authentication. All requests must include a
      valid OAuth2 token.</p>

      <p>A token can be requested using the <a
      href="#public-auth">/public/auth</a> method.</p>

      <p>When using the websockets protocol, the token must be included as a
      parameter <code>access_token</code> in the message. When using REST (HTTP
      GET), the token may also be passed in the <code>Authorization</code>
      header.</p>
    name: Private
  - name: Authentication
  - name: Session Management
  - description: >-
      Subscription works as [notifications](#notifications), so users will
      automatically (after subscribing) receive messages from the server.
      Overview for each channel response format is described in
      [subscriptions](#subscriptions) section.
    name: Subscription Management
  - name: Account Management
  - name: Trading
  - name: Market Data
  - name: Wallet
paths:
  /private/set_leverage:
    get:
      tags:
        - Trading
        - Private
      description: >+
        Sets a custom leverage multiplier for a specified future instrument.


        Custom leverage cannot exceed the effective `max_leverage` allowed by
        the account's risk profile. Passing `null` as the leverage value removes
        the custom leverage setting and restores the default leverage.


        Custom leverage setting is disabled for isolated subaccounts. Setting
        leverage in isolated margin mode is restricted to main accounts.

         

        [Try in API
        console](https://test.deribit.com/api_console?method=%2Fprivate%2Fset_leverage)

      parameters:
        - name: instrument_name
          in: query
          description: Instrument name
          required: true
          schema:
            $ref: '#/components/schemas/instrument_name'
        - name: leverage
          in: query
          description: >-
            Target custom leverage multiplier. Must be between 1 and
            max_leverage. Pass null to remove custom leverage and restore
            risk-profile default.
          required: true
          schema:
            type:
              - number
              - 'null'
        - name: subaccount_id
          in: query
          description: >-
            The user id for the subaccount. Available to retail-broker callers;
            defaults to the authenticated account.
          required: false
          schema:
            type: integer
        - name: isolated
          in: query
          description: >-
            If true, sets leverage for isolated margin scope (main account
            only).
          required: false
          schema:
            type: boolean
            default: false
      requestBody:
        description: JSON-RPC request body
        content:
          application/json:
            examples:
              request:
                description: JSON-RPC Request Example
                value:
                  id: 1
                  jsonrpc: '2.0'
                  method: private/set_leverage
                  params:
                    instrument_name: BTC-PERPETUAL
                    leverage: 50
      responses:
        '200':
          $ref: '#/components/responses/PrivateSetLeverageResponse'
      security:
        - ApiKey:
            - trade
        - OAuth2:
            - wallet:accounts:update
components:
  schemas:
    instrument_name:
      description: Unique instrument identifier
      type: string
      example: BTC-PERPETUAL
    PrivateSetLeverageResponse:
      type: object
      properties:
        id:
          description: The id that was sent in the request
          type: integer
        jsonrpc:
          description: The JSON-RPC version (2.0)
          type: string
          enum:
            - '2.0'
        result:
          description: >-
            The stored custom leverage value (or null if custom leverage was
            removed).
          type:
            - number
            - 'null'
      required:
        - jsonrpc
        - result
  responses:
    PrivateSetLeverageResponse:
      description: Success response
      content:
        application/json:
          examples:
            response:
              description: Response example
              value:
                id: 1
                jsonrpc: '2.0'
                result: 50
          schema:
            $ref: '#/components/schemas/PrivateSetLeverageResponse'
  securitySchemes:
    ApiKey:
      description: >-
        Call `public/auth` with `grant_type: coinbase_cdp` and a CDP JWT. Send
        the returned `access_token` as `Authorization: Bearer`.
      scheme: bearer
      type: http
    OAuth2:
      description: >-
        Call `public/auth` with `grant_type: coinbase_oauth2` and an OAuth
        access token. Send the returned `access_token` as `Authorization:
        Bearer`.
      flows:
        authorizationCode:
          authorizationUrl: https://login.coinbase.com/oauth2/auth
          scopes:
            wallet:accounts:read: View your accounts.
            wallet:accounts:update: Authorize `wallet:accounts:update` operations.
            wallet:buys:create: Place, edit, and cancel orders.
            wallet:payment-methods:read: View your payment methods.
            wallet:trades:create: Convert cryptocurrencies.
            wallet:trades:read: View your cryptocurrency conversions.
            wallet:transactions:read: View your transactions.
            wallet:transactions:transfer: Transfer funds between accounts.
            wallet:user:read: View your account information.
            wallet:user:update: Update your account information.
          tokenUrl: https://login.coinbase.com/oauth2/token
      type: oauth2

````