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

# Modify Order

## Endpoint

```text theme={null}
POST /exchange
```

## Description

Supports both single modify (`"modify"`) and batch modify (`"batchModify"`).

## Request Body

| Parameter                   | Type             | Description                                                    |
| --------------------------- | ---------------- | -------------------------------------------------------------- |
| `action`\*                  | object           | See below                                                      |
| `action.type`\*             | string           | `"modify"` or `"batchModify"`                                  |
| `action.oid`                | string \| number | Order id for single modify                                     |
| `action.order`              | object           | New order fields for single modify                             |
| `action.modifies`           | array            | Batch modify list                                              |
| `action.modifies[].oid`\*   | string \| number | Internal Notional order id                                     |
| `action.modifies[].order`\* | object           | New order fields                                               |
| `action.order.p`\*          | string           | New price, or `"0"` for market                                 |
| `action.order.s`\*          | string           | New total order size                                           |
| `action.order.r`            | boolean          | Optional reduce-only override                                  |
| `action.order.t`\*          | object           | Order type config; must match immutable trigger/TIF properties |
| `nonce`\*                   | number           | Replay-protection nonce                                        |
| `expiresAfter`              | number           | Optional expiration timestamp in ms                            |
| `signature`\*               | object           | EIP-712 signature                                              |

## Response

The server echoes the incoming action type:

```json theme={null}
{
  "status": "ok",
  "response": {
    "type": "batchModify",
    "data": {
      "statuses": [
        { "resting": { "oid": "0x1a2b3c..." } },
        { "pending": { "cloid": "0x4d5e6f..." } }
      ]
    }
  },
  "metadata": {
    "results": [
      {
        "oid": "0x1a2b3c...",
        "status": "confirmed",
        "orderId": "0x1a2b3c...",
        "venueOid": 12345
      },
      {
        "oid": "0x4d5e6f...",
        "status": "pending",
        "orderId": "0x4d5e6f..."
      }
    ]
  }
}
```

## Status Variants

| Response status | Meaning                                                  |
| --------------- | -------------------------------------------------------- |
| `resting.oid`   | Exchange confirmed the modify                            |
| `pending.cloid` | Modify was submitted but exchange confirmation timed out |
| `error`         | Validation or exchange failure                           |

## Example Request

```bash theme={null}
curl -X POST https://api.notional.xyz/exchange \
  -H "Content-Type: application/json" \
  -d '{
    "action": {
      "type": "modify",
      "oid": "0x1a2b3c4d5e6f7890...",
      "order": {
        "p": "50500.0",
        "s": "0.2",
        "r": false,
        "t": { "limit": { "tif": "Gtc" } }
      }
    },
    "nonce": 1701234567890,
    "signature": {
      "r": "0x1234...",
      "s": "0x5678...",
      "v": 27
    }
  }'
```

## Notes

<Note>
  * Maximum batch size is 20 modifies. - `s` is the total desired order size, not remaining size. -
    Asset, side, trigger kind, and TIF are immutable and must stay compatible with the original order.
  * Local TP/SL modifies are handled locally and must remain reduce-only; they can modify trigger
    price fields but cannot convert the order into a non-trigger order.
</Note>
