## Rename or move a folder (tenant:dms:write)

`PATCH /api/dms/v1/folders/{id}`

Module: DMS · operationId: `updateFolder` · Tag: Folders · Auth: access token (`Authorization: Bearer <accessToken>`)

Changes `name` and/or `parentId` (`null` = top level; absent = unchanged) at the folder's
`version`. A folder cannot be moved into itself or one of its subfolders (`422`), nor deeper
than 10 levels. `409` when the version is stale or a sibling has the name.

### Parameters

| Name | In | Type | Required | Description |
|---|---|---|---|---|
| `id` | path | string (uuid) | yes |  |

### Request body

`application/json` (required)

- `version` (integer, required): The version the change is based on
- `name` (string): New name; omitted keeps it (max length 255)
- `parentId` (string (uuid), nullable): New parent; `null` = top level; omitted = unchanged

Example:

```json
{
  "name": "Eingangsrechnungen",
  "version": 3
}
```

### Responses

- **200** The folder (`application/json`)
- **400** Error (`application/json`)
- **404** Error (`application/json`)
- **409** Error (`application/json`)

Fields of the 200 answer:

- `access` (string, required): What the caller may do in the folder (one of `READ`, `WRITE`)
- `createdAt` (string (date-time), required): Creation time
- `createdBy` (string, required): Who created the folder
- `documentCount` (integer, required): Documents directly in the folder (not in subfolders)
- `id` (string (uuid), required): Folder id
- `name` (string, required): Folder name, unique among its siblings (max length 255)
- `parentId` (string (uuid), nullable, required): `null` for a top-level folder
- `restricted` (boolean, required): The folder or a folder above it limits who may use it
- `updatedAt` (string (date-time), required): Time of the last change
- `version` (integer, required): Increases with every change; send it with `updateFolder`

Example 200 answer:

```json
{
  "access": "WRITE",
  "createdAt": "2026-01-02T08:00:00Z",
  "createdBy": "laura.kaestner@muster-it.example",
  "documentCount": 42,
  "id": "3b1f6a2c-7d4e-4f1a-9c2b-8e5d0a1f7b63",
  "name": "Eingangsrechnungen 2026",
  "parentId": "1d3f5a7c-9e1b-4d3f-8a5c-7e9b1d3f5a7c",
  "restricted": true,
  "updatedAt": "2026-06-15T10:12:00Z",
  "version": 3
}
```

### Example request

```bash
curl -X PATCH 'https://api.mbcom.cloud/api/dms/v1/folders/3f2b8c1e-7d4a-4e9b-9c2a-5b1d6e8f0a12' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  --data '{"name":"Eingangsrechnungen","version":3}'
```
