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

# Sharing Assistants with API Keys

> Learn how to create an API key in Langdock and share an assistant with it for programmatic access.

<Warning>
  **The Assistants API will be deprecated on 30 April.**

  For new projects, we recommend using the [Agents API](/en/developer/agents-api/agent). The Agents API provides native Vercel AI SDK compatibility and removes custom transformations.

  See the [migration guide](/en/developer/assistants-api/assistant-to-agent-migration) to learn about the differences.
</Warning>

<Info>
  An admin needs to create the API key and share the assistant with it. If you're not an admin, invite one as an editor to your assistant using the "Share" button.
</Info>

## How to create an API key

1. Navigate to [Langdock](https://app.langdock.com) and open the workspace settings from the dropdown menu.

   <img src="https://mintcdn.com/langdock-34/xJNSj-gM02ZB9j8v/images/SharingAgentsWorkspaceSettings.png?fit=max&auto=format&n=xJNSj-gM02ZB9j8v&q=85&s=bbfe7f791e45bc77762926f3c01b131d" alt="Navigate to workspace settings" width="3840" height="2160" data-path="images/SharingAgentsWorkspaceSettings.png" />

2. Click on **API** under Products in the sidebar.

   <img src="https://mintcdn.com/langdock-34/xJNSj-gM02ZB9j8v/images/SharingAgentsWorkspaceSettingAPI.png?fit=max&auto=format&n=xJNSj-gM02ZB9j8v&q=85&s=8fce5d71b09266e0c33153a2ff9e81ff" alt="Go to API settings" width="3840" height="2160" data-path="images/SharingAgentsWorkspaceSettingAPI.png" />

3. Click **Create API key**, enter a name, select the required scopes (at minimum "Agent API"), and confirm.

   <img src="https://mintcdn.com/langdock-34/xJNSj-gM02ZB9j8v/images/SharingAgentsAPIkey.png?fit=max&auto=format&n=xJNSj-gM02ZB9j8v&q=85&s=aee2f3470ce9b4cf1b19f0d2c902f340" alt="Create new API key" width="3840" height="2160" data-path="images/SharingAgentsAPIkey.png" />

4. Copy your API key and store it securely. You won't be able to view it again.

   <img src="https://mintcdn.com/langdock-34/xJNSj-gM02ZB9j8v/images/SharingAgentsSaveYourKey.png?fit=max&auto=format&n=xJNSj-gM02ZB9j8v&q=85&s=76d6ca990c28d0f2ee4cce4e277f7a3b" alt="Save your API key" width="3840" height="2160" data-path="images/SharingAgentsSaveYourKey.png" />

## How to share an assistant with the API key

1. Navigate to **Agents** in the sidebar.

   <img src="https://mintcdn.com/langdock-34/xJNSj-gM02ZB9j8v/images/SharingAgentsNavigate.png?fit=max&auto=format&n=xJNSj-gM02ZB9j8v&q=85&s=623a3f4a604b72bf8985df24635d7fca" alt="Navigate to Agents" width="3840" height="2160" data-path="images/SharingAgentsNavigate.png" />

2. Create a new assistant or select an existing one. Enter at least a name to save it.

   <img src="https://mintcdn.com/langdock-34/xJNSj-gM02ZB9j8v/images/SharingAgentsNewAgent.png?fit=max&auto=format&n=xJNSj-gM02ZB9j8v&q=85&s=ce6ee21e973f9a29ccf09db6001ce49f" alt="Create new assistant" width="3840" height="2160" data-path="images/SharingAgentsNewAgent.png" />

3. In the assistant editor, click the **Share** button in the top right corner.

   <img src="https://mintcdn.com/langdock-34/xJNSj-gM02ZB9j8v/images/SharingAgentsEditAndShare.png?fit=max&auto=format&n=xJNSj-gM02ZB9j8v&q=85&s=e0bee41f3ed210e09b449cc96cc13647" alt="Edit assistant and share" width="3840" height="2160" data-path="images/SharingAgentsEditAndShare.png" />

4. The share dialog opens showing current access settings.

   <img src="https://mintcdn.com/langdock-34/xJNSj-gM02ZB9j8v/images/SharingAgentShareAgents.png?fit=max&auto=format&n=xJNSj-gM02ZB9j8v&q=85&s=1e1e72f5018b3c0f40ae070c368b69d6" alt="Share dialog" width="3840" height="2160" data-path="images/SharingAgentShareAgents.png" />

5. Search for your API key by name and add it to share the assistant with the API.

   <img src="https://mintcdn.com/langdock-34/xJNSj-gM02ZB9j8v/images/SharingAgentsInviteAPIKey.png?fit=max&auto=format&n=xJNSj-gM02ZB9j8v&q=85&s=f6dd5e4107015f9a594d5fe8508ddae7" alt="Invite API key" width="3840" height="2160" data-path="images/SharingAgentsInviteAPIKey.png" />

<Info>
  Only admins can connect an assistant with an API key. If you don't see API keys in the share menu, ask an admin to perform this step.
</Info>

## Testing the API connection

Once shared, you can test your assistant via the [Assistant API documentation](/en/developer/assistants-api/assistant). Use your API key and the assistant ID from the URL (`https://app.langdock.com/assistants/ASSISTANT_ID/edit`).

## Migrating to Agents API

For new projects, we recommend using the Agents API instead:

* [Agent API Guide](/en/developer/agents-api/agent-api-guide) - Setup guide for the Agents API
* [Full migration guide](/en/developer/assistants-api/assistant-to-agent-migration) - Learn about the differences

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