Skip to main content
Question

How to iterate paginated Contacts search results


Request

POST https://api.intercom.io/contacts/search
Accept:
application/json
Content-Type: application/json
Intercom-Version: 2.4
Authorization: Bearer token
 
{
"query": {
"operator": "AND",
"value": [
{
"field": "email",
"operator": "~",
"value": "timur+1"
}
]
}
}

results in

{
"type": "list",
"data": [...],
"total_count": 78,
"pages": {
"type": "pages",
"next": {
"page": 2,
"starting_after": "Wy0xLCI1ZjIyYzQzZjkxMjU5NmY1MDNiMjA4ZWUiLDJd"
},
"page": 1,
"per_page": 50,
"total_pages": 2
}
}

But next request

POST https://api.intercom.io/contacts/search?starting_after=Wy0xLCI1ZjIyYzQzZjkxMjU5NmY1MDNiMjA4ZWUiLDJd
Accept:
application/json
Content-Type: application/json
Intercom-Version: 2.4
Authorization: Bearer token
 
{
"query": {
"operator": "AND",
"value": [
{
"field": "email",
"operator": "~",
"value": "timur+1"
}
]
}
}

returns first page again. How to retrieve second page?

Did this topic help you find an answer to your question?

3 replies

  • Author
  • Connector
  • 6 replies
  • January 7, 2022

  • Author
  • Connector
  • 6 replies
  • January 7, 2022

And why pagination interface can't be unique throughout the API?


Racheal
Intercom Team
Forum|alt.badge.img+5
  • Customer Support Engineer
  • 512 replies
  • September 19, 2022

Hey @timur​ 

 

Pagination has it's own section within our API, and we link to pagination in our list contacts endpoint, as this is where the pagination would occur. Definitely understand it can be tricky navigating around the API docs! As we mention here when listing any Contact objects, we will instead use a cursor-based approach, our Search resources will instead use a POST-based approach.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings