Fetch contact's segments collection

Hi there,

I’m using v2 REST API and would like to ask for a solution to this problem:

My Contacts are assigned to multiple segments. I need a way to get a single contact with its segments lists (could be just IDs). This needs to be done in the most optimal way.

For now I can use Contacts search endpoint where I send a query with filter of segment and Contact ID. This query is repeated as many times as there are segments and it isn’t very optimized solution. It would be nice to know a workaround to minimize the amount of requests made.

Thank you!

Hi Kristis :wave:

Your existing approach is the best option here. That said, we do have a workaround that I can share with you where you can use our Unstable API:

Although you are using a different version of the AP you don’t need to switch your entire API version to Unstable; you can let your app remain as is, and make a curl/http request where you can fetch segments for a contact/company, by either not specifying the Intercom version or specifying unstable in the intercom version header. With a single token, you can use multiple versions of the API.

Let me know if this might work for you.