---
title: "Update position leverage"
method: POST
path: "/v1/account/leverage"
tags: ["Account"]
---

# Update position leverage

`POST /v1/account/leverage`

## Request

- Base URL: `https://api.testnet.rise.trade`
- URL: `https://api.testnet.rise.trade/v1/account/leverage`
- Auth: none required
- TypeScript: <https://skmtc.dev/rise/apis/risex-rest-api/docs/v1/account/leverage/post.ts> (a function with typed inputs; its response is checked against the schema)

Update leverage for a position in a specific market. Gas sponsored by API service.

**Permit:** Client signs an EIP-712 `VerifyWitness` permit; the server recovers the signer off-chain and matches it to `permit_params.signer` (server holds no keys).

**Prerequisites:**
1. `GET /v1/auth/eip712-domain` — EIP-712 domain (`name`, `version`, `chainId`, `verifyingContract` = Authorization contract)
2. `GET /v1/nonce-state/{account}` — `nonce_anchor` and `current_bitmap_index` (pass it as `permit_params.nonce_bitmap_index`; if 208 the anchor is full — use `nonce_anchor+1` with bitmap index 0)
3. `GET /v1/system/config` — `router` address (RISExUniversalRouter), used as the `target` field below

**Action hash:** (`leverage` is the request's base-10 string parsed as uint8, 1-255 — sign the same integer value)
```
actionHash = keccak256(abi.encode(
  keccak256("RISE_PERPS_UPDATE_LEVERAGE_V1"),  // bytes32 action selector
  uint16(marketId),
  uint8(leverage)))
```

**Permit digest (EIP-712):**
```
VerifyWitness(address account,address target,bytes32 hash,uint48 nonceAnchor,uint8 nonceBitmap,uint32 deadline)
```
Sign as standard EIP-712 typed data (e.g. ethers `signTypedData`) with `hash` = actionHash, `target` = RISExUniversalRouter address (NOT the account, NOT the domain `verifyingContract`), `nonceBitmap` = `permit_params.nonce_bitmap_index`.

**Signature:** 64-byte EIP-2098 compact (r + yParityAndS) or 65-byte (r+s+v, auto-converted).

## Request body

- ApiUpdateLeverageRequest
  - `market_id` string, uint64
  - `leverage` string
  - `permit_params` ApiPermitParams: Permit parameters for v3 authenticated operations. Client signs EIP-712 VerifyWitness; server builds byte-packed permit suffix. Uses bitmap nonces for replay protection.
    - `account` string: Account address (hex)
    - `signer` string: Signer address (hex)
    - `nonce_anchor` string, uint64: Permit nonce anchor (uint48)
    - `nonce_bitmap_index` integer: Permit nonce bitmap index within the anchor epoch (uint8, valid range 0-207). Despite the uint8 type the contract reverts `InvalidNonceIndex(uint8)` above 207. When `GET /v1/nonce-state/{account}` returns `current_bitmap_index` = 208 the anchor is full — use `nonce_anchor + 1` with index 0.
    - `deadline` integer: Permit deadline (unix timestamp)
    - `signature` string, byte: EIP-2098 compact signature (64 bytes: r + yParityAndS) or standard 65-byte (r+s+v, auto-converted). Protobuf `bytes` — over REST this field is **base64**, not 0x hex. (The `account_signature` / `signer_signature` fields on `/v1/auth/register-signer` are hex strings instead.)

## Response `200`

A successful response.

- ApiUpdateLeverageResponse
  - `transaction_hash` string
  - `block_number` string, uint64
  - `receipt` ApiTransactionReceipt
    - `status` integer
    - `block_number` string, uint64
    - `gas_used` string, uint64

## Other responses

- `default`: An unexpected error response.

## Changes

- **2026-11-03** `98eabcd6a6ad`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/rise/apis/risex-rest-api/changes/v1/account/leverage/post.md)

---

[API](https://skmtc.dev/rise/apis/risex-rest-api.md) - [All operations](https://skmtc.dev/rise/apis/risex-rest-api/llms.txt) - [OpenAPI document](https://skmtc.dev/rise/apis/risex-rest-api/revisions/98eabcd6a6ad?raw)
