Dosu LogoDosu Logo
Ask
Join our Discord
StrapiPublic
Strapi
DocumentsStrapi
api-tokens
api-tokens
Type
External
Status
Published
Created
Mar 5, 2026
Updated
May 6, 2026
Updated by
Dosu Bot
Source
View

API Tokens#

API tokens authenticate external requests to the Strapi Content API without exposing user credentials. Each token is scoped to a set of permissions and expires after a configurable duration.

API tokens allow external clients to authenticate requests to the Strapi Content API. For programmatic access to the Admin panel features, see Admin Tokens.

API tokens and Admin tokens are strictly separated: a Content API token is rejected on admin routes, and an admin token is rejected on Content API routes.

:::caution Security
Prefer read-only tokens for public access, scope tokens to only what you need, rotate long-lived tokens, and store them in a secrets manager.
:::

Free feature Minimum "Access the API tokens settings page" in Roles > Settings - API tokens Available by default Available in both Development & Production environment

<ThemedImage
alt="API tokens"
sources={{
light: '/img/assets/settings/settings_pregen-api-tokens.png',
dark: '/img/assets/settings/settings_pregen-api-tokens_DARK.png',
}}
/>

Configuration#

Most configuration options for API tokens are available in the admin panel, and your Strapi project's code can be used to alter how API tokens are generated.

Admin panel settings#

Path to configure the feature: Settings > Global settings > API Tokens

The API Tokens interface displays a table listing all created content-api tokens.

From there, you have the possibility to:

  • click on the to edit a token's name, description, type, duration or regenerate the token.
  • click on the to delete a token.
Info

Strapi pre-generates 2 API tokens for you, a Full access one and a Read-only one. Since tokens can be only seen once without encryption configured, you may want to regenerate them after setting up an encryption key to make them permanently viewable.

Creating a new API token#

  1. Click on the Create new API Token button.

  2. In the API token edition interface, configure the new API token:

    Setting nameInstructions
    NameWrite the name of the API token.
    Description(optional) Write a description for the API token.
    Token durationChoose a token duration: 7 days, 30 days, 90 days, or Unlimited.
    Token typeChoose a token type: Read-only, Full access, or Custom.
  3. (optional) For the Custom token type, define specific permissions for your API endpoints by clicking on the content-type name and using checkboxes to enable or disable permissions.

  4. Click on the Save button. The new API token will be displayed at the top of the interface, along with a copy button .

<ThemedImage
alt="Custom API token"
sources={{
light: '/img/assets/settings/settings_api-token-custom.png',
dark: '/img/assets/settings/settings_api-token-custom_DARK.png',
}}
/>

:::info Viewable tokens
If an encryption key is configured in your Strapi project (admin.secrets.encryptionKey), the newly created and regenerated API tokens will be viewable at any time in the admin panel.

If no encryption key is set, tokens will only be viewable once, immediately after creation or regeneration.
:::

Regenerating an API token#

  1. Click on the API token's edit button.
  2. Click on the Regenerate button.
  3. Click on the Regenerate button to confirm in the dialog.
  4. Copy the new API token displayed at the top of the interface.

Code-based configuration#

New API tokens are generated using a salt. This salt is automatically generated by Strapi and stored in environment variables (the .env file) as API_TOKEN_SALT.

The salt can be customized:

  • either by updating the string value for apiToken.salt in your /config/admin file
  • or by creating an API_TOKEN_SALT environment variable in the .env file of the project

Changing the salt invalidates all the existing API tokens.

Ensuring API tokens are visible in the admin panel#

To allow persistent visibility of API tokens in the admin panel, an encryption key must be provided in your /config/admin file under secrets.encryptionKey:

module.exports = ({ env }) => ({
  // other config parameters
  secrets: {
    encryptionKey: env('ENCRYPTION_KEY'),
  }
});
export default ({ env }) => ({
  // other config parameters
  secrets: {
    encryptionKey: env('ENCRYPTION_KEY'),
  }
});

This key is used to encrypt and decrypt token values. Without this key, tokens remain usable, but will not be viewable after initial display. New Strapi projects will have this key automatically generated.

Tip

For automation workflows that need to call the Admin panel features programmatically, use admin tokens instead. See Admin Tokens for the full documentation.

Usage#

Using API tokens allows executing a request on REST API or GraphQL API endpoints as an authenticated user.

API tokens can be helpful to give access to people or applications without managing a user account or changing anything in the Users & Permissions plugin.

When performing a request to Strapi's REST API, the API token should be added to the request's Authorization header with the following syntax: bearer your-api-token.

Info

Read-only API tokens can only access the find and findOne functions.

