About Delivery Tokens
Delivery Tokens are tokens that provide you with read-only access to the associated environments. It is a credential—used along with the stack API key—to make authorized Content Delivery API requests for retrieving the published content of an environment.
Note: The delivery token can be assigned to all the branches or to a specific branch. You can also assign it to all the aliases or a specific alias, to fetch data from their associated branches. Refer to our Global Modules document for more information.
You can use one token to fetch content from only one environment. This means that you need to create different tokens for different publishing environments of your stack.
Having separate tokens for different environments ensures that only the specified people have access to the content of the required environments. For example, testers can fetch content of only the “staging” environment, while content managers have access to the “production” environment. This separation ensures the safety of your content and allows you to manage separate delivery channels independently.
Key points to remember:
- You can associate a delivery token with only one environment. Consequently, you need to create different tokens for different environments.
- Delivery tokens can be used to fetch only published content, not unpublished or draft content.
- You can create a maximum of 20 tokens in a stack.
Using the latest Preview tokens, you have the capability to fetch information about your website. Let’s look at more details in the following section.
About Preview Tokens
A Preview Token provides you access to retrieve details of your website within the live preview panel. It can be generated by anyone with access to your stack settings. Each Preview token is associated with a Delivery token and shares access to the specific environment. Therefore, if a Delivery token doesn't exist, you must create a new one, where you can enable the Preview token toggle. For an existing Delivery token, you will find an option to generate a Preview token. Click + Create Preview Token and copy the resulting token.
You can create a Preview token in two ways: either by generating it directly within the Contentstack App while creating a delivery token or by the Content Management API creating a preview token request.
Note: The Preview tokens are exclusively compatible with the new rest-preview.contentstack.com endpoint.
To get further understanding on Delivery tokens, make sure you read our documentation in the “More articles” section