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

# Update Order

> Update an existing order

# Update Order

Update an existing order's details.

<Note>Requires `write:orders` scope.</Note>

## Request

```bash theme={null}
PUT /api/v1/orders/{id}
```

### Path Parameters

<ParamField path="id" type="integer" required>
  The order ID
</ParamField>

### Body Parameters

<ParamField body="assembly_date" type="string">
  Updated assembly date (YYYY-MM-DD)
</ParamField>

<ParamField body="customer_name" type="string">
  Updated customer name
</ParamField>

<ParamField body="shipping_address" type="string">
  Updated shipping address
</ParamField>

<ParamField body="state_id" type="integer">
  New state ID
</ParamField>

## Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PUT "https://api.zenflow.com.ar/api/v1/orders/12345" \
    -H "X-API-Key: zenflow_live_your_key" \
    -H "Content-Type: application/json" \
    -d '{
      "assembly_date": "2024-01-16",
      "shipping_address": "456 New Address, City"
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch("https://api.zenflow.com.ar/api/v1/orders/12345", {
    method: "PUT",
    headers: {
      "X-API-Key": "zenflow_live_your_key",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      assembly_date: "2024-01-16",
      shipping_address: "456 New Address, City",
    }),
  });
  ```

  ```python Python theme={null}
  import requests

  response = requests.put(
      'https://api.zenflow.com.ar/api/v1/orders/12345',
      headers={'X-API-Key': 'zenflow_live_your_key'},
      json={
          'assembly_date': '2024-01-16',
          'shipping_address': '456 New Address, City'
      }
  )
  ```
</CodeGroup>

### Response

```json theme={null}
{
  "success": true,
  "data": {
    "id": 12345,
    "order_tenant_id": "ORD-001",
    "state_id": 1,
    "assembly_date": "2024-01-16",
    "customer_name": "John Doe",
    "shipping_address": "456 New Address, City",
    "updated_at": "2024-01-14T15:30:00Z"
  }
}
```

## Error Responses

### 404 Not Found

```json theme={null}
{
  "success": false,
  "error": {
    "code": "not_found",
    "message": "Order not found"
  }
}
```

### 400 Bad Request

```json theme={null}
{
  "success": false,
  "error": {
    "code": "update_error",
    "message": "Cannot update order in current state"
  }
}
```
