Why Strapi API token scopes decide what a leaked token can reach
A build pipeline, a front-end deployment or a sync job often reaches Strapi through one long-lived API token that someone created once and never revisited. Token scope and rotation decide what an exposed credential can read or change. A token that can only read published content exposes far less than one that can create, update or delete entries, upload media or reach content types that were never meant for that job. When a token leaks through a CI log, a configuration file or a departed contractor's laptop, the blast radius is set by the permissions it was issued with and by how long it stays valid, not by how carefully the original integration was written.
A reviewed token design is worth doing before go-live, after a migration to Strapi 5, and whenever a third party holds a token. Before go-live, check which integrations exist, what each one actually calls, and whether a read-only token would serve. After a Strapi 5 migration, the API response format and the permissions attached to content types may have changed, so tokens and their scopes deserve a second look rather than an assumption that they carried over unchanged. Any time an agency, vendor or sync partner holds a token, confirm who owns it, what it can reach and how it is removed when that relationship ends.
Start with an inventory: list every token, its purpose, its creator and the endpoints it calls, then confirm the current settings in the admin panel for each one. Ask your implementation partner or internal team to show how the token scope maps to the calls in the code. Confirm with your Strapi version's documentation which token types, lifetimes and rotation options your release supports, because these details change between releases and this page does not set them. Keep administrator credentials out of this inventory entirely, since they belong to a separate control path.
Read-only, full access and custom API tokens compared
This table compares the three Strapi API token types by what each allows, who typically uses it, the main risk it carries and where it fits. Read each row as a question to answer for your own consumer: what does this caller need to do, and what is the smallest token that lets it do that? Exact permission sets and token lifetime options must be confirmed against the Strapi 5 version you run and the admin panel options available in that version.
| Token type | What it allows | Typical consumer | Main risk | When it fits |
|---|---|---|---|---|
| Read-only | Fetch published entries and assets through the Content API, with no create, update or delete calls | Static site build, public front end or preview renderer | A leaked token exposes everything the role can read, including drafts if the content is not filtered by status | Any consumer that only renders content and never writes it |
| Full access | Create, read, update and delete on all content types and media the token can reach | Editorial import, one-time migration script or admin automation run by a trusted team | A single leaked token can alter or delete all content, so blast radius is the whole project | Short-lived migration or import work, ideally with a planned revocation date |
| Custom | Only the content types, actions and fields you select in the admin panel | Scheduled sync, third-party integration or a service that writes to one collection | Scope creep over time, as teams add permissions to fix errors instead of reviewing the set | Recurring machine access where you can name each permitted action |
| Typical lifetime | Set in the admin panel when the token is created, with options that depend on the Strapi 5 version in use | Build jobs and scheduled syncs need a longer lifetime, interactive imports need a shorter one | Long-lived tokens are rarely rotated unless someone owns the rotation process | Confirm available durations and rotation steps in your version before writing a policy |
| Encrypted viewing | Whether the token value can be shown again in the admin panel after creation | Operators who must retrieve a token to configure a consumer | Anyone with admin access can reveal a token if this option is available and enabled | Confirm whether your version offers this option and who may use it |
| Separation from Admin tokens | Content API tokens cannot manage the admin panel or users, and Admin API tokens are a different credential | Front end and integrations use Content API tokens, operators use admin sessions | Reusing one credential across both APIs widens what a single leak can change | Always keep them apart in configuration and secret stores |
How a token request passes through Strapi's permission checks
The flow starts with a consumer sending a request that carries an API token to the Content API, which sits behind the trust boundary of the Strapi server. Strapi resolves the token, checks its scope and then the permissions on the requested content type before it returns data or a denial. The admin panel session and Admin API calls take a separate path with their own credentials, so the two types never share a check. When you review a setup, confirm that each consumer's token reaches only the content types it needs.
Content API token checks and admin session checks follow separate paths inside Strapi.
Where long-lived tokens create standing access
A long-lived Strapi API token keeps working long after the reason it was created has passed. The risks below share one cause: a credential that outlives its owner, its environment or its purpose. Each card names the exposure and the first control to put in place before go-live.
Tokens forgotten in CI variables
A token pasted into a CI/CD variable for a build or content sync often outlives the pipeline that needed it. Anyone who can edit pipeline settings, or read job logs that echo variables, can reuse it against the Content API. Before go-live, list every pipeline that holds a Strapi token, record its owner and purpose, and set an expiry date in the token settings so that a forgotten pipeline stops working on its own.
Tokens shared across environments
When one token works in staging and production, a weak staging host or a leaked staging log exposes live content and write access. Create separate tokens per environment and per consumer, so that revoking one does not break the others. Check that production tokens are never stored in development .env files or shared team notes.
Tokens held by departed staff or vendors
Tokens created by an editor, developer or agency rarely get revoked when the person leaves or the contract ends. The token keeps the permissions it was issued with, regardless of the person's current role. Keep a register of who created each token, review it at every offboarding, and revoke tokens tied to former staff or vendors before access reviews close.
Tokens written into front-end bundles
A token embedded in a JavaScript build is visible to every visitor who opens the browser developer tools. Static site generators and single-page apps are common sources of this mistake. The first control is to keep Content API tokens on the server side of your front end and to use public role permissions for anything that is truly public. Search your built output for the token string before each release.
Full-access tokens used for reading
A read-only consumer such as a website build or a search indexer rarely needs create, update or delete rights. A full-access token used for these jobs turns any leak into a write path. Start each token with the narrowest permissions the consumer needs, then widen only with a recorded reason. Test the token by attempting a write and confirming that Strapi rejects it.
Strapi SSO docsKeeping Content API and Admin tokens apart
Content API tokens and credentials used for the admin panel or the Admin API should never share an owner, an environment or a secret store. The first decision is to treat them as two different trust levels: a Content API token should only read or write the content that a specific delivery job needs, while anything that can reach the Admin API can change content types, roles and permissions. Keeping them apart limits the damage when one of them leaks, and it makes every later review simpler. Confirm which credential types your Strapi version issues, how each one is created, and where your version stores them, because the admin-side mechanisms differ between the Community and Enterprise editions and between hosting setups.
Mixing the two lets a delivery job do far more than publish content. A build pipeline that holds a broad token can call schema or role endpoints, so a compromised pipeline could alter content types, widen the Public role or create a new administrator. The same risk appears when a developer copies an admin session token into a script for convenience. In practice, separate the credentials in three places: naming (for example, a content-delivery- prefix for Content API tokens and an admin-ops- prefix for administrative use, with the owning team in the description), storage (distinct entries in your secrets manager, with different read permissions for the pipelines that consume them), and environment (production delivery tokens never live in a staging pipeline that also deploys schema changes).
Review the separation on a schedule, not only at launch. Check that each Content API token maps to one consumer, that no CI variable holds an admin credential, and that schema deployments run under a separate identity with their own approval step. Ask your Strapi partner or internal team to document which role can create, view and revoke each token type, and to confirm how your hosting setup restricts access to the admin panel. If a token has to serve both purposes, treat that as a finding to fix, not an accepted exception.
How to set up scoped tokens and a rotation runbook
This sequence turns an undocumented set of Strapi API tokens into a written inventory, narrowly scoped tokens per consumer and environment, tested denials, and a repeatable rotation runbook that your team can follow without guesswork.
Inventory every consumer and the content it needs
List each system that calls the Strapi APIs, including front ends, build jobs, sync scripts, reporting tools and any automation. For each one, record the content types, fields, locales and operations it actually uses, such as reading published articles or creating drafts. Ask the owning team to confirm the list, because undocumented consumers are the most common source of over-permissioned tokens. The step is done when every consumer has a one-line statement of needed access that the owner has signed off.
Map each consumer to the narrowest token type
Compare each access statement with the token types Strapi offers in the admin panel, which include read-only, full access and custom tokens. Assign read-only only where the consumer never writes, and use a custom token with explicit permissions per content type and action where a consumer needs a subset of writes. Reserve full access tokens for a documented exception with a named owner. Confirm the exact options in your Strapi version's admin panel, since token settings can change between releases. The output is a mapping table showing consumer, token type, permitted actions and justification.
Create one token per consumer and environment
Issue a separate token for each consumer in each environment, so development, staging and production never share a credential. Do not reuse a token across two front ends or between a build job and a sync script, because a single leak would then expose both. Set the token duration deliberately, choosing a finite lifetime where the option exists and recording it in the mapping table. Check that the token list in the admin panel shows one entry per row of your mapping. The step is complete when the count of live tokens matches the count of consumer and environment pairs.
Store tokens in a secrets manager
Move each token value into your organization's secrets manager and grant read access only to the workload or pipeline that uses it. Remove tokens from source control, shared chat, ticket attachments and local environment files kept on laptops. Where the admin panel offers encrypted viewing of a token, use it so the value is not casually displayed again after creation. Confirm that a search of your repositories and CI logs finds no token strings. The step is done when each consumer retrieves its token from the secrets manager at runtime or deploy time.
Record an owner and expiry review date
For each token, record a named owner, the consumer it serves, its environment, its scope, its creation date and the date it must be reviewed or rotated. Store this register alongside your other operational records and link it from the runbook. Ask the owner to confirm that the consumer still needs the access at each review. The register is complete when no token lacks an owner or a review date, and anyone on call can find the owner for a given token within a few minutes.
Test that each token is denied outside its scope
Call the Content API with each token against content types, operations and locales it should not reach, and confirm the request returns an error such as a 403 response rather than data. Also check that a read-only token cannot create, update or publish entries, and that a Content API token cannot reach Admin API endpoints. Run the same checks as an unauthenticated request to confirm the Public role is not exposing anything the token scope was meant to protect. Keep the requests in a script so you can rerun them after upgrades. The step is done when every denial test returns the expected error and every allowed test returns the expected data.
Write the rotation runbook
Document a rotation procedure with four ordered actions: issue a new token with the same scope, deploy it to the consumer through the secrets manager, verify that the consumer works and that denial tests still pass, then revoke the old token. Include who approves each step, where the new value is stored, how to roll back if the consumer fails, and how to confirm that the revoked token returns an error. Rehearse the runbook once in a non-production environment and record any gaps it reveals. The runbook is ready when a team member who did not write it can complete a rotation and show the revoked token is rejected.
Setting token lifetimes by consumer type
A static site build calls the Content API while it runs, writes HTML or JSON files, and then finishes. The token is needed only for the length of the build, so it has the narrowest life of any consumer here. Rotation is usually practical because the pipeline reads the secret fresh on each run, so updating the CI secret store and triggering one build is often enough. Confirm that the pipeline does not cache the value between runs.
- Build-time only access: Keep the token in the CI secret store and out of the front end bundle, the generated files and build logs.
- Read-only scope: Grant find and findOne on the published content types the build reads, with no create, update or delete.
- Rotation at pipeline change: Update the CI secret, run a build, and confirm it succeeds before revoking the old token.
- Preview builds: Draft content typically needs a separate preview token or path, so do not reuse the production build token for previews.
- Failure mode: An expired token fails the build, and the last successful deployment usually keeps serving visitors.
Before choosing a lifetime, check which content types and fields the build reads, how the CI system stores and masks the secret, and whether a failed build leaves the last published site live.
Scheduled imports and sync jobs run on a timer, pull data from another system, and often write into Strapi. They are the consumer most likely to need create and update permissions, so their scope is wider than a build's. The main rotation risk is timing: a token that expires between scheduled runs makes the job fail, and the failure may go unnoticed until someone checks the data. Rotation works when the job reads its secret at the start of each run and the new token is in place before the old one ends.
- Separate tokens for import and sync: Give each job its own token, limited to the content types it writes, so one leak does not expose the whole schema.
- Missed-run risk: Confirm that a lifetime is longer than the gap between scheduled runs, and that a failed run raises an alert.
- Rotation window: Create the new token, deploy it to the scheduler, let one run succeed, then revoke the old token.
- Retries and duplicates: After a token error, a retry can write the same records twice; confirm the job checks existing state before writing.
- Named ownership: Record who owns each job's token so renewals are not missed when people change roles.
Before choosing a lifetime, check the schedule gaps, the write permissions the job holds, the alerting on failed runs and where the scheduler stores the secret.
A server-side front end calls Strapi on each request or on a cache miss, and the token stays on the server. Because the consumer runs continuously, an expired or revoked token shows up directly to visitors as missing pages or errors. Rotation therefore needs overlap, where the old and new tokens both work for a short period while the application restarts. Plan the rotation as a deployment, not as a configuration edit.
- Server-only storage: Load the token from environment variables supplied by a secrets manager, and keep it out of client bundles and public configuration.
- Read scope: Use a read-only token for published content, and a separate preview token limited to the preview path if editors need drafts.
- Overlap during rotation: Deploy the new value, roll the instances, confirm traffic is healthy, and only then revoke the old token.
- Cache effects: Cached pages can keep serving after a token change, which hides failures until the cache expires, so test with a cold cache.
- Every replica updated: Check that no instance keeps a stale copy of the token after a rolling restart.
Before choosing a lifetime, check where the application reads the token, how restarts happen during rotation, how long cached pages live, and what a visitor sees if the token fails.
Vendor integrations, such as search indexers, translation services and marketing tools, store your Strapi credential on their side. You control the scope you grant, but not how the vendor stores the secret or who on the vendor side can view it. Rotation depends on what the vendor supports: some accept a new credential in a settings screen, while others need a support request or a contract change. Get that answer before you set any lifetime, because a lifetime you cannot rotate on time is a risk.
- Vendor secret handling: Ask how the vendor encrypts the stored token, who can view it, and whether access is logged.
- Minimal scope: Give the integration only the content types and actions it needs, such as find on published entries for an indexer.
- Rotation support: Confirm whether the vendor can accept a new credential without downtime and whether two credentials can be active together.
- Revocation path: Document how to revoke the token quickly if the vendor reports an incident, and who on your side makes that call.
- Contract terms: Procurement should confirm data handling and incident notice terms in writing with the vendor.
Before choosing a lifetime, check the vendor's storage and rotation method, its incident notice terms, and whether the integration can be disabled without a Strapi release.
Handling token secrets and viewing them safely
A Strapi API token is a bearer credential, so its safety depends on where it lives, who can see it after creation and how quickly it stops working when people or vendors change. The controls below work together: keep tokens out of places they can leak, limit viewing, and prove afterward that the right tokens were used by the right parties.
Store tokens in a secrets manager
Keep each token in a secrets manager or the CI secret store of the pipeline that uses it, never in a shared document, ticket or .env file committed to a repository. Record which system owns each token, which environment it serves and who approved it. Check that deployment jobs read the token at run time and that no step echoes it to build output. Confirm how your chosen store handles access logging and rotation before you rely on it.
Limit who can view tokens
A full-access token is shown once at creation, so the person who creates it must copy it straight into the secret store. Restrict the Admin panel roles that can create or regenerate tokens to a small group, and separate token creation from token use where your process allows it. Confirm in your own instance whether the token listing can display the value again or only its metadata, and whether encrypted viewing options apply to your version.
Keep tokens out of logs and bundles
Tokens sent as Authorization: Bearer headers can end up in reverse proxy access logs, APM traces, error reports and browser code. Strip or mask the header in proxy and tracing configuration, and make sure no front-end build inlines a token into JavaScript that browsers download. Any token that appears in a public bundle should be treated as exposed and revoked. Test by searching build artifacts and sample log lines after each release.
Revoke tokens when access ends
Maintain an inventory that maps each token to a named owner, a system and a vendor if one holds the token. When a staff member leaves a project, or a contractor or agency contract ends, revoke or regenerate the tokens they could reach and confirm that the old value fails. Include vendor integrations in offboarding, because a token held by a third party is not covered by your account removal. Schedule a periodic review of the inventory against the live token list.
Review audit evidence of token use
Enterprise features such as audit logs apply on Strapi's self-hosted Enterprise plan, while Community and Growth plans may not include them, so confirm current plan contents on the Strapi self-hosted pricing page. Where audit logs are available, review them for token creation, regeneration and deletion, and for unexpected request patterns. Without them, rely on reverse proxy logs and your own monitoring to show which tokens were used and from where.
Strapi plan contentsQuestions teams ask before scoping Strapi API tokens
How much effort does a Strapi API token review take?
The effort depends on how many systems hold tokens, how many content types those tokens can reach, and how many environments need separate credentials. A review with a handful of consumers on one environment is a small exercise. The effort grows with each front end, build pipeline, webhook receiver and scheduled job that calls the Content API, because each one needs its token checked for scope, lifetime and storage. Teams with tokens copied into several CI variables, old tokens still active from past projects, or no record of which service uses which token will spend most of their time on discovery. Ask any partner to size the work from that inventory, not from a headline number.
Can our in-house team review and rotate Strapi API tokens?
Usually yes, if the team has someone who administers the Strapi admin panel, someone who owns each consuming application, and someone who can change the secrets store used by CI and hosting. The Strapi side of the work is small: creating custom tokens with the narrowest permissions, setting lifetimes, and revoking old tokens. The harder part is coordination, because a rotation is only safe once every consumer has picked up the new value. Teams without a clear owner for each integration, or without a secrets manager, tend to find that outside help saves time on the inventory and the cutover plan. Decide early which of these tasks your staff can absorb.
What do we need to provide before a token engagement starts?
A token review needs three inputs from your side:
- An inventory of every integration that calls the Strapi Content API or the Admin API, including front ends, build hooks, scheduled jobs, webhooks, and internal tools.
- Access to the Strapi admin panel with rights to view API tokens and roles, plus read access to the CI and hosting settings where tokens are stored.
- A named owner for each token who can confirm what the consumer needs to read or write and approve the cutover date.
Without the inventory, the work starts with discovery, which adds time. Without owners, nobody can approve a change that might break a production site.
What should a quote for Strapi token work include?
A quote should list the work as separate lines so you can compare it with your own effort. Ask for the consumers in scope, the environments covered, and whether the review covers the Content API tokens, the Admin API tokens, or both. It should name the deliverables, such as a token register with scope and expiry for each consumer, a rotation runbook, and verification steps. Confirm whether the quote includes the change to CI variables and hosting secrets, the retest after rotation, and any follow-up support. Ask what is one-time and what recurs, for example periodic rotation reviews. The quote should state what is excluded, such as application code changes in consuming systems, so there is no surprise on the invoice.
How long does rotating a long-lived Strapi token take per consumer?
The time per consumer depends on how the token is stored and how many places it is copied. A consumer that reads its token from one secrets store and restarts cleanly can usually switch over quickly. A consumer where the token is hard-coded in a front-end build, a third-party tool, or several pipelines needs a rebuild and a check on each copy. The safe sequence is to create the new token, deploy it to the consumer, confirm successful calls, and only then revoke the old one. Because we have not been supplied with rotation durations, confirm per-consumer timing with the owner of each integration and plan a window for any consumer that needs a redeploy.
What changes when moving token handling from Strapi 4 to Strapi 5?
Strapi 5 changes the API response format and replaces the Entity Service API with the Document Service API, so any consumer that depends on the old response shape needs testing when tokens are rebuilt. The Strapi-Response-Format: v4 header is available for backward compatibility during migration, but it is a transition aid, not a permanent design. Token scopes must also be re-checked, because permissions attached to content types and custom routes may be named or structured differently after the upgrade. Strapi 4 reached end of life on April 30, 2026, so token work on a v4 project usually runs alongside the upgrade. Back up the database first, because downgrading is not supported.
Which risks should we check before revoking old Strapi tokens?
The main risk is an undocumented consumer that stops working after an old token is revoked, such as a nightly export, a preview build, or a partner feed. Check the access logs for each token over a representative period before revoking it, and confirm each owner has signed off. Another risk is a custom token given full access because a narrower scope was too hard to test. Keep Content API tokens separate from Admin API tokens, and store each in its own secrets location so a leak of one does not expose the other. Record every revocation in your change log so the rollback path is clear.
What to confirm in your Strapi version and environment
Token behavior differs between Strapi releases, hosting models and plan tiers, so the settings you rely on in a design document may not match what your admin panel exposes. The cards below list the five items to confirm for your own version and environment before you write a token policy.
Token types and lifetimes offered
Confirm which token types your Strapi 5 admin panel offers (read-only, full access and custom) and which lifetime options it exposes, such as unlimited or a fixed duration. Record the exact labels and defaults shown in your version, because options have changed between minor releases. Strapi ships minor releases often, so check the release notes for the version you run rather than relying on a page written for an earlier one.
Strapi release notesScope limits on tokens
Confirm whether a token can be restricted to specific content types, single actions such as find or create, or both. A token that can only be full access is a different risk profile from one limited to a single collection. Test each limit with a real request from a token created for that purpose, and note any action your version does not let you restrict.
Revocation for cached clients
Confirm how quickly a revoked or regenerated token stops working. Test it with a client that has already cached the token, such as a static site build, a serverless function or a scheduled job. Some clients keep working until their own cache expires, so the rotation runbook must cover the client side as well as the Strapi side.
Secret storage and reporting on your host
Confirm how your hosting model stores and displays token values. On a self-hosted install, check where the token is persisted, who can read the database table or environment file that holds it, and whether the value can be viewed again after creation. On Strapi Cloud, confirm what the platform shows, logs and retains for project credentials and who can see them.
Strapi Cloud pricingAudit evidence for reviewers
Confirm whether your plan records token creation, regeneration and deletion in a form reviewers can export. Audit logs are listed as an Enterprise feature on the self-hosted plans, so a Community or Growth install may need an application log, a database audit trail or a change ticket to show the same events. Ask your compliance team which evidence they will accept before you go live.
Self-hosted plansHow DeployOpen scopes and rotates Strapi tokens
DeployOpen treats Strapi API tokens as access decisions that need a written scope, a named owner and a rotation plan before go-live. We plan the Content API and Admin token boundaries inside your own infrastructure, build and test them against your front ends and integrations, and hand over the procedures your team needs to keep them current.
How we scope
- Inventory every consumer that calls Strapi and map each one to a read-only, full access or custom token type
- Record which content types, actions and environments each token may reach in the written scope
- Agree token lifetimes and the owner of each token before any token is created in your environment
How we build
- Create custom token permissions that match the scoped list, rather than relying on broad full access tokens
- Keep Content API tokens and Admin tokens in separate configuration paths with separate secret storage
- Test each token as a client would use it, confirming that denied requests fail and allowed requests succeed
How we hand over
- Document the token inventory, scopes, lifetimes and owners in a form your security and platform teams can review
- Write a rotation runbook covering issuing a replacement, switching consumers and revoking the old token
- Run a rotation rehearsal with your team in a non-production environment so the procedure is proven before use
How we support
- Engagements are fixed-scope, with scope and deliverables agreed in writing before work starts
- Ongoing support, upgrades and continuous testing are available as a retainer after handover
- Ask us to confirm token behavior for your Strapi version during any quote, since version changes can affect permissions

