> ## 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.

# Actualizar Pedido

> Actualizar un pedido existente

# Actualizar Pedido

Actualiza los detalles de un pedido existente.

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

## Solicitud

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

### Parámetros de Ruta

<ParamField path="id" type="integer" required>
  El ID del pedido
</ParamField>

### Parámetros del Body

<ParamField body="assembly_date" type="string">
  Fecha de ensamblaje actualizada (YYYY-MM-DD)
</ParamField>

<ParamField body="customer_name" type="string">
  Nombre del cliente actualizado
</ParamField>

<ParamField body="shipping_address" type="string">
  Dirección de envío actualizada
</ParamField>

<ParamField body="state_id" type="integer">
  Nuevo ID de estado
</ParamField>

## Ejemplo

<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": "Av. Santa Fe 5678, CABA"
    }'
  ```

  ```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: "Av. Santa Fe 5678, CABA",
    }),
  });
  ```

  ```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': 'Av. Santa Fe 5678, CABA'
      }
  )
  ```
</CodeGroup>

### Respuesta

```json theme={null}
{
  "success": true,
  "data": {
    "id": 12345,
    "order_tenant_id": "ORD-001",
    "state_id": 1,
    "assembly_date": "2024-01-16",
    "customer_name": "Juan Pérez",
    "shipping_address": "Av. Santa Fe 5678, CABA",
    "updated_at": "2024-01-14T15:30:00Z"
  }
}
```

## Respuestas de Error

### 404 No Encontrado

```json theme={null}
{
  "success": false,
  "error": {
    "code": "not_found",
    "message": "Pedido no encontrado"
  }
}
```

### 400 Solicitud Incorrecta

```json theme={null}
{
  "success": false,
  "error": {
    "code": "update_error",
    "message": "No se puede actualizar el pedido en el estado actual"
  }
}
```
