> For the complete documentation index, see [llms.txt](https://docs.uptiq.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.uptiq.ai/platform/control-center/admin/api-keys.md). Agents can also search and read this documentation through its [MCP server](https://docs.uptiq.ai/~gitbook/mcp).

# API Keys

Create and manage API keys that give programmatic access to the platform.

API keys give programmatic access to the platform. In **Admin** > **API Keys**, you create and manage them.

## Key types

Each key type is sent in its own header.

| Key type     | Header                                    | Used for                                                                   | Issued from                      |
| ------------ | ----------------------------------------- | -------------------------------------------------------------------------- | -------------------------------- |
| Platform key | `x-platform-key`                          | Account-wide access to the platform. Agent runtime routes don't accept it. | **Admin** > **API Keys**         |
| Agent key    | `x-api-key`, with its secret              | Calling one specific agent                                                 | The **Deploy** tab of that agent |
| Widget key   | `x-widget-key`, with a whitelisted domain | Calling one specific agent from a whitelisted domain                       | The **Deploy** tab of that agent |

To call a specific agent, use the agent key or the widget key. See [Integrate Agent](https://docs.uptiq.ai/platform/console/agent-builder/deploy/agent-integration.md). Legacy project keys in older projects keep working. None of the key types expire or support rotation. To stop a platform key from being used, [revoke it](#manage-a-key).

## Key list

The key list shows the following fields for each key. Search by name or key ID, or select **+ Create API Key** to create a key.

| Field            | Description                                                                              |
| ---------------- | ---------------------------------------------------------------------------------------- |
| **Name**         | The label given to the key.                                                              |
| **Key ID**       | The identifier of the key in the list. It isn't the key value that you send in requests. |
| **Capabilities** | How many capabilities the key carries, such as "1 capability."                           |
| **Status**       | Whether the key is active.                                                               |
| **Created**      | The date you created the key.                                                            |

To act on a key, select the ⋯ menu at the end of its row.

The **Key ID** and the key value are different. The key value starts with `sk-`, and you copy it when you create the key. A platform key without the `sk-` prefix is rejected, so an older key that was issued without it has to be reissued.

## Create an API key

Select **+ Create API Key** to open the dialog. Grant the key only the capabilities it needs.

| Field            | Description                                                                                                                                                                                       | Values or format            | Required |
| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------- | -------- |
| **Key name**     | A label for the key, such as "Reporting integration."                                                                                                                                             | Up to 100 characters        | Yes      |
| **Capabilities** | The capabilities the key carries. Search the list, or expand a group and select each capability the key needs. Each group shows a count, such as "0/11," that updates as you select capabilities. | Capabilities in the account | Yes      |

The capabilities are the same set that [roles](https://docs.uptiq.ai/platform/control-center/admin/roles.md) carry, such as **Create a project**, **View user**, and **Manage user**. For what each capability covers and which roles hold it, see [Capabilities by role](https://docs.uptiq.ai/platform/control-center/admin/roles.md#capabilities-by-role).

Select **Create Key** to issue the key. If you leave the name empty or select no capability, you can't issue the key. The Uptiq Platform tells you that a key name is required or that you must select at least one capability. You can grant only capabilities that you hold yourself.

## Copy the key

After you create a key, the Platform confirms that your key has been generated. It tells you to copy the key now because, for security, it is shown only once and cannot be retrieved later. Select the copy icon beside the key. If you don't copy the key, create a new key.

Below the key is a sample `curl` request that sends the key in the `x-platform-key` header. Select **Done** to close the dialog.

{% hint style="warning" %}
**Limit key capabilities.** API keys can carry account-management capabilities. Grant only the capabilities a key needs, and store the key value securely.
{% endhint %}

## Manage a key

Open a key's ⋯ menu to use one of the following actions.

| Action                | What it does                                                                                                                                                    |
| --------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Sample cURL**       | Shows a sample `curl` request for the key, with a `<YOUR_API_KEY>` placeholder in the `x-platform-key` header. Replace the placeholder with the key you copied. |
| **Edit Capabilities** | Changes the capabilities the key carries. See [Edit a key's capabilities](#edit-a-keys-capabilities).                                                           |
| **Revoke**            | Revokes the key. The confirmation asks "Revoke API key?" and warns that anything that uses the key stops working immediately. The action can't be undone.       |

**Edit Capabilities** and **Revoke** appear only for active keys, and only if your role includes **Manage API keys**.

## Edit a key's capabilities

Change a key's capabilities without creating a new key. Select **Edit Capabilities** from the key's ⋯ menu. The dialog opens with the capabilities the key already has. Changes apply on the key's next request, and the key itself stays the same.

Select or clear capabilities, and then select **Save**. **Save** isn't available until you change something. The dialog has no **Key name** field, so you can't rename a key.

* **The key and its secret don't change**. Anything that already uses the key keeps working with the new capabilities from its next request. Requests already in progress aren't affected.
* **A key keeps at least one capability**. Clearing every capability isn't allowed, and the Platform tells you that at least one capability is required.
* **You can add only capabilities you hold**. You can always remove capabilities already on the key, even ones you don't hold.

## What a key can do

A key never does more than the role of the person who created it allows. The platform checks this each time the key runs. The key uses only the capabilities that appear on both the key and the creator's current role. This applies to every key a person creates, including keys created from **Build from your IDE**.

* **The creator's role loses a capability**. The key loses it too. The **Capabilities** count in the list still shows what's stored on the key, not what the creator's role now allows. Because the platform caches the creator's capabilities, a role change can reach the key with a delay.
* **The creator leaves the account**. The key no longer carries any capability.
* **A key can list projects without the project-selection capability**. The endpoints `GET /identity-hub/apps` and `GET /api/v1/projects` accept a key that doesn't carry `SelectProject`. They list only the projects of the key's account, or only its own project if the key belongs to one project. Other project operations, such as reading one project's variables, still need the capability they name.
* **A request fails if it names another account or project**. A key works only within its own account and project.

## What's next

{% content-ref url="/pages/IDT0tA2hSZZFunpkhevN" %}
[Roles](https://docs.uptiq.ai/platform/control-center/admin/roles.md)
{% endcontent-ref %}

{% content-ref url="/pages/FRNOzo7JXcLJUGyEW6Is" %}
[Integrate Agent](https://docs.uptiq.ai/platform/console/agent-builder/deploy/agent-integration.md)
{% endcontent-ref %}

* [Capabilities by role](https://docs.uptiq.ai/platform/control-center/admin/roles.md#capabilities-by-role)

***

{% columns %}
{% column width="83.33333333333334%" %}

<p align="right"><em>Maintained by</em> <mark style="color:green;">Abhishek Paul</mark><br><code>AI-assisted, human-approved</code></p>
{% endcolumn %}

{% column width="16.666666666666664%" %}

<div align="left"><img src="https://1326225582-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F0qmgQjJ5aArDTj2ACFHG%2Fuploads%2Fgit-blob-d034645b4f8f8ee661985f5306b60ded3289653c%2Fmaintainer-abhishek-paul.png?alt=media" alt="" width="60"></div>
{% endcolumn %}
{% endcolumns %}


---

# 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.uptiq.ai/platform/control-center/admin/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.
