# How to fetch draft/autosaved content before publishing in Next.js?

**URL:** <https://forum.builder.io/t/how-to-fetch-draft-autosaved-content-before-publishing-in-next-js/15923>\
**Category:** General\
**Tags:** nextjs\
**Created:** [November 6, 2025, 11:19am UTC](https://forum.builder.io/t/how-to-fetch-draft-autosaved-content-before-publishing-in-next-js/15923 "2025-11-06T11:19:58Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rahulhc](https://avatars.discourse-cdn.com/v4/letter/r/e56c9b/32.png) [@rahulhc](https://forum.builder.io/u/rahulhc)\
**Post date:** [November 6, 2025, 11:19am UTC](https://forum.builder.io/t/how-to-fetch-draft-autosaved-content-before-publishing-in-next-js/15923/1 "2025-11-06T11:19:58Z")

</div>

I’m trying to view draft content from [Builder.io](http://Builder.io) in my Next.js 15 app before publishing. I can see published content fine, but need to preview autosaved changes.

**Setup:**

- Next.js 15 (App Router)

**What I’ve tried:**

_// Attempt 1: includeUnpublished_

const content = await builder.get(“page”, {

userAttributes: { urlPath: “/my-page” },

options: { includeUnpublished: true, cachebust: true }

}).toPromise();

_// Still shows published version_

_// Attempt 2: builder.overrides_

const draftUrl = `[https://cdn.builder.io/api/v3/content/page?apiKey=${apiKey}&userAttributes.urlPath=${urlPath}&builder.overrides.page=${contentId}&builder.preview=page&builder.noCache=true&builder.cachebust=true\`](https://cdn.builder.io/api/v3/content/page?apiKey=$%7BapiKey%7D&userAttributes.urlPath=$%7BurlPath%7D&builder.overrides.page=$%7BcontentId%7D&builder.preview=page&builder.noCache=true&builder.cachebust=true%5C%60);

_// Still shows published version_

**Question:**

How do I fetch the latest autosaved/draft content (unpublished changes) in Next.js? Is there a specific API endpoint or parameter I’m missing?

The page has hasAutosaves: true but I can only see published content regardless of parameters used.

Thanks! 🙏

---

<div class="post-metadata">

**Author:** ![manish-sharma](https://avatars.discourse-cdn.com/v4/letter/m/8797f3/32.png) [@manish-sharma](https://forum.builder.io/u/manish-sharma)\
**Post date:** [November 6, 2025, 7:39pm UTC](https://forum.builder.io/t/how-to-fetch-draft-autosaved-content-before-publishing-in-next-js/15923/2 "2025-11-06T19:39:48Z")

</div>

Hello @rahulhc ,

Thank you for reaching out and for sharing the details of your setup and tests.

In your current implementation, it looks like the `includeUnpublished` flag is being passed inside the `options` object. This parameter should instead be passed at the **top level** of the API call, not within `options`.

Here’s an updated example that should correctly fetch autosaved or unpublished content:

```js
const content = await builder.get('page', {
  userAttributes: {
    urlPath: '/my-page',
  },
  includeUnpublished: true,
  cachebust: true,
}).toPromise();

```

This ensures the Builder API includes unpublished or draft versions when available.

You can find more details and working examples in our documentation here:

> **[Content API](https://www.builder.io/c/docs/content-api#code-include-unpublished-code)**
>
> Learn how to use Builder's Content API to make requests to retrieve data about any of your models. Write queries with dot notation and MongoDB style operators.

Please give this a try and let me know if you’re still unable to retrieve draft content afterward.

Thanks,
