Skip to content
LogoLogo

updateLeverage

Endpoint

WebSocket /ws

Selector: request.payload.action.type: "updateLeverage"

Purpose

Set the customer's cross-margin leverage.

Authorization

Owner or permitted trading agent. The SDK signs the payload. HTTP and WebSocket share trading nonces.

Request fields

FieldTypeRequiredMeaning
methodStringYes"post".
idIntegerYes0–9,007,199,254,740,991; unique among outstanding requests.
request.typeStringYes"action".
request.payload.actionObjectYesAction fields below.
request.payload.nonceUnsigned integerYesTrading nonce in Unix milliseconds.
request.payload.signatureObjectYesr, s, v; recovery byte 27 or 28.
request.payload.expiresAfterUnsigned integer or nullNoExpiry in Unix milliseconds.
request.payload.vaultAddressNullNoOmit or use null.

Action fields:

FieldTypeRequiredMeaning
request.payload.action.typeStringYes"updateLeverage".
request.payload.action.assetUnsigned integerYesSupported perpetual asset index.
request.payload.action.isCrossBooleanYestrue; isolated margin is outside this profile.
request.payload.action.leveragePositive integerYesRequested customer leverage, subject to policy limits.

Shared envelope: message format.

Request example

Example values. Use a fresh nonce and signature.

{
  "method": "post",
  "id": 259,
  "request": {
    "type": "action",
    "payload": {
      "action": {
        "type": "updateLeverage",
        "asset": 0,
        "isCross": true,
        "leverage": 5
      },
      "nonce": 1796250000000,
      "signature": {
        "r": "0x1111111111111111111111111111111111111111111111111111111111111111",
        "s": "0x2222222222222222222222222222222222222222222222222222222222222222",
        "v": 27
      }
    }
  }
}

Response fields

FieldTypeMeaning
channelString"post".
data.idIntegerRequest ID.
data.response.typeString"action", or "error" for request errors.
data.response.payloadObject or stringAction result below, or an error string.

Action result fields:

FieldMeaning
data.response.payload.status"ok" for a successful update or "err" for a risk rejection.
data.response.payload.responseResponse object on success; a reason string for a risk rejection.
data.response.payload.response.type"default" for a successful update.

Check the action status.

Response example

{
  "channel": "post",
  "data": {
    "id": 259,
    "response": {
      "type": "action",
      "payload": {
        "status": "ok",
        "response": {
          "type": "default"
        }
      }
    }
  }
}

Constraints

Cross margin only; isCross must be true. Market and risk limits apply. This changes the customer setting, not the shared venue account's leverage.

Match responses by data.id. Transport rules.