Contact - Tag Management

Groundhogg API provides two different endpoints to manage Tags. You can manage tags using /contacts/ endpoint or you can manage tags using /tags/  endpoint.

List Contact Tags

You can list all the tags applied to contacts by making a GET HTTP request to the contacts tag endpoint. while making this request you need to pass the email address or ID of a contact.

http://yoursite.com/wp/wp-json/gh/v3/contacts/tags?id_or_email=1<br>

This request fetches list of tag applied to contact and return a list of tag ids.

{
    "tags": [
        3,
	5,
	8
    ],
    "status": "success"
}

Applying/removing Tags

You can apply tags by making a PUT or PATCH request to contact's apply tag URL. It requires email or ID of contact. id_or_email and tags array are the require arguments while making this request.

You can also perform this operation by setting “id_or_email” to the user id of a user and passing by_user_id = true.

URL to Apply Tags: https://yoursite.com/wp/wp-json/gh/v3/contacts/apply_tags
URL to Remove Tags: https://yoursite.com/wp/wp-json/gh/v3/contacts/remove_tags
Body:
{
    "id_or_email":"1",
    "tags" : [ 
        1, 
        2, 
        3, 
        "user", 
        "confirm" 
    ]
}

this request updates the contact and applies or removes a set of tags passed in tags array based on the requested URL. Body arguments for applying and removing tags remain the same only URL changes. the response from apply tag request looks like follows.

{     
	"status": "success" 
}
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us