updateIsolatedMargin
Adds or removes margin on an existing isolated position.
updateIsolatedMarginAdd or remove margin on an existing isolated position.Agent-signed
Instrument's external id — the `index` value from `perpMeta`; Outcome markets use the `instrument_id`.
`true` targets the long position, `false` the short.
Signed USDC amount in integer wei, 6 decimals — positive adds margin, negative removes it. Must be an integer string.
Must be `updateIsolatedMargin`.
"updateIsolatedMargin"curl -X POST https://rpc.txflow-testnet.xyz/exchange \
-H "Content-Type: application/json" \
-H "x-api-version: 2026-08-16" \
-d '{
"action": {
"type": "updateIsolatedMargin",
"asset": 1,
"isBuy": true,
"ntli": "1000000000"
},
"signature": {
"r": "0x<r>",
"s": "0x<s>",
"v": 27
},
"nonce": 1757992743994,
"vaultAddress": null,
"signatureChainId": null
}'`0` on success.
The action's internal name, which does not always match the request `type`.
"UpdateIsolatedMargin"A rejected request returns `err` with a non-zero `code` and the reason in `message` (or `response`).
"ok"{
"status": "ok",
"code": 0,
"data": {
"type": "UpdateIsolatedMargin",
"data": {
"statuses": [
"success"
]
}
}
}ntli must be an integer string: "1000000" is 1 USDC, and "-1000000" removes 1 USDC. A decimal string such as "1.5" is rejected with Invalid ntli value. The example above adds 1,000 USDC.
Preconditions
| Error | Cause |
|---|---|
Position not found | No isolated position on the requested instrument and side |
Amount must be greater than 0 | ntli resolves to zero |
Margin reduction exceeds the maximum allowable amount for this position | Removal would drop margin below the position's required initial margin |
When removing margin, the removable amount is the position's margin less its required initial margin (entryPrice × size / leverage). Unrealized losses reduce that headroom; unrealized profit does not increase it. Adding margin is additionally bounded by the account's available balance.
Next steps
Read the resulting position margin from clearinghouseState.