# How can we get draft pages from builder.io in next js app

**URL:** <https://forum.builder.io/t/how-can-we-get-draft-pages-from-builder-io-in-next-js-app/2525>\
**Category:** Technical Questions\
**Tags:** nextjs\
**Created:** [August 26, 2022, 7:44am UTC](https://forum.builder.io/t/how-can-we-get-draft-pages-from-builder-io-in-next-js-app/2525 "2022-08-26T07:44:50Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![olivela](https://avatars.discourse-cdn.com/v4/letter/o/2bfe46/32.png) [@olivela](https://forum.builder.io/u/olivela)\
**Post date:** [August 26, 2022, 7:44am UTC](https://forum.builder.io/t/how-can-we-get-draft-pages-from-builder-io-in-next-js-app/2525/1 "2022-08-26T07:44:50Z")

</div>

How we can get unpublished pages from [builder.io](http://builder.io) ?  
is there any Api to get all the pages published and unpublished (draft) pages?

---

<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:** [August 26, 2022, 3:34pm UTC](https://forum.builder.io/t/how-can-we-get-draft-pages-from-builder-io-in-next-js-app/2525/2 "2022-08-26T15:34:43Z")

</div>

Hi @olivela,

Thanks for reaching out.

Yes, you can get the latest draft from the API, it requires knowing the content ID, so you’d make an extra API Call to get the latest draft, something like:

```auto
import { builder } from "@builder.io/react" // or `@builder.io/sdk`

builder.init(process.env.BUILDER_API_KEY)
export async function resolveBuilderContent(modelName: string, userAttributes: Record<string, string | number>, loadLatestDraft = false) {
  let page = await builder.get(modelName, { userAttributes }).toPromise();
  if (page && loadLatestDraft) {
      page = await fetch(`https://builder.io/api/v2/content/${modelName}/${page.id}?apiKey=${apiKey}&preview=true&noCache=true&cachebust=true`).then(res => res.json())
  }

  return page;
}

```

To know more you can visit our forum post [API parameter to include not yet live content](https://forum.builder.io/t/api-parameter-to-include-not-yet-live-content/361).

Let us know if you have any further questions. Thank you!

---

<div class="post-metadata">

**Author:** ![olivela](https://avatars.discourse-cdn.com/v4/letter/o/2bfe46/32.png) [@olivela](https://forum.builder.io/u/olivela)\
**Post date:** [August 29, 2022, 6:28am UTC](https://forum.builder.io/t/how-can-we-get-draft-pages-from-builder-io-in-next-js-app/2525/3 "2022-08-29T06:28:58Z")

</div>

always getting undefined response for draft pages .  
is there any other way to get Draft pages ?

---

<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:** [August 29, 2022, 2:37pm UTC](https://forum.builder.io/t/how-can-we-get-draft-pages-from-builder-io-in-next-js-app/2525/4 "2022-08-29T14:37:49Z")

</div>

Hi @olivela,

You can also fetch the draft pages with the builder.get() method passing the option `includeUnpublished=true`. You can find more help at [Builder Content API](https://www.builder.io/c/docs/query-api).

Let us know if you have any further questions. Thank you!
