About Delivery Tokens
Delivery Tokens are read-only credentials used with a stack's API key to retrieve published content from a specific environment via the Content Delivery API. These tokens provide secure and restricted access to content within that environment.
Key Features
- A Delivery Token can be associated with all branches or restricted to a specific branch. Similarly, it can be assigned to all aliases or a single alias, enabling you to fetch content from the respective branches.
- Contentstack does not create Delivery Tokens automatically. You need to manually create a Delivery Token for each environment.
- Each Delivery Token is tied to a single environment, so separate tokens must be created for each environment in a stack. This enhances content security by ensuring only authorized users can access the appropriate environment. For example, testers can access only the “staging” environment, while content managers access only the “production” environment.
- Delivery Tokens are used only for published content and do not grant access to unpublished or draft content.
Note: The number of Delivery Tokens you can create depends on your plan. You can contact Contentstack Support to increase the limit.
Now that we’ve covered Delivery Tokens for accessing published content in specific environments, let’s explore how Preview Tokens build on that foundation to enable real-time content previews.
Understanding Preview Tokens
Preview Tokens are credentials that allow users to get live preview data from their website’s preview panel. They are linked to a Delivery Token and can be generated by anyone with access to your stack settings.
You must create a Delivery Token before enabling the Preview Token feature. For existing Delivery Tokens, a Preview Token can be generated using the option provided within the Contentstack App or via a Create a Preview Token request.
Note: Preview Tokens are exclusively limited to the rest-preview.contentstack.com endpoint to ensure that they are used solely for retrieving live preview data. They are not compatible with other endpoints.
Example Use Case: Preview Tokens in a Staging Environment
Consider a scenario where a content team is preparing articles for publication. To ensure quality and accuracy, you set up a dedicated staging environment that allows team members to preview draft content before it goes live.
In this workflow:
- A Delivery Token is created and scoped to the “staging” environment.
- A corresponding Preview Token is then generated from that Delivery Token.
Editors and QA testers can view how the unpublished content appears on the staging site by accessing the preview panel via the rest-preview.contentstack.com endpoint.
This process allows stakeholders to collaborate in real time and to address potential issues such as formatting errors, broken links, or incorrect data before publishing. It streamlines editorial and testing workflows, ensuring that content is reviewed thoroughly without being exposed to the production environment.