> For the complete documentation index, see [llms.txt](https://docs.warpstream.com/warpstream/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.warpstream.com/warpstream/reference/api-reference/api-keys.md).

# API Keys

APIs for interacting with API Keys.

The WarpStream API allows developers to manage API key permissions directly. This contrasts with the WarpStream console and the WarpStream Terraform provider, where API keys are always exposed as account keys, application keys or agent keys. For more information about this distinction, see [Secrets Overview](/warpstream/reference/secrets-overview.md).

API requests to manage API keys must be authenticated with either an account key or an application key. Account keys can create, list, and delete account keys, as well as application keys in any workspace. Application keys can create, list, and delete application keys and agent keys, but only in their respective workspaces. See [Workspaces and Access Controls](/warpstream/reference/manage-console-access/workspaces-and-access-controls.md).

API key permissions are represented as access grants. An application key is simply an API key with one set of grants, and an agent key is also just an API key with a different set of grants. Grants are specified when creating new API keys. For details, see [the reference to create API keys](/warpstream/reference/api-reference/api-keys/create.md).

## Key formats

API keys are created in one of two formats.

* **v1 key format**: the secret starts with `aks_`. WarpStream stores the secret, so it can be read again later, for example with [List](/warpstream/reference/api-reference/api-keys/list.md).
* **v2 key format**: the secret starts with `aks_v2_`. WarpStream does not store the secret, only a hash of it. The secret is returned once, by the request that creates the key, and can't be retrieved afterwards.

Keys in either format can be used wherever an API key is accepted, for example to authenticate API requests or Agents.

The v2 key format is created by the v2 create endpoints: [Create API Key (v2)](/warpstream/reference/api-reference/api-keys/create-v2.md), [Create Virtual Cluster (v2)](/warpstream/reference/api-reference/virtual-clusters/create-v2.md) and [Create Workspace (v2)](/warpstream/reference/api-reference/workspaces/create-v2.md). Endpoints that return existing keys, such as [List](/warpstream/reference/api-reference/api-keys/list.md), [Describe Virtual Cluster](/warpstream/reference/api-reference/virtual-clusters/describe.md) and [List Virtual Clusters](/warpstream/reference/api-reference/virtual-clusters/list.md), return an empty `key` for keys in the v2 key format.

An existing key can't be converted to the v2 key format. To move to it, create a new key with [Create API Key (v2)](/warpstream/reference/api-reference/api-keys/create-v2.md), switch your Agents or integrations to the new key, then [delete](/warpstream/reference/api-reference/api-keys/delete.md) the old one.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.warpstream.com/warpstream/reference/api-reference/api-keys.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
