# Create Doc Folder

`POST /api/v1/docs/folders`

## Description
Create a folder for organizing workspace docs. Pass `parentId` to nest the new folder under an existing one, or omit (or null) to create at the top level. Auto-suffixes the name on sibling collisions up to 100 attempts; beyond that returns 409.

## Request Body

```json
{
  "type": "object",
  "required": [
    "workspaceId",
    "name"
  ],
  "properties": {
    "workspaceId": {
      "type": "string",
      "description": "Target workspace."
    },
    "name": {
      "type": "string",
      "minLength": 1,
      "maxLength": 200,
      "description": "Folder display name."
    },
    "parentId": {
      "type": [
        "string",
        "null"
      ],
      "description": "Optional parent folder id."
    }
  }
}
```

## Responses

### 201 — Folder created.

```json
{
  "type": "object",
  "properties": {
    "success": {
      "type": "boolean",
      "enum": [
        true
      ]
    },
    "data": {
      "type": "object",
      "properties": {
        "folder": {
          "type": "object",
          "description": "A workspace folder used to organize docs.",
          "properties": {
            "id": {
              "type": "string",
              "description": "Folder ID."
            },
            "workspaceId": {
              "type": "string",
              "description": "Owning workspace ID."
            },
            "parentId": {
              "type": [
                "string",
                "null"
              ],
              "description": "Parent folder ID, or null for top-level."
            },
            "name": {
              "type": "string",
              "description": "Display name."
            },
            "isSystem": {
              "type": "boolean",
              "description": "Whether this is a system-managed folder."
            },
            "sortOrder": {
              "type": "integer",
              "description": "Display sort order."
            },
            "color": {
              "type": [
                "string",
                "null"
              ],
              "description": "Optional accent color."
            },
            "createdBy": {
              "type": [
                "string",
                "null"
              ],
              "description": "User ID of the creator."
            },
            "createdAt": {
              "type": "string",
              "format": "date-time"
            },
            "updatedAt": {
              "type": "string",
              "format": "date-time"
            }
          },
          "required": [
            "id",
            "workspaceId",
            "parentId",
            "name",
            "isSystem",
            "sortOrder",
            "createdAt",
            "updatedAt"
          ]
        }
      },
      "required": [
        "folder"
      ]
    }
  },
  "required": [
    "success",
    "data"
  ]
}
```

### 400 — Validation failed or parent folder not found.

### 403 — Caller lacks write permission on the workspace.

### 409 — Name collision after 100 auto-suffix attempts.

### 500 — Internal error.
