A bug in REST API search endpoint pagination.
Asked by Albert Cie?lak:

Hello,

We are using the Trello Rest API in our BigPicture plugin. We noticed, that some cards from the endpoint GET /1/search appear on cards_page=0 as well as cards_page=1. Duplicated cards are nondeterministic. We use the following requests:

[https://api.trello.com/1/search?query=is:open+created:100000+sort:created\&modelTypes=cards\&cards_limit=500\&cards_page=0\&cards_fields=\&card_list=true\&card_members=true\&idBoards=5f5b2321f3b21b1abcf7fba5](https://api.trello.com/1/search?query=is:open+created:100000+sort:created&modelTypes=cards&cards_limit=500&cards_page=0&cards_fields=&card_list=true&card_members=true&idBoards=5f5b2321f3b21b1abcf7fba5)

[https://api.trello.com/1/search?query=is:open+created:100000+sort:created\&modelTypes=cards\&cards_limit=500\&cards_page=1\&cards_fields=\&card_list=true\&card_members=true\&idBoards=5f5b2321f3b21b1abcf7fba5](https://api.trello.com/1/search?query=is:open+created:100000+sort:created&modelTypes=cards&cards_limit=500&cards_page=1&cards_fields=&card_list=true&card_members=true&idBoards=5f5b2321f3b21b1abcf7fba5)

Albert Cieslak  
Softwareplant


Answers:
author: bentley
body: As [@Iain Dooley](/t5/user/viewprofilepage/user-id/1416112) mentioned, it'd be better to post this in the developer forum: <https://community.developer.atlassian.com/>. You're likely to find more API experts over there.

It sounds like there is a bug and I'll look into that.

As a workaround, any reason not to ask for all of the cards from the board directly? The search endpoint is better-suited to looking for cards matching a query across a set of boards. It doesn't look like you're using a query nor searching more than one board. I believe it'd be much more performant to make a request to the board's cards nested resource: <https://developer.atlassian.com/cloud/trello/rest/api-group-boards/#api-boards-id-checklists-post>


author: Bart?omiej Ja?czak _SoftwarePlant_
body: Report available under <https://community.developer.atlassian.com/t/a-bug-in-rest-api-search-endpoint-pagination/41767>


author: Iain Dooley
body: [@Albert Cie?lak](/t5/user/viewprofilepage/user-id/4084766) I can verify this is occurring, I took this code:

<https://gist.github.com/iaindooley/132d78cf547af7aa219c8302cdbb19cf>

and ran it in BenkoBot here:

<https://app.benkobot.com/>

and it produced this output:

```
Duplicate id: 5b835034317af003201e402e found at element: 0 on page: 3
Duplicate id: 5e8e61127645162f34fb7117 found at element: 1 on page: 4
Duplicate id: 5f220468e5b7934721039e6f found at element: 2 on page: 4
Duplicate id: 5de455c22a56df2818f268ee found at element: 1 on page: 5
Duplicate id: 5db1f1d0e3f8ba12a48d473e found at element: 3 on page: 6
Duplicate id: 5f600723e9900966f0545438 found at element: 6 on page: 6
Duplicate id: 5f1bf11e06d25e0e4ebf0f50 found at element: 1 on page: 7
Duplicate id: 5f5e2f809d71f74155537b72 found at element: 0 on page: 8
Duplicate id: 5f54edfca0a42d4537646e5c found at element: 3 on page: 9
Duplicate id: 5f5ee943bb328f63d84083a8 found at element: 0 on page: 10
Duplicate id: 5f5e25151681c93399fbd1b0 found at element: 0 on page: 13
Duplicate id: 5f49d6728c97a3310e230e7a found at element: 2 on page: 14
Duplicate id: 5ea8dc9aa44a2d79555658f7 found at element: 1 on page: 21
Duplicate id: 5ec449c0c3f3f565d6a9e240 found at element: 2 on page: 21
Duplicate id: 5e7a754ca5fe0e72ce7964dd found at element: 7 on page: 24
Duplicate id: 5ecf1cb14218bd11fa966865 found at element: 2 on page: 25
Duplicate id: 5ec73d919b49488bafbb90ae found at element: 3 on page: 25
Duplicate id: 5ed59ec331be002c6d6f3dec found at element: 4 on page: 25
Duplicate id: 5efd51196034fe7a2486691e found at element: 6 on page: 25
Duplicate id: 5f17d9d030c76241e0361e69 found at element: 0 on page: 28
Duplicate id: 5db8f3e223b9986e6de0e04e found at element: 1 on page: 28
Duplicate id: 5d4111403627560a47eb75f2 found at element: 2 on page: 28
Duplicate id: 5d6c864e5a030266b880893e found at element: 3 on page: 28
Duplicate id: 5cf35c4e78ea7a37b9fc1663 found at element: 4 on page: 28
Duplicate id: 5da3b2a0d807646e6a786ed1 found at element: 5 on page: 28
```

I think you should report this over at:

<https://community.developer.atlassian.com/>

Feel free to reference my example as well to corroborate your report, this definitely seems like a bug in the API because you would expect results throughout all the pages of a single board search to be unique.