Exchange a single-use preview grant for an ongoing preview session
POST/projects/{projectSlug}/preview/sessionRequires 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* | string | The project's slug |
Request body
grant* | string | The grant token returned by POST .../preview-token |
Responses
| 200 | A revocable session token to store as an HttpOnly cookie, plus what it resolves to |
| 401 | Missing, 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"
}