> For the complete documentation index, see [llms.txt](https://docs.stackai.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stackai.com/guides-and-quickstarts/organization-administration/api-key-management.md).

# API key management

API keys let an application authenticate requests to StackAI. Create a key with suitable permissions and an expiration, then revoke it when the application no longer needs access.

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FSQ1Sgy933krTyK0S4JpP%2Fuploads%2FOAKx32i63Bg5qnNGscUX%2FG097.mp4?alt=media&token=02db849c-f97a-41a9-8c82-fb80fa39d4ae>" %}

## Before you start

Ask the application owner which StackAI operation and permissions the integration needs and where its credential is securely stored. For an application calling a published workflow, use [Expose a project through API](https://docs.stackai.com/guides-and-quickstarts/interfaces-and-end-user-experiences/publish-a-project-through-the-api.md) to prepare the endpoint and request. Have that owner perform the API-client verification if you do not operate the integration. Inventory the consuming application before revocation so you know which service will lose access.

You need permission to create API keys with the required operations.

## Create an API key

Open Settings → API Keys and review existing key status and activity logs.

![Existing API keys and activity](https://content.gitbook.com/content/SQ1Sgy933krTyK0S4JpP/blobs/fpmUsV5OYQpMYPuCZqAj/assets/g097-g097-01-list.png)

Check whether an appropriate active credential already exists before creating another one.

Select Create API Key and enter a descriptive name and expiration.

![API key name and expiration](https://content.gitbook.com/content/SQ1Sgy933krTyK0S4JpP/blobs/u9Tzucppc463H9hm1QfK/assets/g097-g097-02-expiration.png)

Use a name that identifies the application or purpose responsible for its use.

Select the permissions required by the integration.

![API key permission selection](https://content.gitbook.com/content/SQ1Sgy933krTyK0S4JpP/blobs/vhmdLFLk5XyGlxn9leh9/assets/g097-g097-03-permissions.png)

Grant only the operations that application needs before creating the key.

Store the newly issued key in a secure credential store and close the creation dialog.

![Newly issued key dialog](https://content.gitbook.com/content/SQ1Sgy933krTyK0S4JpP/blobs/A8veMCBNog0Ez095dZeY/assets/g097-g097-04-created.png)

Do not place the credential in documentation, screenshots, or source code.

## Verify the required API operation

Use the key with the intended endpoint in your API client.

![API-client operation response](https://content.gitbook.com/content/SQ1Sgy933krTyK0S4JpP/blobs/8ShkWnOhNL6LWyGjfK5I/assets/g097-g097-05-success.png)

Inspect the response status and body to confirm that its permissions support the required operation.

## Revoke a key

To end access, identify the exact key and review the Revoke API key confirmation.

![Revoke API key confirmation](https://content.gitbook.com/content/SQ1Sgy933krTyK0S4JpP/blobs/UNXS3FIu1S6BIQCRepXr/assets/g097-g097-06-revoke.png)

Confirm only after checking which application uses that credential.

Check that a request using the revoked key is rejected.

![Request after key revocation](https://content.gitbook.com/content/SQ1Sgy933krTyK0S4JpP/blobs/ecywf0JGNCUrasXvvEgT/assets/g097-g097-07-rejected.png)

Revocation should prevent further authorized use of that credential.

Return to API Keys and inspect the final status and activity log.

![Final API key status and activity log](https://content.gitbook.com/content/SQ1Sgy933krTyK0S4JpP/blobs/oxks9fq344AV6iPRbPD6/assets/g097-g097-08-logs.png)

Confirm that the intended key was revoked while other required credentials remain available.

## Important behavior

Store keys in a secure credential store. Do not include them in source code, screenshots, or documentation.

Revoking a key stops applications that rely on that credential. Identify its users before revocation.


---

# 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.stackai.com/guides-and-quickstarts/organization-administration/api-key-management.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.
