# Prismic API - pageSize not working

**URL:** <https://community.prismic.io/t/prismic-api-pagesize-not-working/9891>\
**Category:** Developing with Prismic\
**Tags:** nextjs\
**Created:** [April 27, 2022, 2:15pm UTC](https://community.prismic.io/t/prismic-api-pagesize-not-working/9891 "2022-04-27T14:15:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![gabriel.cioci](https://avatars.discourse-cdn.com/v4/letter/g/2acd7d/32.png) [@gabriel.cioci](https://community.prismic.io/u/gabriel.cioci)\
**Post date:** [April 27, 2022, 2:15pm UTC](https://community.prismic.io/t/prismic-api-pagesize-not-working/9891/1 "2022-04-27T14:15:37Z")

</div>

Hello,

I'm currently working on a project with NextJs + Prismic, where I need to get only a small amount of documents (for performance reasons) and I tried to use the _ **pageSize** _ parameter but it seems like it doesn't work. It's set to pageSize=3 but it always returns all the documents.

I've also searched for similar issues and it seems like other users had problems with it too.

Here is the query:

```auto
   await client.getAllByType("blog_post", {
        fetchLinks: ['author.name', 'author.avatar', 'author.position'],
        pageSize: 3
    });

```

Thanks for your help!

---

<div class="post-metadata">

**Author:** ![Priyanka](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/priyanka/32/3223_2.png) [@Priyanka](https://community.prismic.io/u/Priyanka)\
**Post date:** [April 27, 2022, 2:42pm UTC](https://community.prismic.io/t/prismic-api-pagesize-not-working/9891/3 "2022-04-27T14:42:03Z")

</div>

Hello @gabriel.cioci

Welcome to the Prismic community and thanks for reaching out to us.

`pageSize` parameters should return 3 documents if it's set so. I can not recreate the issue with my repository. If you can send me your repo URL I'll check with it(You can send me a private message though)

Thanks,  
Priyanka

---

<div class="post-metadata">

**Author:** ![gabriel.cioci](https://avatars.discourse-cdn.com/v4/letter/g/2acd7d/32.png) [@gabriel.cioci](https://community.prismic.io/u/gabriel.cioci)\
**Post date:** [April 28, 2022, 9:09am UTC](https://community.prismic.io/t/prismic-api-pagesize-not-working/9891/4 "2022-04-28T09:09:57Z")

</div>

Hello Priyanka, I've sent the repo URL as a pm, can you take a look?

Thanks

---

<div class="post-metadata">

**Author:** ![Priyanka](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/priyanka/32/3223_2.png) [@Priyanka](https://community.prismic.io/u/Priyanka)\
**Post date:** [April 28, 2022, 9:30am UTC](https://community.prismic.io/t/prismic-api-pagesize-not-working/9891/6 "2022-04-28T09:30:55Z")

</div>

Hello @gabriel.cioci

I have sent you a private message.

Thanks,  
Priyanka

---

<div class="post-metadata">

**Author:** ![moorenmike](https://avatars.discourse-cdn.com/v4/letter/m/a698b9/32.png) [@moorenmike](https://community.prismic.io/u/moorenmike)\
**Post date:** [May 5, 2022, 9:41pm UTC](https://community.prismic.io/t/prismic-api-pagesize-not-working/9891/11 "2022-05-05T21:41:25Z")

</div>

Hi Priyanka,  
Do you mind sharing the solution here?  
I am experiencing the same issue.  
Cheers,  
Mike

---

<div class="post-metadata">

**Author:** ![Pau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/pau/32/5422_2.png) [@Pau](https://community.prismic.io/u/Pau)\
**Post date:** [May 10, 2022, 1:26am UTC](https://community.prismic.io/t/prismic-api-pagesize-not-working/9891/12 "2022-05-10T01:26:15Z")

</div>

Hello @moorenmike, the team suggests two options:

**1. `getAllByType()` with `limit`:**  
`getAllByType()` will fetch all documents. To limit the number of documents returned, the `limit` option can be passed. Once the function reaches that limit, it will stop requesting pages.

```auto
await client.getAllByType('page', { limit: 3 })

```

**2. `getByType()` with `pageSize`:**  
`getByType()` only fetches one page, thus `pageSize` will limit the results to the size of that single page. The response will include the pagination metadata along with the data using this method, however, so you’ll need to access the results using `res.results`.

```auto
await client.getByType('page', { pageSize: 1 })

```
