> ## Documentation Index
> Fetch the complete documentation index at: https://docs.caret.so/llms.txt
> Use this file to discover all available pages before exploring further.

# 폴더 생성

> 워크스페이스에 새 폴더를 생성합니다

### Body

<ParamField body="name" type="string" required>
  폴더 이름
</ParamField>

<ParamField body="ownerUserId" type="string" required>
  폴더 소유자의 사용자 ID
</ParamField>

<ParamField body="icon" type="string">
  폴더 아이콘
</ParamField>

<ParamField body="color" type="string">
  폴더 색상
</ParamField>

<ParamField body="isPrivate" type="boolean">
  폴더가 비공개인지 여부
</ParamField>

<ParamField body="parentFolderId" type="string">
  상위 폴더 ID
</ParamField>

### 응답

<ResponseField name="folder" type="Folder">
  <Expandable title="Folder">
    <ResponseField name="id" type="string">
      폴더의 고유 식별자
    </ResponseField>

    <ResponseField name="name" type="string">
      폴더 이름
    </ResponseField>

    <ResponseField name="icon" type="string | null">
      폴더 아이콘
    </ResponseField>

    <ResponseField name="parentFolderId" type="string | null">
      상위 폴더 ID (루트 폴더인 경우 null)
    </ResponseField>

    <ResponseField name="createdAt" type="string">
      폴더가 생성된 ISO8601 타임스탬프
    </ResponseField>
  </Expandable>
</ResponseField>

<RequestExample>
  ```bash curl theme={null}

  curl --request POST \
   --url https://api.caret.so/v1/folders \
   --header 'Authorization: Bearer <your_api_key>' \
   --header 'Content-Type: application/json' \
   --data '{
  "name": "Project Alpha",
  "ownerUserId": "usr_123456789",
  "icon": "📁",
  "color": "#4A90E2",
  "isPrivate": false
  }'

  ```
</RequestExample>

<ResponseExample>
  ```json 200 OK theme={null}
  {
    "folder": {
      "id": "fld_123456789",
      "name": "Project Alpha",
      "icon": "📁",
      "parentFolderId": null,
      "createdAt": "2024-01-28T12:00:00Z"
    }
  }
  ```

  ```json 400 Bad Request theme={null}
  {
    "error": {
      "code": "bad_request",
      "message": "Name is required"
    }
  }
  ```

  ```json 401 Unauthorized theme={null}
  {
    "error": {
      "code": "unauthorized",
      "message": "Invalid or missing API key"
    }
  }
  ```

  ```json 500 Internal Server Error theme={null}
  {
    "error": {
      "code": "internal_server_error",
      "message": "Failed to create folder"
    }
  }
  ```
</ResponseExample>
