---
updatedAt: 2026-09-08T08:45:49.000Z
agentTools:
  projectIndex: https://apidocs.bct.host/llms.txt
---

# replace-order — Replace Order

Cancels the original order and submits a new one. One of cancelOrderId and cancelOrigClientOrderId must be provided.

Request:

```json
{
  "id": "5b",
  "op": "replace-order",
  "args": {
    "symbol": "BTCUSDC",
    "side": "BUY",
    "price": "61000",
    "quantity": "0.01",
    "cancelOrderId": 2198729355243696896,
    "newClientOrderId": "new-order-001",
    "timeInForce": "GTC",
    "cancelReplaceMode": "STOP_ON_FAILURE"
  }
}
```

| Field                   | Type   | Required         | Description                                                                 |
| ----------------------- | ------ | ---------------- | --------------------------------------------------------------------------- |
| symbol                  | string | Yes              | Trading pair                                                                |
| side                    | string | Yes              | BUY / SELL                                                                  |
| price                   | string | Yes              | New price                                                                   |
| quantity                | string | Yes              | New quantity                                                                |
| cancelOrderId           | long   | One of the two   | orderId of the order to cancel                                              |
| cancelClientOrderId     | string | One of the two   | Client-defined ID of the order to cancel                                    |
| newClientOrderId        | string | No               | Client-defined ID of the new order, format \[a-zA-Z0-9-\_.], max length 100 |
| timeInForce             | string | No               | GTC/IOC/FOK/POST\_ONLY/GTD, defaults to GTC                                 |
| expireTime              | long   | Required for GTD | Expiration timestamp (milliseconds)                                         |
| selfTradePreventionMode | string | No               | Self-trade prevention mode                                                  |
| cancelReplaceMode       | string | No               | Replace mode, defaults to `STOP_ON_FAILURE`. See the options below          |

cancelReplaceMode values:

| Value                | Description                                                                |
| -------------------- | -------------------------------------------------------------------------- |
| STOP\_ON\_FAILURE    | If the cancel fails, the new order is not attempted (default)              |
| ALLOW\_FAILURE       | The new order is attempted even if the cancel fails                        |
| PLACED\_THEN\_CANCEL | The old order is cancelled only after the new order is placed successfully |

On success, data is the new order information (a single object); on failure, data is an error object `{code, msg}`.