# API keys

Use one key per agent, narrowed to what it needs. A key acts as its owner and never exceeds their access. It works only while its owner has two-factor authentication on.

## Create a key

1. Open **Settings > API keys** in the [dashboard](https://app.loklhq.com/app/settings/api-keys).
2. Enter a **Key name** that tells you which agent uses it.
3. Choose its **Permissions** and, if needed, an **Expires at** date.
4. Review and confirm **Create key**, then copy the key shown.

## Use a key

Set your MCP client's server address to `https://api.loklhq.com/mcp`. Send the key in either header:

- `Authorization: Bearer lokl_…`
- `x-api-key: lokl_…`

See [Connect your assistant](/docs/connect) for client commands and configuration.

## Choose what it can do

Choose only read permissions for an agent that looks things up. For an agent that prepares changes, choose only the permissions its tasks need.

The [tool reference](/docs/tools) lists each tool's required permissions. A key cannot grant access its owner does not have.

## Revoke a key

In **Settings > API keys**, find the key and choose **Revoke**. Its agent can no longer use it. Create a separate key if you need to connect that agent again.