Documents
Admin Form Validation
Admin Homepage Date Serialization
Admin Modal Management
Admin Panel Locale Management
admin-panel
internationalization
setting-up-admin-panel
Auth Error Classification
AWS S3 Upload Provider
amazon-s3
media-library
Blocks Editor URL Validation
Content Manager List Configuration
Content Manager Mobile Actions Drawer
Content Manager Pagination
Content Manager Query Persistence
Content Manager RBAC
rbac
Content Manager Save State
Content Manager Status Attributes
Content Manager URL & Filter State
admin-panel-api
Content Releases
Data Transfer Streaming
Database Migration Concurrency and Idempotency
deployment
step-by-step
Date Field Serialization
Directory Export
Discard-Drafts Migration
Document ID Migration
document-service
introduction-and-faq
step-by-step
Document Service Clone & Relation Handling
Document Service Input Types
Document Service Populate Concurrency
Document Service Relation Queries
Draft & Publish Relation Synchronization
do-not-update-repeatable-components-with-document-service-api
lifecycle-hooks-document-service
publishedat-always-set-when-dandp-disabled
relations
status
status
DynamicZone Stability
components-and-dynamic-zones-do-not-return-id
components-dynamic-zones
no-shared-population-strategy-components-dynamic-zones
Enterprise License Validation
Entity String Length Validation
Error Class Identity
GraphQL Abort Signal Propagation
GraphQL Filter Pipeline
i18n Locale Validation
locale
locale
i18n Locale-Scoped Operations
crud
database-columns
document
i18n-content-manager-locale
internationalization
locale
locale
locale
no-locale-all
relations
Koa Type Augmentation
MariaDB Schema Synchronization
Media Library Asset Replace
media-library
Media Library Permissions
Media Library Thumbnails
Monorepo Module Resolution
Nested Relation Modal Navigation
OpenAPI Specification Generation
Polymorphic Relations
populate
Private Attribute Populate Validation
Query Builder Parameter Handling
Relation Modal State Management
relations
Relations Field Ordering & Pagination
Remote Asset Export
Rich Text Blocks Validation
Strapi Admin Module Loading
Strapi Attribute Typing
Strapi Content Publishing
content-manager
draft-and-publish
internationalization
parameters
releases
Strapi Data Transfer
deployment
Strapi Project Scaffolding
cli
create-a-plugin
deployment
How can I create my first Strapi project on a brand new MacBook with no prior coding experience, including all necessary terminal commands and setup steps?
quick-start
templates
Strapi TypeScript Build Performance
Strapi v5 Plugin API
admin-panel-rbac-store-updated
admin-permissions-for-plugins
breaking-changes
get-where-removed
helper-plugin
helper-plugin-deprecated
inject-content-manager-component
introduction
model-config-path-uses-uid
pass-data-from-server-to-admin
plugins-migration
rbac
redux-content-manager-app-state
remove-webhook-populate-relations
strapi-imports
Transaction Callback Promise Handling
Upload Storage Consistency
Users & Permissions OAuth Flow
new-provider-guide
users-permissions
Users-Permissions Cookie Authentication
Users-Permissions Session Management
Vite Build Configuration
vite
webpack-aliases-removed
Content Manager Mobile and Tablet UI Improvements
FilesManager API Reference
Focal Point Picker in Strapi Media Library
Nested Route File Structure for Strapi Plugins
Plugin-Specific Handling in the Strapi JavaScript Client
Strapi SDK Initialization and Architecture Guide
access-cast-environment-variables
access-configuration-values
adding-support-to-existing-project
admin-panel
admin-panel-customization
advanced-policies
advanced-queries
api
api-tokens
attributes-and-content-types-names-reserved
audit-logs
auth-zero
authentication
aws-cognito
backend-customization
bulk-operations
bundlers
cas
cli
client
cloudinary
community
configurations
configure-sso
content-api
content-history
content-manager-apis
content-type-builder
controllers
core-service-methods-use-document-service
create-components-for-plugins
cron
custom-fields
customization
data-management
database
database-identifiers-shortened
database-migrations
database-transactions
default-index-removed
default-input-validation
design-system
developing-plugins
development
discord
discord
docker
documentation
documents-and-entries
edit-view-layout-and-list-view-layout-rewritten
email
email-custom-providers
email-nodemailer
entity-service
entity-service-deprecated
environment
error-handling
examples
extension
facebook
faq
favicon
features
fetch
fields
filter
filtering
filters
filters
from-entity-service-to-document-service
functions
github
github
google
google
graphql
graphql
graphql-api-updated
guides
homepage
host-port-path
instagram
installation
installing-plugins-via-marketplace
interactive-query-builder
intro
intro
is-supported-image-removed
keycloak
keycloak
koa-body-v6
license-only
linkedin
local-upload
locales-translations
logos
mailgun-provider-variables
media-library-providers
microsoft
middlewares
middlewares
middlewares
middlewares
models
mysql5-unsupported
new-response-format
no-find-page-in-document-service
no-upload-at-entry-creation
okta
only-better-sqlite3-for-sqlite
only-mysql2-package-for-mysql
openapi
order-pagination
order-pagination
patreon
plugin-sdk
plugin-structure
plugins
plugins-extension
policies
policies
populate
populate-creator-fields
populate-select
populating
preview
project-structure
publication-state-removed
query-engine
react-router-dom-6
reddit
register-allowed-fields
removed-support-for-some-env-options
requests-responses
rest
review-workflows
routes
routes
sentry
server
server-api
server-default-log-level
server-proxy
services
services-and-controllers
setup-deployment
single-operations
sort-by-id
sort-pagination
sort-pagination
sso
store-and-access-data
strapi-container
strapi-utils-refactored
strict-requirements-config-files
templates
testing
theme-extension
twitch
twitter
typescript
typescript
understanding-populate
upgrade-to-apollov4
upgrade-tool
upgrades
upload
usage-information
use-document-id
users-and-permissions-providers
vk
webhooks
wysiwyg-editor
yarn-not-default