# Update leverage | Pacifica
This endpoint allows users to change their account leverage for a specific trading pair. For open positions, users can only increase the leverage setting.

On this page

# Update leverage

This endpoint allows users to change their account leverage for a specific trading pair. For open positions, users can only increase the leverage setting.

    POST /api/v1/account/leverage

####
Operation Type (for signing)

Header Field
Type
Content

`"type"`

string

`"update_leverage"`

Request Body

Field
Type
Need
Description
Example

`"account"`

string

required

User's wallet address

`42trU9A5...`

`"symbol"`

string

required

Trading pair symbol

`BTC`

`"leverage"`

integer

required

New leverage value

`10`

`"timestamp"`

integer

required

Current timestamp in milliseconds

`1716200000000`

`"expiry_window"`

integer

optional

Signature expiry in milliseconds

`30000`

`"agent_wallet"`

string

optional

Agent wallet address

`69trU9A5...`

`"signature"`

string

required

Cryptographic signature

`5j1Vy9Uq...`

    {
      "account": "42trU9A5...",
      "symbol": "BTC",
      "leverage": 10,
      "timestamp": 1716200000000,
      "expiry_window": 30000,
      "agent_wallet": "69trU9A5...",
      "signature": "5j1Vy9UqY..."
    }

####
Response

- Status 200: Leverage updated successfully

     {
        "success": true
      }

- Status 400: Invalid request parameters

      {
        "error": "Invalid leverage",
        "code": 400
      }

- Status 500: Internal server error

####
Code Example (Python)

    import requests

    payload = {
        "account": "42trU9A5...",
        "signature": "5j1Vy9Uq...",
        "timestamp": 1716200000000,
        "symbol": "BTC",
        "leverage": 10
    }

    response = requests.post(
        "/api/v1/account/leverage",
        json=payload,
        headers={"Content-Type": "application/json"}
    )

    data = response.json()

PreviousGet account settings
NextUpdate margin mode

Last updated 3 months ago