Skip to main content
POST
Grant Knowledge base access to people or workspace API keys
Grants, changes, or revokes access on an existing Knowledge base. Targets are people and workspace API keys. Groups stay on the in-app Share Knowledge bases with the API flow.

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 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.

Roles

A Viewer-only key, including a key that only has API search through the Knowledge base, cannot call these endpoints. An Editor workspace key can grant other qualifying workspace keys even if the key owner is not a workspace admin. The in-app Share dialog still lists API keys only for workspace admins.

Grant access

POST /knowledge/{folderId}/access

Path Parameters

Request Body

All IDs must resolve to a human workspace member or a qualifying workspace API key. Group IDs are not accepted. Personal API keys are not eligible. If any ID is missing or ineligible, the request fails and no grants are written.

Grant with cURL

Grant with JavaScript

Success Response (200 OK)

Change a role

PATCH /knowledge/{folderId}/access You cannot change the Knowledge base owner’s access. Reassign ownership in the Library first. If the target has no grant yet, this request creates one.

Revoke access

DELETE /knowledge/{folderId}/access You cannot revoke the Knowledge base owner’s access.

Error Handling

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.

Authorizations

Authorization
string
header
required

API key as Bearer token. Format "Bearer YOUR_API_KEY"

Path Parameters

folderId
string
required

The ID of the knowledge folder

Body

application/json
targetIds
string<uuid>[]
required
Required array length: 1 - 100 elements
role
enum<string>
required
Available options:
USER,
EDITOR

Response

200

Access granted successfully