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

# Update Knowledge base

> Rename a Knowledge base or update its description

Updates the name or description of an existing Knowledge base. This is not the file replace route. To replace a file, use [Update a file](/en/developer/knowledge-folder-api/update-attachment).

## Before You Start

* **API key scope**: Requires an API key with the `KNOWLEDGE_FOLDER_API` scope. The API key itself needs the Editor role on the Knowledge base. See [Share Knowledge bases with the API](/en/developer/knowledge-folder-api/sharing) for setup instructions.
* **Knowledge bases**: The Knowledge Folder API manages resources that appear as Knowledge bases in the Library.

## Base URL

```
https://api.langdock.com
```

<Warning>
  **Dedicated deployments**

  Replace `api.langdock.com` with `<your-deployment-url>/api/public` in all requests.
</Warning>

## Request Format

This endpoint accepts `application/json`.

### Path Parameters

| Parameter  | Type   | Required | Description                  |
| ---------- | ------ | -------- | ---------------------------- |
| `folderId` | string | Yes      | The ID of the Knowledge base |

### Request Body

| Field         | Type   | Required | Description                               |
| ------------- | ------ | -------- | ----------------------------------------- |
| `name`        | string | No       | New name. Cannot be empty after trimming. |
| `description` | string | No       | New description.                          |

Include at least one field. There is no public endpoint to create or delete a Knowledge base.

## Examples

### Update with cURL

```bash theme={null}
curl -X PATCH "https://api.langdock.com/knowledge/{folderId}/folder" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Product handbook",
    "description": "Internal product documentation"
  }'
```

### Update with JavaScript

```javascript theme={null}
const axios = require("axios");

async function updateKnowledgeBase(folderId, data) {
  const response = await axios.patch(
    `https://api.langdock.com/knowledge/${folderId}/folder`,
    data,
    {
      headers: {
        Authorization: "Bearer YOUR_API_KEY",
        "Content-Type": "application/json",
      },
    }
  );

  return response.data;
}

const result = await updateKnowledgeBase(
  "550e8400-e29b-41d4-a716-446655440000",
  { name: "Product handbook" }
);
console.log("Updated:", result.result.name);
```

## Response Format

### Success Response (200 OK)

```typescript theme={null}
{
  status: "success";
  result: {
    id: string;
    name: string;
    description: string | null;
    createdAt: string;
    updatedAt: string;
  };
}
```

### Example Response

```json theme={null}
{
  "status": "success",
  "result": {
    "id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "Product handbook",
    "description": "Internal product documentation",
    "createdAt": "2026-08-12T09:15:00.000Z",
    "updatedAt": "2026-09-01T10:22:00.000Z"
  }
}
```

## Error Handling

| Status | Meaning                                                                               |
| ------ | ------------------------------------------------------------------------------------- |
| `400`  | Invalid body, empty name, or no fields provided                                       |
| `401`  | Invalid or missing API key                                                            |
| `403`  | Missing `KNOWLEDGE_FOLDER_API` scope, or the key is not Editor on this Knowledge base |
| `404`  | Knowledge base not found                                                              |
| `429`  | Rate limit exceeded                                                                   |
| `500`  | Unexpected server error                                                               |

<Info>
  Langdock intentionally blocks browser-origin requests to protect your API key and ensure your applications remain secure. For more information, please see our guide on [API Key Best Practices](/en/admin/ai-adoption-and-rollout/best-practices/api-key-best-practices).
</Info>


## OpenAPI

````yaml patch /knowledge/{folderId}/folder
openapi: 3.0.0
info:
  title: Langdock API
  version: 3.0.0
servers:
  - url: https://api.langdock.com
    description: Production
security:
  - bearerAuth: []
paths:
  /knowledge/{folderId}/folder:
    patch:
      summary: Update a Knowledge base name or description
      parameters:
        - name: folderId
          in: path
          required: true
          description: The ID of the knowledge folder
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                description:
                  type: string
      responses:
        '200':
          description: Knowledge base updated successfully
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: API key as Bearer token. Format "Bearer YOUR_API_KEY"

````