StreamAI Keys
A StreamAI client key is the credential that a client application uses to send requests through StreamAI. Use the Keys page to create keys, find them, edit their description and tags, and revoke the keys that you no longer need.
To list keys, you need at least the Read Only role on the StreamAI Worker Group. To create, edit, or revoke keys, you need the Editor or Admin role on the Worker Group. A request without the required role fails with a 403 error. See Permissions.
To open the page, on the top bar, select Products, and then select StreamAI. In the StreamAI navigation, select Keys.
View Keys
The Keys page lists the keys in your Workspace. If you haven’t created a key yet, the page shows You don’t have any keys and prompts you to select Add Key.
At the top of the page, the How to connect to StreamAI banner shows the base URL for your Workspace. For more information, see Find the Gateway URL.
The list has these columns:
| Column | Description |
|---|---|
| Key | The key’s name, with the first characters of the key (its prefix) below the name. |
| Status | Active or Revoked. See Key Status. |
| Expiration | The date the key expires. The date is highlighted when the key expires within the next 7 days. Hover over a highlighted date to see Expires soon. |
| Last Used | Always shows --. StreamAI doesn’t report when a key was last used. |
| Tags | The tags that you assigned to the key. |
| Actions | A menu with the actions that you can take on the key: Edit and Revoke. |
To check how much a key used, go to Monitor Usage.
Key Status
StreamAI derives the status from the key’s state and expiration date:
| Status | Meaning |
|---|---|
| Active | The key is enabled and hasn’t reached its expiration date. |
| Revoked | You revoked the key, or the key passed its expiration date. |
The Keys page shows an expired key as Revoked. To tell whether a key expired or someone revoked it, compare the key’s expiresAt and revokedAt values in the REST API. A revoked or expired key stays in the list for up to 90 days after you revoke it or it expires. StreamAI also keeps at most 1,000 revoked and expired keys, and removes the oldest first.
Filter the List
To narrow the list:
- Enter text in the Filter keys by name box. The filter matches the key’s name, prefix, description, status, expiration date, and tags.
- Enter or select a tag in the Start typing to filter by tag box to show only the keys that have a matching tag. The box suggests the tags that your keys already use, and matches any tag that contains the text. To clear the filter, remove the text.
- Select Active or Revoked to show only keys with that status. Only one status filter applies at a time. To clear the filter, select the same status again.
The filters work together, so you can, for example, show only the active keys that have a specific tag.
Add a Key
Create a separate key for each client application. Then, you can revoke one client’s key without affecting the others. To create a key:
On the Keys page, select Add Key.
In the Add Key modal, fill in the fields:
Field Description Key ID Required. A name that identifies the key, such as my-app. The name appears in the Key column.Description Optional. Text that describes the key’s purpose. Tags Optional. Labels that help you group and find keys. Enter a tag and press Enter, or separate tags with commas. Expiration How long until the key expires: 30 days (the default), 90 days, or 1 year. Select Generate Key.
Copy the key from the API Key field, and store it somewhere safe. To copy the key, select the copy icon. StreamAI also copies the key to your clipboard automatically when it generates the key, if your browser allows it.
Select Save and Copy. StreamAI copies the key to your clipboard again and closes the modal.
Save the Key Now
StreamAI shows the full key only once. The Add Key modal warns This key will not be shown again. After you close the modal, the Keys page shows only the key’s prefix, and you can’t retrieve the full key. If you lose a key, revoke it and create a new one.
A new key typically starts to authenticate requests within about 30 seconds. Until then, requests that use the key return 401.
Create a replacement key before an existing key expires, because StreamAI rejects requests that use an expired key. You can’t change a key’s name or expiration after you create it.
Edit a Key
Edit a key to change its description or tags. You can edit a key in any status, including a revoked key. To edit a key:
- On the Keys page, find the key. In the Actions column, open the key’s menu.
- Select Edit.
- In the Edit Key modal, change the Description or Tags. The Key ID and Expiration fields are read-only.
- Select Save.
To remove the description or all tags, clear the field and select Save.
Revoke a Key
Revoke a key when a client no longer needs access, or when you suspect that the key is compromised. To revoke a key:
- On the Keys page, find the key. In the Actions column, open the key’s menu.
- Select Revoke.
- In the Revoke key? modal, confirm that the name and prefix are the key you want to revoke, and then select Revoke.
Revoking Is Permanent
The modal warns Revoking is permanent. There is no undo. To restore a client’s access after you revoke its key, create a new key.
After you revoke a key, the key’s status changes to Revoked and it stays in the list. The Revoke action isn’t available for a key that shows Revoked, including an expired key. A revoked key typically stops authenticating requests within about 30 seconds.
Manage Keys with the REST API
You can also create, list, update, and revoke keys with the REST API. For all key endpoints and their behavior, see StreamAI REST API.