modifyTpsl
Changes the take-profit / stop-loss pair attached to an open position: trigger prices, sizes, and market or limit execution. The action is signed by an approved agent.
modifyTpslChange the trigger price, size, or limit price of a position’s TP/SL pair, or remove the pair.Agent-signed
Exactly two legs: the stop-loss and the take-profit of one pair, stop-loss first.
Id of the existing TP or SL order, from `positionTpslOrders`, as an integer. Long form: `oid`.
Limit price for a limit leg (`isMarket: false`). Empty string for a market leg. Long form: `limitPx`.
Size in base units. `"0"` closes the entire position; a positive size closes that much; `""` leaves the leg unset. Long form: `sz`.
The leg's `trigger` body. `tpsl` is required here and selects which leg this is. Long form: `orderType`.
Must be `modifyTpsl`.
"modifyTpsl"curl -X POST https://rpc.txflow-testnet.xyz/exchange \
-H "Content-Type: application/json" \
-H "x-api-version: 2026-08-16" \
-d '{
"action": {
"type": "modifyTpsl",
"tpsl": [
{
"o": 123456790,
"p": "",
"s": "0",
"t": {
"trigger": {
"isMarket": true,
"triggerPx": "48000",
"tpsl": "sl"
}
}
},
{
"o": 123456791,
"p": "",
"s": "0",
"t": {
"trigger": {
"isMarket": true,
"triggerPx": "56000",
"tpsl": "tp"
}
}
}
]
},
"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`.
"ModifyTpsl"A rejected request returns `err` with a non-zero `code` and the reason in `message` (or `response`).
"ok"{
"status": "ok",
"code": 0,
"data": {
"type": "ModifyTpsl",
"data": {
"statuses": [
"success"
]
}
}
}TP/SL leg
Id of the existing TP or SL order, from `positionTpslOrders`, as an integer. Long form: `oid`.
Limit price for a limit leg (`isMarket: false`). Empty string for a market leg. Long form: `limitPx`.
Size in base units. `"0"` closes the entire position; a positive size closes that much; `""` leaves the leg unset. Long form: `sz`.
The leg's `trigger` body. `tpsl` is required here and selects which leg this is. Long form: `orderType`.
Always send both legs of the pair, stop-loss first. Each o is one of the pair's two order ids, read from positionTpslOrders. To keep one leg unchanged, resend its current values under its existing o.
| Leg | p | s | t.trigger |
|---|---|---|---|
| Market, whole position | "" | "0" | isMarket: true |
| Market, partial | "" | size | isMarket: true |
| Limit | limit price | "0" or size | isMarket: false |
| Unset | "" | "" | triggerPx: "" |
Setting both legs to unset removes the pair.
Signing
Keep the leg key order o, p, s, t, and the trigger key order isMarket, triggerPx, tpsl. Sign o as an integer, even though a numeric string is accepted on the wire. See MessagePack rules.
Next steps
Read the updated pair back with positionTpslOrders.