Preview

Mint a preview grant

POST/projects/{projectSlug}/datasets/{datasetSlug}/preview-token

Requires 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

viewstringWhich side of a document to preview - defaults to draft
documentTypestringRequired alongside documentId
documentIdstringScopes the token to redirecting straight at one document

Responses

200A signed, single-use preview grant, scoped to this project+dataset - exchange it for a session via POST .../preview/session
400documentId given without documentType
404Unknown 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"
}