# Edit order

```
POST /api/v1/orders/edit
```

#### Operation Type (for signing)

| Header Field | Type   | Content        |
| ------------ | ------ | -------------- |
| `"type"`     | string | `"edit_order"` |

#### Request Body

<table><thead><tr><th width="188">Field</th><th width="98">Type</th><th width="95">Need</th><th>Description</th><th>Example</th></tr></thead><tbody><tr><td><code>"account"</code></td><td>string</td><td>required</td><td>User's wallet address</td><td><code>42trU9A5...</code></td></tr><tr><td><code>"signature"</code></td><td>string</td><td>required</td><td>Cryptographic signature</td><td><code>5j1Vy9Uq...</code></td></tr><tr><td><code>"timestamp"</code></td><td>integer</td><td>required</td><td>Current timestamp in milliseconds</td><td><code>1716200000000</code></td></tr><tr><td><code>"symbol"</code></td><td>string</td><td>required</td><td>Trading pair symbol</td><td><code>BTC</code></td></tr><tr><td><code>"price"</code></td><td>string</td><td>required</td><td>Order price</td><td><code>50000</code></td></tr><tr><td><code>"amount"</code></td><td>string</td><td>required</td><td>Order amount</td><td><code>0.1</code></td></tr><tr><td><code>"order_id"</code></td><td>integer</td><td>required<br>(if no CLOID)</td><td>Exchange assigned order ID</td><td><code>123456789</code></td></tr><tr><td><code>"client_order_id"</code></td><td>Full UUID string</td><td>required<br>(if no OID)</td><td>Client-defined order ID</td><td><code>f47ac10b-58cc-4372-a567-0e02b2c3d479</code></td></tr><tr><td><code>"agent_wallet"</code></td><td>string</td><td>optional</td><td>Agent wallet address</td><td><code>69trU9A5...</code></td></tr><tr><td><code>"expiry_window"</code></td><td>integer</td><td>optional</td><td>Signature expiry in milliseconds</td><td><code>30000</code></td></tr></tbody></table>

Note: You must provide either `order_id` OR `client_order_id` but not both.

```json
{
  "account": "42trU9A5...",
  "signature": "5j1Vy9Uq...",
  "timestamp": 1716200000000,
  "symbol": "BTC",
  "price": "90000",
  "amount": "0.5",
  "order_id": 123456789,
  "agent_wallet": "69trU9A5...",
  "expiry_window": 30000
}
```

#### Response

* Status 200: Order created successfully

```json
  {
    "order_id": 123498765
  }
```

* Status 400: Bad request

```json
{
  "success": false,
  "error": "Order not found",
  "code": 400
}
```

* Status 500: Internal server error

#### Code Example (Python)

```python
import requests

payload = {
    "account": "42trU9A5...",
    "signature": "5j1Vy9Uq...",
    "timestamp": 1716200000000,
    "symbol": "BTC",
    "price": "90000",
    "amount": "0.5",
    "order_id": 123456789
}

response = requests.post(
    "/api/v1/orders/edit",
    json=payload,
    headers={"Content-Type": "application/json"}
)

data = response.json()
```

**Notes:** Editing an order cancels the original and creates a new one. The new order maintains the same side, reduce-only status, and client\_order\_id (if provided), is created with TIF = ALO (Post Only), and receives a new system-assigned order\_id.

Edit order is not subject to the taker speedbump.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://pacifica.gitbook.io/docs/api-documentation/api/rest-api/orders/edit-order.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
