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

# createKnowledgeChunk

## Syntax

`api.createKnowledgeChunk(params)`

## Description

Creates a [Knowledge Chunk](https://docs-classic.cognigy.com/ai/agents/develop/knowledge-ai/knowledge-chunk/knowledge-chunk) in a [Knowledge Source](https://docs-classic.cognigy.com/ai/agents/develop/knowledge-ai/knowledge-source/overview). A Knowledge Chunk is a discrete piece of knowledge containing text and optional Chunk metadata that can be searched and retrieved during AI Agent interactions.

**Parameters:**

* `params`: `CreateKnowledgeChunkParams` — configuration object for the Knowledge Chunk. The object contains the following parameters:

| Parameter | Type | Required | Description |
| - | - | - | - |
| `knowledgeSourceId` | String | Yes | The ID of the Knowledge Source. |
| `text` | String | Yes | The content of the Knowledge Chunk. |
| `data` | Object | No | Metadata for the chunk. An object where keys are strings and values can be strings, numbers, or booleans. |

**Returns:** `Promise<{}>` — a promise that resolves to an empty object when the Knowledge Chunk is created.

## Example

```js theme={null}
await api.createKnowledgeChunk({
    knowledgeSourceId: "ks_abc123def456",
    text: "To reset your password, click 'Forgot Password' on the login page and follow the instructions sent to your email.",
    data: {
        category: "account-management",
        priority: 5,
        lastUpdated: "2025-11-01",
        verified: true
    }
});
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.