> ## 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>
