How to use draft posts and preview

How to save drafts in microCMS and preview them before publishing.

Saving drafts

Click "Save as draft" in the editor to store the article as draft instead of published. Draft content is not returned by the list/detail API by default.

Previewing drafts

To preview a draft, use the URL from the "Preview" button in the dashboard. That URL includes a draftKey query parameter.

On the front end, pass draftKey to your detail API to fetch the draft.

GET /api/article?endpoint=news&contentId=xxx&draftKey=yyyy

Example preview page

Add a route like /news/draft/[id] and pass route.query.draftKey to the API. When you open the preview link from microCMS, the draft will load.

  • Access without draftKey → fetches published article (or 404)
  • Access with draftKey → fetches draft and shows preview

Scheduled publishing

Set a future publish date to use scheduled publishing. You can still preview the content before it goes live.