> ## 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 Agents with API Keys

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

<Info>
  This is the Agents API with native Vercel AI SDK compatibility.
</Info>

<Info>
  An admin needs to create the API key and share the agent with it. If you're not an admin, invite one as an editor to your agent 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 "Assistant 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 agent 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 agent 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 agent" width="3840" height="2160" data-path="images/SharingAgentsNewAgent.png" />

3. In the agent 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 agent 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 agent 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 agent 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 agent via the [Agent API documentation](/en/developer/agents-api/agent). Use your API key and the agent ID from the URL (`https://app.langdock.com/agents/AGENT_ID/edit`).

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

<Tip>
  **Using MCP:** You can also access your agents via the [Langdock MCP Server](/en/using-langdock/guides/integrations/mcp/langdock-agent-mcp-server). This lets MCP-compatible AI clients (like Claude Desktop or Cursor) call your agents directly.
</Tip>
