Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

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. 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.

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 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.

Select Create Key to issue the key. If you leave the name empty or select no capability, the message "Key name is required" or "Select at least one capability" appears, and you can't issue the key. You can grant only capabilities that you hold yourself.

Copy the key

After you create a key, the message "Your key has been generated" appears, followed by the message "Copy the key now. 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.

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.

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 message "At least one capability is required." appears.

  • 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

Last updated

Was this helpful?