How AI is powering better personalization in e-commerce [with Vercel]. Sign up now

Fetch draft content with GraphQL API for previews

2 repliesLast updated: Nov 29, 2025

Hi all, is it possible to fetch draft content (for previews, using
resolveProductionUrl
) when querying with the GraphQL API?
AI Update

Yes! It is possible to fetch draft content with the GraphQL API for previews. You can use the perspective query parameter to control which version of your content is returned.

Using Perspectives with GraphQL

To fetch draft content, add the perspective query parameter to your GraphQL endpoint. The available options are:

Example for Preview/Draft Mode

For your resolveProductionUrl preview use case, you'd query the GraphQL API like this:

https://<yourProjectId>.apicdn.sanity.io/v2025-02-19/graphql/<dataset>/<tag>?perspective=previewDrafts

The previewDrafts perspective will return draft versions when they exist, falling back to published versions when no draft is available - perfect for preview environments where editors need to see their unpublished changes.

Important Notes

This feature is available in GraphQL API version v2023-08-01 and later, including the current v2025-02-19.

Show original thread
2 replies

Was this answer helpful?

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Related contributions