Preview drafts before they go live

5 min read

Editors want to see how a change looks before the world does. Mojimoto serves drafts through the same delivery API, gated behind a token ability so production can never accidentally leak unpublished work.

Mint a preview token

On the API keys page, create a custom token and tick the preview ability. Keep this token to your staging environment — unlike the public read token, it can see unpublished drafts.

Ask for the draft

Add ?ref=preview to any delivery request. The API returns the latest draft for each entry, falling back to the published version where no newer draft exists. References resolve to their drafts too, so a preview is internally consistent.

curl
curl "https://your-domain.com/api/v1/your-project/documents?ref=preview&uid=hello-world" \
  -H "Authorization: Bearer mjmt_your_preview_token"

A read-only token that requests ?ref=preview is refused with a 403 — the preview ability is required. Preview responses are marked no-store so they are never cached.

Wire it to your framework

Most frameworks have a preview or draft mode. Point that mode at your preview token and add ref=preview to the request; point normal production rendering at the public read token without it. Same code, two tokens.

Next

Build it for real

Spin up a project and try this in your own space — free for 14 days.

© 2026 Mojimoto, Inc. 文 · モジモト