Setting the file. One moment.
Subchapter 3.13
references/content-preview/overview.mdMarkdown3 KBView on GitHub
The Preview API returns draft and changed content before it’s published. Same endpoints and query parameters as the CDA, but with a different base URL and token.
https://preview.contentful.comhttps://preview.eu.contentful.comUse a Preview access token (not the CDA token):
curl https://preview.contentful.com/spaces/{space_id}/environments/master/entries \
-H "Authorization: Bearer {preview_token}"Create Preview tokens at: Settings → API keys → Content Preview API - access token
CDA (cdn.contentful.com) | Preview (preview.contentful.com) | |
|---|---|---|
| Token | CDA access token | Preview access token |
| Content | Published only | Published + draft + changed |
| Caching | CDN-cached, fast | No caching, slower |
| Use case | Production apps | Content preview, editorial tools |
All CDA endpoints, query parameters, and features work identically:
# Get entries
curl "https://preview.contentful.com/spaces/{space_id}/environments/master/entries?content_type=blogPost" \
-H "Authorization: Bearer {preview_token}"
# Get single entry (including unpublished drafts)
curl "https://preview.contentful.com/spaces/{space_id}/environments/master/entries/{entry_id}" \
-H "Authorization: Bearer {preview_token}"
# Query with filters
curl "https://preview.contentful.com/spaces/{space_id}/environments/master/entries?content_type=blogPost&fields.slug=draft-post&include=2" \
-H "Authorization: Bearer {preview_token}"
# Get assets (including unprocessed/unpublished)
curl "https://preview.contentful.com/spaces/{space_id}/environments/master/assets" \
-H "Authorization: Bearer {preview_token}"
# Sync API works too
curl "https://preview.contentful.com/spaces/{space_id}/environments/master/sync?initial=true" \
-H "Authorization: Bearer {preview_token}"