> For the complete documentation index, see [llms.txt](https://docs.chatcaptain.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.chatcaptain.com/api/api-dokumentation/ai-knowledge-groups.md).

# Ai knowledge Groups

## Lists all knowledge groups

> \
> \
> \*\*Required Permission:\*\* \`chatbots.knowledge-source.list\`\
> \
> \*\*Resource:\*\* \`chatbots/:chatbotId\`

```json
{"openapi":"3.0.0","info":{"title":"ChatCaptain API","version":"1.0"},"tags":[{"name":"Ai knowledge-groups","description":""}],"servers":[{"url":"https://api.chatcaptain.com","description":"Production"}],"security":[{},{}],"paths":{"/v1/chatbots/{chatbotId}/ai/knowledge/groups":{"get":{"operationId":"AiKnowledgeGroupController_listKnowledgeGroups[1]_v1","parameters":[{"name":"chatbotId","required":true,"in":"path","description":"The ID of the chatbot.","schema":{"type":"string"}},{"name":"pageToken","required":false,"in":"query","description":"The date after which to filter groups. Only groups created after this date will be fetched.","schema":{"type":"string"}},{"name":"limit","required":false,"in":"query","description":"The limit for how many groups should be fetched.","schema":{"type":"number"}}],"responses":{"200":{"description":"List of all knowledge groups.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListKnowledgeGroupsResponseDto"}}}},"401":{"description":"Not authenticated."}},"summary":"Lists all knowledge groups","tags":["Ai knowledge-groups"],"description":"\n\n**Required Permission:** `chatbots.knowledge-source.list`\n\n**Resource:** `chatbots/:chatbotId`"}}},"components":{"schemas":{"ListKnowledgeGroupsResponseDto":{"type":"object","properties":{"groups":{"description":"A list of groups.","type":"array","items":{"$ref":"#/components/schemas/KnowledgeGroupDto"}},"error":{"type":"string","description":"Optional error message."},"pageToken":{"type":"string","description":"The date of the latest fetched group."}},"required":["groups","pageToken"]},"KnowledgeGroupDto":{"type":"object","properties":{"id":{"type":"string","description":"Unique ID of the knowledge group."},"name":{"type":"string","description":"Name of the knowledge group."},"created":{"type":"string","description":"Creation timestamp (ISO format)."},"systemDefault":{"type":"boolean","description":"Indicates whether this is a system-created default group."},"sourceIds":{"description":"List of source IDs assigned to this group.","type":"array","items":{"type":"string"}}},"required":["id","name","created","systemDefault","sourceIds"]}}}}
```

## Creates a new knowledge group

> \
> \
> \*\*Required Permission:\*\* \`chatbots.knowledge-source.create\`\
> \
> \*\*Resource:\*\* \`chatbots/:chatbotId\`

```json
{"openapi":"3.0.0","info":{"title":"ChatCaptain API","version":"1.0"},"tags":[{"name":"Ai knowledge-groups","description":""}],"servers":[{"url":"https://api.chatcaptain.com","description":"Production"}],"security":[{},{}],"paths":{"/v1/chatbots/{chatbotId}/ai/knowledge/groups":{"post":{"operationId":"AiKnowledgeGroupController_createKnowledgeGroup[1]_v1","parameters":[{"name":"chatbotId","required":true,"in":"path","description":"The ID of the chatbot.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateKnowledgeGroupRequestDto"}}}},"responses":{"201":{"description":"Knowledge group created successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeGroupResponseDto"}}}},"400":{"description":"Invalid input data."},"401":{"description":"Not authenticated."}},"summary":"Creates a new knowledge group","tags":["Ai knowledge-groups"],"description":"\n\n**Required Permission:** `chatbots.knowledge-source.create`\n\n**Resource:** `chatbots/:chatbotId`"}}},"components":{"schemas":{"CreateKnowledgeGroupRequestDto":{"type":"object","properties":{"name":{"type":"string","description":"Name of the new knowledge group."}},"required":["name"]},"KnowledgeGroupResponseDto":{"type":"object","properties":{"group":{"description":"A knowledge group containing knowledge sources.","nullable":true,"allOf":[{"$ref":"#/components/schemas/KnowledgeGroupDto"}]},"error":{"type":"string","description":"Optional error message."}},"required":["group"]},"KnowledgeGroupDto":{"type":"object","properties":{"id":{"type":"string","description":"Unique ID of the knowledge group."},"name":{"type":"string","description":"Name of the knowledge group."},"created":{"type":"string","description":"Creation timestamp (ISO format)."},"systemDefault":{"type":"boolean","description":"Indicates whether this is a system-created default group."},"sourceIds":{"description":"List of source IDs assigned to this group.","type":"array","items":{"type":"string"}}},"required":["id","name","created","systemDefault","sourceIds"]}}}}
```

## Retrieves a specific knowledge group

> \
> \
> \*\*Required Permission:\*\* \`chatbots.knowledge-source.get\`\
> \
> \*\*Resource:\*\* \`chatbots/:chatbotId\`

```json
{"openapi":"3.0.0","info":{"title":"ChatCaptain API","version":"1.0"},"tags":[{"name":"Ai knowledge-groups","description":""}],"servers":[{"url":"https://api.chatcaptain.com","description":"Production"}],"security":[{},{}],"paths":{"/v1/chatbots/{chatbotId}/ai/knowledge/groups/{groupId}":{"get":{"operationId":"AiKnowledgeGroupController_getKnowledgeGroups[1]_v1","parameters":[{"name":"chatbotId","required":true,"in":"path","description":"The ID of the chatbot.","schema":{"type":"string"}},{"name":"groupId","required":true,"in":"path","description":"The ID of the knowledge group to retrieve.","schema":{"type":"string"}}],"responses":{"200":{"description":"Knowledge group details.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeGroupResponseDto"}}}},"401":{"description":"Not authenticated."}},"summary":"Retrieves a specific knowledge group","tags":["Ai knowledge-groups"],"description":"\n\n**Required Permission:** `chatbots.knowledge-source.get`\n\n**Resource:** `chatbots/:chatbotId`"}}},"components":{"schemas":{"KnowledgeGroupResponseDto":{"type":"object","properties":{"group":{"description":"A knowledge group containing knowledge sources.","nullable":true,"allOf":[{"$ref":"#/components/schemas/KnowledgeGroupDto"}]},"error":{"type":"string","description":"Optional error message."}},"required":["group"]},"KnowledgeGroupDto":{"type":"object","properties":{"id":{"type":"string","description":"Unique ID of the knowledge group."},"name":{"type":"string","description":"Name of the knowledge group."},"created":{"type":"string","description":"Creation timestamp (ISO format)."},"systemDefault":{"type":"boolean","description":"Indicates whether this is a system-created default group."},"sourceIds":{"description":"List of source IDs assigned to this group.","type":"array","items":{"type":"string"}}},"required":["id","name","created","systemDefault","sourceIds"]}}}}
```

## Deletes a knowledge group

> \
> \
> \*\*Required Permission:\*\* \`chatbots.knowledge-source.delete\`\
> \
> \*\*Resource:\*\* \`chatbots/:chatbotId\`

```json
{"openapi":"3.0.0","info":{"title":"ChatCaptain API","version":"1.0"},"tags":[{"name":"Ai knowledge-groups","description":""}],"servers":[{"url":"https://api.chatcaptain.com","description":"Production"}],"security":[{},{}],"paths":{"/v1/chatbots/{chatbotId}/ai/knowledge/groups/{groupId}":{"delete":{"operationId":"AiKnowledgeGroupController_deleteKnowledgeSource[1]_v1","parameters":[{"name":"chatbotId","required":true,"in":"path","description":"The ID of the chatbot.","schema":{"type":"string"}},{"name":"groupId","required":true,"in":"path","description":"The ID of the knowledge group to delete.","schema":{"type":"string"}}],"responses":{"200":{"description":"Knowledge group deleted successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeleteKnowledgeGroupResponseDto"}}}},"401":{"description":"Not authenticated."},"403":{"description":"Insufficient permissions."}},"summary":"Deletes a knowledge group","tags":["Ai knowledge-groups"],"description":"\n\n**Required Permission:** `chatbots.knowledge-source.delete`\n\n**Resource:** `chatbots/:chatbotId`"}}},"components":{"schemas":{"DeleteKnowledgeGroupResponseDto":{"type":"object","properties":{"error":{"type":"string","description":"Optional error message."}}}}}}
```

## Updates an existing knowledge group

> \
> \
> \*\*Required Permission:\*\* \`chatbots.knowledge-source.edit\`\
> \
> \*\*Resource:\*\* \`chatbots/:chatbotId\`

```json
{"openapi":"3.0.0","info":{"title":"ChatCaptain API","version":"1.0"},"tags":[{"name":"Ai knowledge-groups","description":""}],"servers":[{"url":"https://api.chatcaptain.com","description":"Production"}],"security":[{},{}],"paths":{"/v1/chatbots/{chatbotId}/ai/knowledge/groups/{groupId}":{"patch":{"operationId":"AiKnowledgeGroupController_updateKnowledgeGroup[1]_v1","parameters":[{"name":"chatbotId","required":true,"in":"path","description":"The ID of the chatbot.","schema":{"type":"string"}},{"name":"groupId","required":true,"in":"path","description":"The ID of the knowledge group to update.","schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateKnowledgeGroupRequestDto"}}}},"responses":{"200":{"description":"Knowledge group updated successfully.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/KnowledgeGroupResponseDto"}}}},"400":{"description":"Invalid input data."},"401":{"description":"Not authenticated."}},"summary":"Updates an existing knowledge group","tags":["Ai knowledge-groups"],"description":"\n\n**Required Permission:** `chatbots.knowledge-source.edit`\n\n**Resource:** `chatbots/:chatbotId`"}}},"components":{"schemas":{"UpdateKnowledgeGroupRequestDto":{"type":"object","properties":{"updated":{"description":"Object containing the knowledge group fields to update.","nullable":true,"allOf":[{"$ref":"#/components/schemas/UpdateKnowledgeGroupDto"}]}},"required":["updated"]},"UpdateKnowledgeGroupDto":{"type":"object","properties":{"name":{"type":"string","description":"Optional new name of the knowledge group."},"sourceIds":{"description":"List of source IDs that should be linked to the knowledge group.","type":"array","items":{"type":"string"}}},"required":["sourceIds"]},"KnowledgeGroupResponseDto":{"type":"object","properties":{"group":{"description":"A knowledge group containing knowledge sources.","nullable":true,"allOf":[{"$ref":"#/components/schemas/KnowledgeGroupDto"}]},"error":{"type":"string","description":"Optional error message."}},"required":["group"]},"KnowledgeGroupDto":{"type":"object","properties":{"id":{"type":"string","description":"Unique ID of the knowledge group."},"name":{"type":"string","description":"Name of the knowledge group."},"created":{"type":"string","description":"Creation timestamp (ISO format)."},"systemDefault":{"type":"boolean","description":"Indicates whether this is a system-created default group."},"sourceIds":{"description":"List of source IDs assigned to this group.","type":"array","items":{"type":"string"}}},"required":["id","name","created","systemDefault","sourceIds"]}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.chatcaptain.com/api/api-dokumentation/ai-knowledge-groups.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
