Preview & Drafts

See content before it goes live. A preview key reads draft entries in addition to published ones, so a staging or preview build can render work in progress.

Preview keys

Create a key with the preview scope (wrk_preview_…). Use it against the exact same endpoints as the read key — it simply also returns draft entries.

bash
curl "https://api.wriven.com/v1/projects/PROJECT_ID/content/blog_post" \
  -H "Authorization: Bearer wrk_preview_xxx"
// NEVER CACHEDPreview responses are returned with Cache-Control: private, no-store. Keep preview keys server-side — they expose unpublished content.

Wiring up preview mode

Point your framework's preview/draft mode at a route that fetches with the preview key. In Next.js, enable Draft Mode and read the preview token from a server-only env var so drafts never reach production visitors.

javascript
// app/preview/route.ts — toggle Next.js Draft Mode
import { draftMode } from "next/headers";

export async function GET() {
  (await draftMode()).enable();
  return Response.redirect("/");
}
Next.js Guide