> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rails.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Order Modification

> Understanding order modification workflows

## Modify Order via WebSocket

To modify orders on Rails platform, use the [WebSocket](/latest/perps/websocket-api/overview) API and subscribe to the [Order Creation Stream](/latest/perps/websocket-api/order-creation-stream).
The specifications and behavior remain the same.

## Order Modification Workflow

Order modification is done by submitting a [Modify Order](/latest/perps/websocket-api/order-creation-stream/modify-order) request. You will receive four responses in sequence:

* **Acknowledgment**: Confirms the request was received and validates basic parameters
* **Original Order Modified Notice**: Confirms the original order has been successfully cancelled and is no longer present in the system
* **New Order Pending Notice**: Confirms a new order was created with the updated parameters, pending acceptance
* **Creation Confirmation**: Confirms the new order was accepted and created in the order book

Key differences:

|                | Acknowledgment    | Original Order Modified Notice | New Order Pending Notice                | Creation Confirmation |
| -------------- | ----------------- | ------------------------------ | --------------------------------------- | --------------------- |
| Result Type    | `modifyOrder`     | `modifyOrder`                  | `modifyOrder`                           | `createOrder`         |
| Body           | `modifying order` | `original order modified`      | `new order created, pending acceptance` | `order accepted`      |
| Order Status   | `modifying`       | `modified`                     | `pending`                               | `active`              |
| Status Code    | `202`             | `200`                          | `200`                                   | `200`                 |
| API Quota Used | Included          | Not Included                   | Not Included                            | Not included          |

Note that a unique `clientRequestId` can be used to correlate acknowledgment, confirmation, and any error responses for a single request.

## Comparison with Cancel and Create Workflow

The order modification workflow provides a more streamlined process with fewer steps and lower overall latency compared to cancelling an order and creating a new one separately.
Despite modifying an existing order, the modified order is treated as a new order in the order book with a new order ID, and the original order is cancelled.
Since it's essentially a cancellation followed by a new order creation, it's subject to the same [Order Limits and Restrictions](/latest/perps/guides/order-creation#order-limits-and-restrictions) as a regular order creation.
