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

modify2

Amends the price and size of a resting order in place. The order is not canceled and re-placed: it keeps its order id, its already-filled quantity, and its original sequence number, so it is not sent to the back of the queue at the new price. The action can also attach, change, or clear the order's take-profit / stop-loss children in the same signed request.

POST/exchangetype modify2

Amend price / size of a resting order in place; it keeps its id and queue priority.Agent-signed

Action fields
orderModify2Bodyrequired

The amendment for the resting order.

ointeger · uint64required

Order to amend, as an integer. A numeric string is parsed too, but the node hashes the value as an integer, so sign it as one. Long form: `oid`.

pstringrequired

New limit price. `"bbo"` is **not** accepted. Long form: `limitPx`.

sstringrequired

New total size in base units, not a delta. Long form: `sz`.

tTriggerOrderTypeoptional

Only used by `tpsl` entries, where it carries the `trigger` body. Long form: `orderType`.

typestringrequired

Must be `modify2`.

"modify2"
tpslarraynullableoptional

Exactly two bodies, one take-profit and one stop-loss. Omitted, `null`, or empty clears the order’s existing TPSL children.

ointeger · uint64required

Order to amend, as an integer. A numeric string is parsed too, but the node hashes the value as an integer, so sign it as one. Long form: `oid`.

pstringrequired

New limit price. `"bbo"` is **not** accepted. Long form: `limitPx`.

sstringrequired

New total size in base units, not a delta. Long form: `sz`.

tTriggerOrderTypeoptional

Only used by `tpsl` entries, where it carries the `trigger` body. Long form: `orderType`.

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": "modify2",
    "order": {
      "o": 444555666,
      "p": "52000.0",
      "s": "0.03"
    }
  },
  "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 · Modify2 200
codeinteger

`0` on success.

dataobject
dataobject
typestring

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

"Modify2"
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": "Modify2",
    "data": {
      "statuses": [
        "success"
      ]
    }
  }
}

Modify body

ointeger · uint64required

Order to amend, as an integer. A numeric string is parsed too, but the node hashes the value as an integer, so sign it as one. Long form: `oid`.

pstringrequired

New limit price. `"bbo"` is **not** accepted. Long form: `limitPx`.

sstringrequired

New total size in base units, not a delta. Long form: `sz`.

tTriggerOrderTypeoptional

Only used by `tpsl` entries, where it carries the `trigger` body. Long form: `orderType`.

triggerobjectrequired

Only price and size are amendable. Side, instrument, reduce-only, margin mode, and time-in-force stay as they were on the original order — there is no way to change them with modify2.

Outcome resting limit orders use the same action. Their amended price remains the YES-side book price, including when the UI displays the complementary NO price. Outcome orders do not use the tpsl extension.

Size changes

s is the new total size, not a delta. The already-filled quantity is preserved:

New sizeResult
Larger than the current totalThe increase is added to the unfilled remainder
Smaller, but still above the filled quantityThe remainder becomes newSize - filled
At or below the filled quantityThe order closes as fully filled at the quantity already executed

A request that changes neither price nor size is accepted and leaves the resting order alone; any tpsl change in the same action still applies.

Take-profit / stop-loss

When tpsl is present it must contain exactly two bodies — one with tpsl: "tp" and one with tpsl: "sl":

{
  "o": 444555667,
  "p": "0",
  "s": "0.03",
  "t": { "trigger": { "isMarket": true, "triggerPx": "48000.0", "tpsl": "sl" } }
}

If the order already has TPSL children, each o must be one of those two child order ids; otherwise the request is rejected with Invalid TPSL order ID: <oid>. Expected <sl> or <tp>. If the order has no TPSL children yet, the two bodies are created and bound to it, sized from the amended order size.

Because modify2 amends in place rather than canceling and re-placing, the order keeps its existing TP/SL children when you omit tpsl — unlike the cancel-then-place modify / batchModify actions, which delete the protection with the parent order and cannot re-attach it. Use modify2 whenever the order being changed carries protection.

Preconditions

ErrorCause
Modify2 does not support BBO price.p is the literal "bbo"
Order limit price is invalid / Order size is invalidp or s is unparsable or not positive
Order not foundNo resting order with that o
Permission denied: you are not authorized to modify this order.The order belongs to another account
This instrument only supports isolated margin modeThe resting order is on cross margin for an isolated-only instrument
Modify order check failed: <reason>The amended order fails the leverage or available-balance check

The new price is additionally checked against the instrument's tick size and the oracle price band, and a size increase is checked against the open-interest cap. Amending is rejected while the instrument is halted or delisted.

Next steps

The response confirms acceptance, not the final book state — read the amended order back with frontendOpenOrders, and its TPSL children with tpslOrders.

For Outcome, read it back with outcomeFrontendOpenOrders and follow outcomeOrderUpdates.