# UPDATE Cases

### PUT /`api/v1/cases/:uuid`

Updates an existing case identified by UUID.

#### Path Params

| Name   | Type     | Required | Description             |
| ------ | -------- | -------- | ----------------------- |
| `uuid` | `string` | **Yes**  | UUID of case to update. |

#### Body Params

Only these fields are accepted (unknown fields return `400`):

| Name               | Type      | Required | Validation / Notes                                  |
| ------------------ | --------- | -------- | --------------------------------------------------- |
| `case_name`        | `string`  | No       | Max `255`, cannot contain \`+ < > : " / \\          |
| `case_number`      | `string`  | No       | Max `255`, same character restrictions              |
| `description`      | `string`  | No       | Max `2000`                                          |
| `status`           | `string`  | No       | Max `255`                                           |
| `type`             | `string`  | No       | Max `255`                                           |
| `case_lead_id`     | `integer` | No       | Positive integer                                    |
| `client_id`        | `integer` | No       | Positive integer                                    |
| `case_open_date`   | `string`  | No       | Must be strict `YYYY-MM-DD` and valid calendar date |
| `case_closed_date` | `string`  | No       | Must be strict `YYYY-MM-DD` and valid calendar date |

#### Success Response (200)

```json
{
  "success": true,
  "message": "Case updated successfully",
  "case_id": 123
}
```

#### Error Responses

* `400` validation error:

```json
{
  "message": "Invalid case data",
  "success": false,
  "errors": [
    { "message": "Invalid date format for case_open_date, must be YYYY-MM-DD" }
  ]
}
```

* `400` when UUID does not resolve to a case:

```json
{
  "message": "Case not found",
  "success": false
}
```

* `500` server error:

```json
{
  "message": "Error updating case",
  "success": false
}
```

#### Example

```bash
curl -X PUT "https://<host>/v1/cases/<case-uuid>" \
  -H "Content-Type: application/json" \
  -H "x-api-key: <api-key>" \
  -d '{
    "case_name": "Updated Case Name",
    "description": "Updated synopsis",
    "status": "Closed",
    "type": "Investigation",
    "case_closed_date": "2026-02-25"
  }'
```
