> For the complete documentation index, see [llms.txt](https://faq.finerymarkets.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://faq.finerymarkets.com/api-reference/rest-api/trading/orders-and-order-book/mod.md).

# mod

{% hint style="info" %}
/mod method makes sense only for makers, since taker's orders are processed immediately and a server does not store them.
{% endhint %}

Please note that in case of replacing a partially filled order the size of a newly replaced order will be less than the specified size by the filled amount (e.g., the size of an initial order was 10; then the order was partially filled and the remaining size was 8; when a user replaces this order, a new size must be 12 if a user wants to have 10 in the order book).

Please also note it is not possible to replace an order by `clientOrderId`.&#x20;

{% hint style="info" %}
Using `/mod` command instead of `add/del` is highly recommendable for makers.
{% endhint %}

**POST api/mod**

{% tabs %}
{% tab title="Payload" %}

```json
{
    "orderId": 1235,
    "price": 1000000000000,
    "size": 20000000
}
```

{% endtab %}

{% tab title="200 OK" %}

```json
{
    "id": 1246,
    "initialSize": 18000000,
    "remainingSize": 18000000,
    "deals": [ ],
    "origId": 1245,
    "origRemainingSize": 8000000
}
```

{% endtab %}

{% tab title="400 Bad request" %}

```json
{
    "error": 2
}

"mod" is the only method that may have a different format of an error response

{
    "reply": {
        "error": 74,
        "origId": 42,
        "origRemainingSize": 10000
    }
}
```

{% endtab %}
{% endtabs %}

**Request parameters**

| Field name    | Type               | Description                                                                                       |
| ------------- | ------------------ | ------------------------------------------------------------------------------------------------- |
| orderId       | Efx::OrderId       | Id of order to replace                                                                            |
| clientOrderId | Efx::ClientOrderId | *Optional* user data attached to a new order                                                      |
| price         | Efx::Price         | New Price                                                                                         |
| size          | Efx::Size          | Initial size of replace result will be size - (old order initial size - old order remaining size) |

**Response description**

| Field name        | Type           | Description                                                                                                                                                                                               |
| ----------------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| error             | Efx::ErrorCode | Will be returned alongside with `origId` and `origRemainingSize` in case old order was removed but new order cannot be placed. In case old order cannot be removed standard error reply will be returned. |
| id                | Efx::OrderId   | New Order Id                                                                                                                                                                                              |
| initialSize       | Efx::Size      | New Order initial size                                                                                                                                                                                    |
| remainingSize     | Efx::Size      | New Order remaining size (after aggressive deals)                                                                                                                                                         |
| cancelReason      | unsigned int16 | <p>Cancel reason</p><p>0 - in place or filled</p><p>1 - by client</p><p>2 - as non-book order</p><p>3 - by self-trade prevention</p><p>4 - cancel-on-disconnect</p>                                       |
| origId            | Efx::OrderId   | Original Order Id                                                                                                                                                                                         |
| origRemainingSize | Efx::Size      | Original Order size on removal                                                                                                                                                                            |
| deals             | Array of Deals | Initial (taker) deals                                                                                                                                                                                     |
| **Deal**          | Array\[6]      |                                                                                                                                                                                                           |
| id                | Efx::DealId    | Deal Id                                                                                                                                                                                                   |
| price             | Efx::Price     | Deal price                                                                                                                                                                                                |
| size              | Efx::Size      | DealSize                                                                                                                                                                                                  |
| volume            | Efx::Size      | Deal volume                                                                                                                                                                                               |
| delta             | Efx::Size      | Deal delta in quote (balance) currency                                                                                                                                                                    |
| counterpartyId    | Efx::ClientId  | Counterparty id                                                                                                                                                                                           |
