Preview

Exchange a single-use preview grant for an ongoing preview session

POST/projects/{projectSlug}/preview/session

Requires an active preview session — either the cairn_preview cookie set by createPreviewHandler, or a preview session token sent as Authorization: Bearer <token>.

Path parameters

projectSlug*stringThe project's slug

Request body

grant*stringThe grant token returned by POST .../preview-token

Responses

200A revocable session token to store as an HttpOnly cookie, plus what it resolves to
401Missing, invalid, expired, already-used, or mismatched grant

Request

curl -X POST "https://api.cairn.press/projects/my-project/preview/session" \
  -H "Authorization: Bearer $CAIRN_PREVIEW_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"grant":"string"}'

Response · 200

{
  "sessionToken": "string",
  "expiresAt": "2026-01-15T09:24:00.000Z",
  "datasetId": "string",
  "view": "draft",
  "documentType": "string",
  "documentId": "string"
}