Sharing Agents with API Keys
Learn how to create an API key in ajan and share an agent with it for programmatic access.
Before You Start
- API key: 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.
- Agents API: This is the Agents API with native Vercel AI SDK compatibility.
How to create an API key
- Navigate to ajan and open the workspace settings from the dropdown menu.
- Click on API under Products in the sidebar.
- Click Create API key, enter a name, select the required scopes (at minimum "Assistant API"), and confirm.
- Copy your API key and store it securely. You won't be able to view it again.
How to share an agent with the API key
- Navigate to Agents in the sidebar.
- Create a new agent or select an existing one. For a new agent, the Agent Builder chat opens. Describe the agent in natural language or click Go to editor to configure it manually in the agent editor.
- In the agent editor, click the Share button in the top right corner.
- The share dialog opens showing current access settings.
- Search for your API key by name and add it to share the agent with the API.
Testing the API connection
Once shared, you can test your agent via the Agent API documentation. Use your API key and the agent ID from the URL (https://app.ajan.com/agents/AGENT_ID/edit).