Retrieving all tags for a contact vs. Groups field in the Contact


We are attempting to setup a sync for InfusionSoft and we need to be able to retrieve all contacts and their associated tags.We are using the Data service XML-RPC API and are able to retrieve the contacts just fine. However, when it comes to tags, if if I include the field Groups in Contacts table, I get a list of IDs that I can look up in ContactGroups for tag names. It seemed to work fine but I’m now noticing that if I were to delete any tags or apply new tags, the Groups field still has the same number of GroupIDs. I’m wondering if anyone else has run into this and what is the workaround. I can issue a separate call for each contact id against the ContactGroupAssign table but we are going to run out of our API allocation (and will start get throttled if we did this). Please let me know.


The Groups field is limited and is meant for more of a “snapshot” as it can only hold so much information. The table the has one row for every tag assigned to a contact would be ContactGroupAssign. Query that table for tag assignment information and you’ll have more “luck”.

Thanks John. The issue I have is that there are over a million rows in that table in our case. That would be a 1000 calls plus another 600 calls for contacts themselves. I guess we will still be within the limit. That seems to be the sure fire way of doing this (for now). I checked just now and the ‘Groups’ field did get updated with the latest - there was just a delay. Do you have any idea on how long before it gets updated (or if there is a max number of entries that will show up in that field. I’m trying to ascertain the risk involved in the current strategy.

I think the update time is more a product of priority rather than a set limit. At high volume times (when contacts take priority) you might notice delays but at 3am in the morning you may find there is none.

I have heard in the past that there is a slight delay with the Contact - Groups field not being updated immediately. Although I think it could be down to the size of your database as well. But I would say within 5 minutes it should be updated.

I have recently been doing a sync development work as well. My approach of populating the assigned Tags is to extract them from the Contact table Groups field. It would take too long pulling them from the ContactGroupAssign table. Also, that table does not have any Last Updated column making it difficult to track what tags have been updated, plus nor can see what Tags have been removed. The Contact table is the best way to track updated data.

The only caveat from the Contact - Groups field is that if you need to track the Date the Tag was assigned, then you will have to read the ContactGroupAssign table.

I’ll add here that if you want to know when a tag has been applied that you could also create a saved search with the “Tag Application” report that is sorted by LastUpdated (which essentially is the SQL equivalent of ORDER BY) and then read the results with the data object.

I can do the same in the API table as well. Problem is when Tags get deleted, is that you would have to rebuild the Contact Tags Assigned sync table again. So using the Contact LastUpdated is a way to identify something has changed, and can rebuild the Tags just for that Contact.

Pav, I’m not seeing that the Contact’s LastUpdated is always updated when tags are removed or added. Are you seeing that LastUpdated is always updated when tags are applied or removed? I think it may depend on how it is done. If I do it from the console and simply delete a tag from the Contact display or add it (without saving the user - which isn’t required), the LastUpdated field isn’t updated. This has meant that I retrieve all contacts and do an internal compare to see if any tags have changed.

@John, I’ll look into this saved search idea. I need to look into APIs to call a ‘saved search’ if that’s the case.

So it’s actually the Search object which you can find here:

and I’m pretty sure the LastUpdated shows based on the table (which happens faster than the Groups field getting updated).

Again, in SQL parlance, I think it would be something similar to a COMMIT charge using a TRIGGER for the GROUP field where as the saved search has results from the direct update to the table. It would take testing to prove this but from what I’ve seen that is what it looks like.

Yes I agree, it is not consistent to where things are being done. In my client scenario the automated actions are causing the LastUpdated field to be always updated.

If you want real time syncing, you could use the Webhooks API functionality. It will trigger a HTTP POST on activity done in specific main areas like the Contacts. Its not available in every area.

If I manually apply/remove a Tag the Webhook is not triggered. But doing it via the API the Webhook is triggered.