Are you an LLM? Read llms.txt for a summary of the docs, or llms-full.txt for the full context.
Skip to content

updateMarginMode

Switches an instrument between cross and isolated margin.

POST/exchangetype updateMarginMode

Switch one instrument between cross and isolated margin.Agent-signed

Action fields
assetinteger · uint32required

Instrument's external id — the `index` value from `perpMeta`; Outcome markets use the `instrument_id`.

isCrossbooleanrequired

`true` for cross margin, `false` for isolated.

typestringrequired

Must be `updateMarginMode`.

"updateMarginMode"
Request example
curl -X POST https://rpc.txflow-testnet.xyz/exchange \
  -H "Content-Type: application/json" \
  -H "x-api-version: 2026-08-16" \
  -d '{
  "action": {
    "type": "updateMarginMode",
    "asset": 1,
    "isCross": true
  },
  "signature": {
    "r": "0x<r>",
    "s": "0x<s>",
    "v": 27
  },
  "nonce": 1757992743994,
  "vaultAddress": null,
  "signatureChainId": null
}'
Try it
testnet · no account yet
Generates a throwaway key in your browser, claims testnet USDC and authorizes an agent key. The account is kept while you browse the docs and lost on reload.
Response · UpdateMarginMode 200
codeinteger

`0` on success.

dataobject
dataobject
typestring

The action's internal name, which does not always match the request `type`.

"UpdateMarginMode"
statusstring

A rejected request returns `err` with a non-zero `code` and the reason in `message` (or `response`).

"ok"
Response example
{
  "status": "ok",
  "code": 0,
  "data": {
    "type": "UpdateMarginMode",
    "data": {
      "statuses": [
        "success"
      ]
    }
  }
}

Note that this action takes a boolean isCross, whereas updateLeverage takes a marginMode string.

Next steps

Once an instrument is on isolated margin, adjust that position's margin with updateIsolatedMargin.