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

# Knowledge Base

### **Create Knowledge Base**

* **Endpoint:** `POST /knowledge-base`
* **Description:** Create a new knowledge base from a set of documents.
* **Request Body:**
  * `documentIds`: Array of document IDs to include in the knowledge base.
* **Response:** Knowledge base object containing knowledge base details.

{% tabs %}
{% tab title="Request" %}

```bash
curl -X POST
-H "Authorization: Bearer your_api_key_here"
-H "Content-Type: application/json"
-d '{"documentIds": ["abc123", "def456"]}'
https://api.pagepeek.com/v1/knowledge-base
```

{% endtab %}

{% tab title="Response" %}

```json
{
    "kb_id": "kb123",
    "documentIds": ["abc123", "def456"],
    "createdAt": "2023-10-01T12:00:00Z",
    "updatedAt": "2023-10-01T12:00:00Z"
}
```

{% endtab %}
{% endtabs %}

### **Get Knowledge Base**

* **Endpoint:** `GET /knowledge-base/:kb_id`
* **Description:** Retrieve the details of a specific knowledge base.
* **Response:** Knowledge base object containing knowledge base details.

{% tabs %}
{% tab title="Request" %}

```bash
curl -X GET \
     -H "Authorization: Bearer your_api_key_here" \
     https://api.pagepeek.com/v1/knowledge-base/kb123
```

{% endtab %}

{% tab title="Response" %}

```json
{
    "kb_id": "kb123",
    "documentIds": ["abc123", "def456"],
    "createdAt": "2023-10-01T12:00:00Z",
    "updatedAt": "2023-10-01T12:00:00Z"
}
```

{% endtab %}
{% endtabs %}

### **Update Knowledge Base**

* **Endpoint:** `PUT /knowledge-base/:kb_id`
* **Description:** Update an existing knowledge base.
* **Request Body:**
  * `documentIds`: Updated array of document IDs.
* **Response:** Knowledge base object containing updated knowledge base details.

{% tabs %}
{% tab title="Request" %}

```bash
curl -X PUT \
     -H "Authorization: Bearer your_api_key_here" \
     -H "Content-Type: application/json" \
     -d '{"documentIds": ["abc123", "def456", "ghi789"]}' \
     https://api.pagepeek.com/v1/knowledge-base/kb123
```

{% endtab %}

{% tab title="Response" %}

```json
{
    "kb_id": "kb123",
    "documentIds": ["abc123", "def456", "ghi789"],
    "updatedAt": "2023-10-02T12:00:00Z"
}
```

{% endtab %}
{% endtabs %}
