API Keys

Generate and manage API keys for programmatic access.

API keys enable programmatic access to your agents. Use them to integrate Agentkit into your applications or connect third-party services.

Creating keys and using the API require a Hobby plan or above with active billing. Workspace members can still view and revoke existing keys after losing that entitlement. Upgrade your plan →

Creating an API Key

  1. Go to your workspace
  2. Click API Keys in the sidebar
  3. Click Create API key
  4. Confirm in the dialog

The new key appears in the list and can be revealed or copied at any time.

Viewing and Copying Keys

Each key in the list is masked by default. Use the eye icon to reveal a key and the copy icon to copy it to your clipboard.

Using API Keys

Include the key in API requests:

curl -X POST 'https://your-domain.com/api/v1/chat' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -H 'Content-Type: application/json' \
  -d '{"chatbotId": "uuid", "messages": [{"role": "user", "content": "Hello"}]}'

Full API documentation →

Managing Keys

View All Keys

All keys for the workspace are listed on the API Keys page.

Delete a Key

  1. Find the key in the list
  2. Click the trash icon
  3. Confirm deletion

Deleted keys stop working immediately.

Revoking keys after access expires

If your workspace loses API access, sign in and delete unneeded keys from its API Keys page. You do not need to renew billing to revoke them. You must still be a workspace member. If you have MFA enabled, complete the MFA check before managing keys. Until you do, the database hides the workspace's keys and rejects deletion. This does not restore API use or permission to create keys.

Agentkit previously checked the paid API entitlement before deleting a key. Its database policies also required that entitlement to read or delete keys. Losing access could therefore block cleanup of an existing credential.

The correction separates creation from cleanup. Workspace membership governs reading and deleting existing keys, with MFA enforced by a separate database policy. Creating and updating keys still require API entitlement. The delete action matches both the key ID and workspace ID, and reports success only when the database returns a deleted row.

This simplified example describes the guard change:

Before
  Require API entitlement before deleting an existing key.

After
  Delete only a key belonging to the requested workspace.
  Require a returned deleted row before reporting success.
  Keep membership checks and enforce MFA in the database.

The application tests mock the database client. They check filters and result handling, not database policies. The SQL tests use synthetic accounts and roll back. Their expected outcomes include:

CheckTest layerExpected outcome
Authorized member revokes without API entitlementApplication mockNo entitlement query; key and workspace filters; success requires a returned row
Authorized member revokes without API entitlementSQLOne own-workspace key deleted
Member creates a key without entitlementApplication mock and SQLRejected
Member tries to delete another workspace's keySQLNo row deleted
Required MFA is not satisfiedSQLNo row deleted
Requested key is missing or invisible to the callerApplication mockAction reports failure

These are the regression expectations, not results from a production trial. Apply the same test pattern to temporary credentials in agent workflows. Change access before teardown, then check both successful authorized cleanup and rejected unauthorized cleanup.

Security Best Practices

Never Expose Keys

  • Don't commit keys to git repositories
  • Don't include keys in client-side code
  • Use environment variables

Rotate Keys Periodically

  • Create new keys periodically
  • Update your applications
  • Delete old keys

Use Separate Keys

Create different keys for:

  • Production vs. development
  • Different applications
  • Different team members or services

Key Scope

API keys are scoped to the workspace they're created in and have access to:

  • All agents in the workspace
  • Chat API endpoints
  • Webhook management

Keys cannot:

  • Manage team members
  • Access billing
  • Create other API keys

Zapier Connection

When connecting to Zapier:

  1. Create a dedicated API key for Zapier
  2. Use this key in the Zapier connection
  3. Keep the key separate from other uses

Set up Zapier →

Troubleshooting

"Invalid API key" Error

  • Verify the key is copied correctly
  • Check for leading/trailing spaces
  • Confirm the key hasn't been deleted

"Key not authorized" Error

  • Ensure the agent belongs to your workspace
  • Check the key's workspace matches
  • For API requests, confirm your workspace is on Hobby or above with active billing

Key Not Working After Creation

  • Try refreshing the page
  • Wait 30 seconds for propagation
  • Create a new key if issues persist

Next Steps