Mint a preview grant
POST/projects/{projectSlug}/datasets/{datasetSlug}/preview-tokenRequires a project token (Dashboard → Settings → API tokens), sent as Authorization: Bearer <token>. Keep it server-side — never prefix it with NEXT_PUBLIC_.
Path parameters
projectSlug* | string | |
datasetSlug* | string |
Request body
view | string | Which side of a document to preview - defaults to draft |
documentType | string | Required alongside documentId |
documentId | string | Scopes the token to redirecting straight at one document |
Responses
| 200 | A signed, single-use preview grant, scoped to this project+dataset - exchange it for a session via POST .../preview/session |
| 400 | documentId given without documentType |
| 404 | Unknown project/dataset, or documentId doesn't exist |
Request
curl -X POST "https://api.cairn.press/projects/my-project/datasets/staging/preview-token" \
-H "Authorization: Bearer $CAIRN_TOKEN" \
-H "Content-Type: application/json" \
-d '{"view":"draft"}'Response · 200
{
"token": "string"
}