Skip to content

Admin tokens#2992

Open
pwizla wants to merge 22 commits intomainfrom
cms/admin-api-tokens
Open

Admin tokens#2992
pwizla wants to merge 22 commits intomainfrom
cms/admin-api-tokens

Conversation

@pwizla
Copy link
Copy Markdown
Collaborator

@pwizla pwizla commented Mar 11, 2026

To document the new Admin tokens (strapi/strapi PR #25657) that will serve as a preliminary work for the upcoming Strapi MCP, this PR updates the CMS documentation with the following changes:

  • creates a new Features > Admin tokens page which is similar to the existing Features > API tokens page,
  • slightly updates the API tokens, Configurations > Admin Panel, and Features > RBAC page accordingly

@vercel
Copy link
Copy Markdown

vercel bot commented Mar 11, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
documentation Ready Ready Preview, Comment Mar 12, 2026 1:11pm

Request Review

@pwizla pwizla changed the title Cms/admin api tokens Admin API tokens Mar 11, 2026
@github-actions github-actions bot added pr: updated content PRs updating existing documentation content source: CMS internal PRs created by the Strapi core team labels Mar 11, 2026
@pwizla pwizla marked this pull request as ready for review March 12, 2026 10:56
@pwizla pwizla requested a review from nclsndr March 12, 2026 13:12
@pwizla pwizla added pr: new content PRs for new product features or new documentation sections and removed pr: updated content PRs updating existing documentation content labels Mar 12, 2026
@pwizla pwizla added this to the 6.18.1 milestone Mar 12, 2026
@pwizla pwizla changed the title Admin API tokens Admin tokens Mar 12, 2026
@pwizla pwizla self-assigned this Mar 12, 2026
@pwizla pwizla added the flag: merge pending release Pending Strapi Release label Mar 12, 2026
@pwizla pwizla modified the milestones: 6.19.0, 6.20.0 Mar 18, 2026
@pwizla pwizla removed this from the 6.19.0 milestone Apr 1, 2026
Copy link
Copy Markdown
Contributor

@nclsndr nclsndr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much @pwizla for all this great content (and/or the steering to make it happen!)
Here my 2 cents 👇

| `apiToken.secrets.encryptionKey` | Encryption key used to set API token visibility in the admin panel. When set, token keys remain viewable at any time by the token's owner. | string | Random string |

:::tip
Admin tokens — the new kind of API token for programmatic access to the Admin API — are configured entirely from the admin panel. No additional code-based configuration is required beyond the parameters above (see [Admin tokens](/cms/features/admin-tokens)).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because admin tokens are a new kind of api tokens, they actually inherit the configuration defined above.

Minimum "Access the Admin tokens settings page" in Roles > Settings - Admin tokens
</IdentityCardItem>
<IdentityCardItem icon="toggle-right" title="Activation">
Available and activated by default
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

activated by default for super admin. Each lower-level role needs explicit grant.


## Configuration

Admin tokens are configured entirely from the admin panel. No code-based configuration is specific to Admin tokens. The shared salt and encryption key that apply to all token kinds are set via `apiToken.salt` and `apiToken.secrets.encryptionKey` in your `/config/admin` file (see [API tokens](/cms/features/api-tokens#code-based-configuration)).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's actually a way to grant a token with the ability to configure other tokens but not sure we want to document that. We might want to hide/remove this capability from the admin panel.


### Creating a new Admin token

1. Click on the **Add new Admin Token** button.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy of those labels will move to "Create new Admin Token"

Comment on lines +80 to +82
:::caution
The plaintext token key is shown only once, immediately after creation or regeneration. The `admin.secrets.encryptionKey` configuration that makes Content API token keys persistently viewable does not apply to Admin tokens. Admin token keys are always restricted to the token owner, regardless of encryption configuration.
:::
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not true in the last version. We reproduced the content api token behavior where view can be invoked anytime. Main diff still, the owner being the only user capable of seing the token value.


### Managing Admin tokens

Admin tokens have a dedicated settings page at <Icon name="gear-six" /> _Settings > Administration Panel > Admin Tokens_. The Admin Tokens page and the API Tokens page are independent interfaces, not filtered views of a shared list.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

technically they are the same table but with a discriminated union on kind

:::caution Owner account deactivation and deletion

* If the token owner's account is deleted, all Admin tokens owned by that user are automatically deleted along with their associated permissions. There is no recovery path. Rotate and replace Admin tokens before offboarding a team member who owns them.
* If the token owner's account is deactivated or blocked, any request authenticated with that owner's Admin token returns `401 Token owner is deactivated`. The token itself is not deleted. Re-activating or unblocking the owner restores token functionality.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we disclose such detailed error. May be a good addition.

Comment on lines +113 to +125
## Usage

Admin tokens authenticate requests to Strapi Admin API. Once you have [created and copied an Admin token](#creating-a-new-admin-token), add it to the `Authorization` header of your request using `Bearer` syntax:

```bash title="Example: authenticated Admin API request"
curl -X GET \
https://your-strapi-instance.com/admin/content-manager/collection-types/api::article.article \
-H "Authorization: Bearer your-admin-token"
```

:::caution
Never expose Admin tokens in client-side code. Store them in a secrets manager or environment variable.
::: No newline at end of file
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably want to remove this section

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's something a bit strange with the admin tokens feature because they are actually opening the access to the admin api while the admin API is not a public API just yet. I don't know how we should present that aspect, especially until we release the MCP server where the admin tokens will make total sense with it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll change a bit the copy on that page. I don't know how important that will be for those screenshots.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

flag: merge pending release Pending Strapi Release internal PRs created by the Strapi core team pr: new content PRs for new product features or new documentation sections source: CMS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants