If we’re adding new contacts via API, is there a way to just include the text version of tags in the request, or do we have to fetch a list of all tags to look up the tag IDs first using List Tags, and if the tag doesn’t already exist, we have to use Create Tag before inserting the Contact record? That seems like a much more complicated process than just adding the actual tag value to the contact.
Good morning Paul!
Contact names are not unique, so we do not support any method of addressing them in the system. I would think you’d want to just tag all of the relevant Contacts at once, using the returned Ids from their creation? The sequence of calls usually goes something like this:
- Add Contact 1
- Add Contact 2
- Add Contact 3
- Retrieve Tags and identify Ids of relevant tags
- Apply Tag A to Contact 1 and Contact 2
- Apply Tag B to Contact 3
I hope this helps!
- Tom Scott
Keap API Engineer
Tom: Thanks for the reply. To be clear, it’s not the Contact we want to address by name, it’s the tags. Sounds like we have to do the Retrieve Tags call to get the proper tag IDs lined up with their names.
Also, are you saying that tag names are not unique in the system, too (i.e. we could have more than one tag with the same name but under different tag categories?)
Correct, Tag names are not unique, except within the same Tag Category.
Hi @Paul_Strauss, just wanted to share you the logic on what you need to do.
- Query the Tag by Name.
- If there is a Match, then use the Tag ID.
- If there is no Match, then add the Tag, and use the Tag ID returned.
That will avoid you creating duplicate Tags.