## Create a folder (tenant:dms:write)

`POST /api/dms/v1/folders`

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

Without `parentId` the folder is a top-level folder. Names are unique among siblings (ignoring case, `409`), at most 255 characters, without `/`, `\` and control characters.

### Request body

`application/json` (required)

- `name` (string, required): Folder name, unique among its siblings (max length 255)
- `parentId` (string (uuid), nullable): Parent folder; omitted or `null` = top level

Example:

```json
{
  "name": "Rechnungen 2026",
  "parentId": "3b1f6a2c-7d4e-4f1a-9c2b-8e5d0a1f7b63"
}
```

### Responses

- **201** Created (`application/json`)
- **400** Error (`application/json`)
- **409** Error (`application/json`)

Fields of the 201 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 201 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 POST 'https://api.mbcom.cloud/api/dms/v1/folders' \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H 'Content-Type: application/json' \
  --data '{"name":"Rechnungen 2026","parentId":"3b1f6a2c-7d4e-4f1a-9c2b-8e5d0a1f7b63"}'
```
