Skip to main content
Creates a Knowledge base and grants this API key the Editor role. Use the returned id to upload files, rename the Knowledge base, or share access. Personal API keys cannot create a Knowledge base.

Before You Start

  • API key scope: Requires a workspace API key with the KNOWLEDGE_FOLDER_API scope. A key that already has this scope can call this endpoint. Personal keys are refused, even with this scope. The key’s owner must have the Upload documents permission. See Share Knowledge bases with the API for setup instructions.
  • Knowledge bases: The Knowledge Folder API manages resources that appear as Knowledge bases in the Library.

Base URL

Dedicated deploymentsReplace api.langdock.com with <your-deployment-url>/api/public in all requests.

Request Format

This endpoint accepts application/json.

Request Body

Unknown fields are rejected. There is no public endpoint to delete a Knowledge base.

Examples

Create with cURL

Create with JavaScript

Response Format

Success Response (201 Created)

role is EDITOR, and fileCount is 0. You can upload, update, and delete files, rename the Knowledge base, and share access without a separate share step.

Example Response

Error Handling

A blank name, a field over 2000 characters, or an unknown field returns 400 with "Invalid request". A personal key returns 403 with "This API key cannot create knowledge folders." When the key’s owner lacks Upload documents, the response is 403 with "This API key's owner does not have permission to upload documents." A missing scope returns 403 with error INSUFFICIENT_SCOPES.
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.