Get multiple Tagged Contacts through API

Hi,

I wonder if there is a way to get contacts which belong to various tags through a single API call? currently I have this GET API https://api.infusionsoft.com/crm/rest/v1/tags/:tagId/contacts which would retrieve contacts for a single tagId. I am looking to retrieve multiple tagIDs in one call.

Thank you.

Hi @Salman_Javeed,

Yes you can do it, but only via the XML-RPC API. Keap need to do a lot more work on the REST API to make it comparable with the XML-RPC.

The REST v1 and v2 API Endpoints only can query one Tag ID.
https://developer.keap.com/docs/restv2/#tag/Tags/operation/listCompaniesForTagIdUsingGET_1

In the XML-RPC API, there is an equivalent SQL “IN” type query you can perform on the Data API Endpoint.

https://developer.keap.com/docs/xml-rpc/#data-query-a-data-table

Point Number 7 - "7. IN statement ex: Id => [1,2,3,4]**.

What you do is to provide an Array of Tag Ids to the Data Query parameter. In the code, the Tag Ids must be in numerical format, and not an array of Strings. You need to query the “ContactGroupAssign” table on the “GroupId” field.

https://developer.infusionsoft.com/docs/table-schema/#ContactGroupAssign

After running the Query you will get a list of Contacts that are assigned to any of those Tag Ids.

Hope that helps.