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

# Share Knowledge bases with the API

> The following guide explains how to create an API key in Langdock and share a Knowledge base with the API key.

## Before You Start

* **API key**: An admin needs to create the API key and share the Knowledge base with the API key. Invite an admin as an editor to your Knowledge base with the "Share" button in the top right corner if you are not a Langdock admin. A workspace admin can still grant **Viewer** or **Editor** to a workspace key when the Knowledge base already allows API search.
* **Knowledge bases**: The Knowledge Folder API manages resources that appear as Knowledge bases in the Library.

## How to create an API key

1. Navigate to [Langdock](https://app.langdock.com/chat)

   ![Navigate to Langdock](https://ajeuwbhvhr.cloudimg.io/colony-recorder.s3.amazonaws.com/files/2025-01-15/348df815-6028-4264-9edf-c3776b7015c8/ascreenshot.jpeg?tl_px=0,0\&br_px=3840,2160\&force_format=jpeg\&q=100\&width=1120.0)

2. Navigate to the workspace settings.

   ![Navigate to Workspace settings](https://ajeuwbhvhr.cloudimg.io/colony-recorder.s3.amazonaws.com/files/2025-01-15/9a4155f7-9ac5-470d-9a03-ed63e61116bd/ascreenshot.jpeg?tl_px=0,0\&br_px=2102,1174\&force_format=jpeg\&q=100\&width=1120.0\&wat=1\&wat_opacity=0.7\&wat_gravity=northwest\&wat_url=https://colony-recorder.s3.us-west-1.amazonaws.com/images/watermarks/FB923C_standard.png\&wat_pad=90,81)

3. Click on "API" under products.

   ![click on API](https://ajeuwbhvhr.cloudimg.io/colony-recorder.s3.amazonaws.com/files/2025-01-15/879bb10a-4ae9-41d6-a586-6a6eae244d37/ascreenshot.jpeg?tl_px=0,0\&br_px=3840,2160\&force_format=jpeg\&q=100\&width=1120.0\&wat=1\&wat_opacity=0.7\&wat_gravity=northwest\&wat_url=https://colony-recorder.s3.us-west-1.amazonaws.com/images/watermarks/FB923C_standard.png\&wat_pad=33,393)

4. Create a new API key.

   ![Create a new API key](https://ajeuwbhvhr.cloudimg.io/colony-recorder.s3.amazonaws.com/files/2025-01-15/c88f02bb-fb8a-4491-a3fe-fe80a8323fcc/ascreenshot.jpeg?tl_px=812,423\&br_px=3840,2114\&force_format=jpeg\&q=100\&width=1120.0\&wat=1\&wat_opacity=0.7\&wat_gravity=northwest\&wat_url=https://colony-recorder.s3.us-west-1.amazonaws.com/images/watermarks/FB923C_standard.png\&wat_pad=725,277)

5. Enter a name and click "Create API key"

   ![Click on Create API key](https://ajeuwbhvhr.cloudimg.io/colony-recorder.s3.amazonaws.com/files/2025-01-15/b7b15e51-326a-4738-a550-8d05a558a61e/ascreenshot.jpeg?tl_px=941,544\&br_px=3043,1719\&force_format=jpeg\&q=100\&width=1120.0\&wat=1\&wat_opacity=0.7\&wat_gravity=northwest\&wat_url=https://colony-recorder.s3.us-west-1.amazonaws.com/images/watermarks/FB923C_standard.png\&wat_pad=693,337)

6. Copy your API Key to the clipboard.

   ![Copy the key to the clipboard](https://ajeuwbhvhr.cloudimg.io/colony-recorder.s3.amazonaws.com/files/2025-01-15/934e809c-aba3-444e-aa99-b1b5b630dcc6/user_cropped_screenshot.jpeg?tl_px=934,549\&br_px=3036,1724\&force_format=jpeg\&q=100\&width=1120.0\&wat=1\&wat_opacity=0.7\&wat_gravity=northwest\&wat_url=https://colony-recorder.s3.us-west-1.amazonaws.com/images/watermarks/FB923C_standard.png\&wat_pad=688,290)

7. Click "Done"

   ![Click on Done](https://ajeuwbhvhr.cloudimg.io/colony-recorder.s3.amazonaws.com/files/2025-01-15/ebc6997b-cc71-4fbe-b12b-241a3d837b2a/user_cropped_screenshot.jpeg?tl_px=929,502\&br_px=3031,1677\&force_format=jpeg\&q=100\&width=1120.0\&wat=1\&wat_opacity=0.7\&wat_gravity=northwest\&wat_url=https://colony-recorder.s3.us-west-1.amazonaws.com/images/watermarks/FB923C_standard.png\&wat_pad=709,374)

8. Leave the settings by clicking on "Settings" on the top left.

   ![Leave the settings](https://ajeuwbhvhr.cloudimg.io/colony-recorder.s3.amazonaws.com/files/2025-01-15/6b41e72c-0574-4c65-996b-5867ee378f78/ascreenshot.jpeg?tl_px=0,0\&br_px=1610,899\&force_format=jpeg\&q=100\&width=1120.0\&wat=1\&wat_opacity=0.7\&wat_gravity=northwest\&wat_url=https://colony-recorder.s3.us-west-1.amazonaws.com/images/watermarks/FB923C_standard.png\&wat_pad=58,21)

## How to share a Knowledge base with the API

1. Open the **Library** from the left sidebar, or go to **Settings → Workspace → Library** to manage Knowledge bases from the admin view.

2. Open the Knowledge base you want to share with the API.

3. Click **Share**.

<Info>Steps 4 to 6 are only needed if you are not a Langdock admin. If you are a Langdock admin, you can jump to step 7.</Info>

4. Click the **Add people and groups** field.

5. Type the name of an admin and select them in the dropdown.

6. Select **Editor** to give them Editor permissions for this Knowledge base, then click **Share**.

7. Ask the admin to open the Knowledge base Share dialog.

8. In the **Add people, groups and API keys** field, search for the API key and select it. The key still appears when the Knowledge base already allows API search.

9. Select the API access role. Choose **Viewer** for search access or **Editor** for upload, sharing, and rename access.

10. Click **Share**.

To grant, change, or revoke access from an Editor workspace key, use [Share Knowledge base access](/en/developer/knowledge-folder-api/share-access).

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


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