Api 2.0 Contacts pagination contains duplicate values

Hello,
i am trying to go through all results to get all contacts but when using pagination i am getting duplicated contacts and when pages are over some results are missing.

The first query is https://api.intercom.io/contacts/per_page=2

The result contains contacts with ids:
5e3a8503a1843dbfd8ad8a8a
5e383cdee40bdeba5ec3add4

Pages class contains
page=1
starting_after=WzAsIjVlMzgzY2RlZTQwYmRlYmE1ZWMzYWRkNCIsMl0=

So the next query i do is
https://api.intercom.io/contacts/?starting_after=WzAsIjVlMzgzY2RlZTQwYmRlYmE1ZWMzYWRkNCIsMl0%3D&per_page=2

And results that are returned are
5e3838ca73787b96be83611a
5e383cdee40bdeba5ec3add4 - is already duplicate

Pages class contains
page=2
starting_after=WzAsIjVlMzgzY2RlZTQwYmRlYmE1ZWMzYWRkNCIsMl0=

Next query
/contacts/?starting_after=WzAsIjVlMzgzY2RlZTQwYmRlYmE1ZWMzYWRkNCIsM10%3D&per_page=2

And results that are returned are
5e3838ca73787b96be83611a - identical to previous result
5e383cdee40bdeba5ec3add4 - identical to previous result

Pages class contains
page=3
starting_after=WzAsIjVlMzgzY2RlZTQwYmRlYmE1ZWMzYWRkNCIsNF0=

So page number is actually changes to correct ones in pages class.
Results are repeated and starting_after is changed only after 3rd request.

Do i do something incorrectly?
What would be the best way to get all contacts without duplication?

Thank you!

Hey There! :wave:

This one will require some investigation by our engineers and they may need access to your workspace.

Could you reach out to us on the messenger?

Thanks!

Hello,

I do have exactly the same problem.

At first, “starting_after” returns me the base64 encoding of [LARGE_INTEGER_ID?,"<NEW_PAGING_TOKEN>",PREVIOUS_PAGE+1] (I am not sure what the first parameter is supposed to be)

Then after about 80 pages, the “starting_after” response element turns to: [0,"<SAME_AS_PREVIOUS_TOKEN>",PREVIOUS_PAGE+1]. So I see that the page number element continues to iterate, but I keep getting the same results over and over.

Any fixes on this yet? I have 285 contacts on my platform but just requesting the users with default settings (no custom sorting or filtering) and “per_page” set to 150 records and using starting_after results in 300 records (aka duplicates).

First call has the following parameters qs
qs: {per_page: 150}

Second call:
qs: {per_page: 150, starting_after: “WzAsIjVlYjE3YWIwNjMwNTMzOTNhZWI1MTg2ZiIsMl0=”}

Both calls return 150

When not using a per_page and just letting Intercom choose itself (seems to be 10). My program seems to be only able to fetch 185 of the 285 records. The last call will return an empty data but at the same time the pages object has the following fields:
page: 20
per_page: 10
total_pages: 27
type: “pages”

Meaning that there are 7 more pages but I have no starting_after to work with.

Combined with the current call returning 0 records and the previous call only returning 5 records in data (instead of 10), it also does not add up to the 100 records I am missing.

We are also seeing the same issue of duplicate contacts across pages.

Having the same issue, getting duplicate results for every page which makes little logical sense. I tried “page” and “pages” for the pagination key to see if that would make any difference…

POST
https://api.intercom.io/contacts/search

Body is Valid JSON query that returns valid results…
pagination key: “Pages”
cursor key: “next.starting_after”