Skip to main content
POST /api/v1/account/margin

Operation Type (for Signing)

Header FieldTypeContent
”type”string"update_margin_mode"

Request Body

FieldTypeNeedDescriptionExample
”account”stringrequiredUser’s wallet address42trU9A5…
“symbol”stringrequiredTrading pair symbolBTC
”is_isolated”booleanrequiredMargin mode (true for isolated, false for cross)false
”timestamp”integerrequiredCurrent timestamp in milliseconds1716200000000
”expiry_window”integeroptionalSignature expiry in milliseconds30000
”agent_wallet”stringoptionalAgent wallet address69trU9A5…
“signature”stringrequiredCryptographic signature5j1Vy9Uq…
{
  "account": "42trU9A5...",
  "symbol": "BTC",
  "is_isolated": false,
  "timestamp": 1716200000000,
  "expiry_window": 30000,
  "agent_wallet": "69trU9A5...",
  "signature": "5j1Vy9Uq..."
}

Response

  • Status 200: Margin mode updated successfully
 {
    "success": true
  }
  • Status 400: Invalid request parameters
  {
    "error": "Invalid margin mode",
    "code": 400
  }
  • Status 500: Internal server error

Code Example (Python)

import requests

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

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

data = response.json()