Tags endpoints

The Tags endpoints enable you to perform CRUD operations with tags in your Gtmhub account. This group contains endpoints that also enable you to assign a tag to a Gtmhub item.

🔗
get
/tags
Returns all tags matching specified parameters.
Supports filtering, sorting and field projection.
Parameters
NameTypeDescription
gtmhub-accountId
*
stringSpecifies the ID of the gtmhub account.
expected in header, sample value:
5be26318e5274a0007f17f61
filterstringSpecifies the filter in Mongo syntax. For example, to get a single tag by their Id, use filter={"_id":"611fce386400780001b19e1e"}. There is also the option to filter by multiple properties like filter={"$and":[{"itemsTaggedCount":{"$gt":50}},{"isActive":false}]
expected in query, sample value:
{"_id":"611fce386400780001b19e1e"}
sortstringSpecifies the sort expression. For example, to sort tags by their creation date user sort=dateCreated or sort=-dateCreated (to sort in descending order).
expected in query, sample value:
dateCreated
fieldsstringSpecifies the list of fields to be returned in the response. For example, to get only the tag's id, isActive, title or name
expected in query, sample value:
name,title,isActive
skipstringSpecifies how many items to skip from the beginning of the collection. Use this to implement paging. For example, if you want to get tags 5-10 use skip=5&take=5. Always sort your response to ensure that you're paging through the collection in the same order, for example sort=dateCreated&skip=5&take=5.
expected in query, sample value:
5
takestringSpecifies how many items to take from the collection. Use this to implement paging. For example, if you want to get the first 10 tags use take=10. Always sort your response to ensure that you're paging through the collection in the same order, for example sort=dateCreated&take=10.
expected in query, sample value:
10
Expected response codes
200tagsDetailResponse
400bad request
401unauthorized
402payment required
403forbidden
500internal server error

curl -X GET 'https://app.gtmhub.com/api/v2/tags?filter={"_id":"611fce386400780001b19e1e"}&sort=dateCreated&fields=name,title,isActive&skip=5&take=10' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \
-H 'gtmhub-accountId: 5be26318e5274a0007f17f61' \

var settings = { "url": "https://app.gtmhub.com/api/v2/tags?filter={"_id":"611fce386400780001b19e1e"}&sort=dateCreated&fields=name,title,isActive&skip=5&take=10", "method": "GET", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
"gtmhub-accountId": "5be26318e5274a0007f17f61",
}
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v2/tags"



requests.get(url, headers = headers)
{}
🔗
post
/dashboards/{dashboardId}/tags
Adds a tag to the specified dashboard. If this it the first usage of the tag, it will be created.
Parameters
NameTypeDescription
gtmhub-accountId
*
stringSpecifies the ID of the gtmhub account.
expected in header, sample value:
5be26318e5274a0007f17f61
dashboardId
*
stringSpecifies the unique identifier (id) of the dashboard.
expected in path
Expected response codes
200tagResponse
400bad request
401unauthorized
402payment required
403forbidden
404not found
500internal server error

curl -X POST 'https://app.gtmhub.com/api/v1/dashboards/{dashboardId}/tags' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \
-H 'gtmhub-accountId: 5be26318e5274a0007f17f61' \

var settings = { "url": "https://app.gtmhub.com/api/v1/dashboards/{dashboardId}/tags", "method": "POST", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
"gtmhub-accountId": "5be26318e5274a0007f17f61",
}
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v1/dashboards/{dashboardId}/tags"



requests.post(url, headers = headers)
{}
🔗
post
/goals/{id}/tags
Adds a tag to the specified goal. If this is the first usage of the tag it will be created.
Parameters
NameTypeDescription
gtmhub-accountId
*
stringSpecifies the ID of the gtmhub account.
expected in header, sample value:
5be26318e5274a0007f17f61
goalId
*
stringSpecifies the unique identifier of the goal (objective).
expected in path, sample value:
6138969ab6adf10001fc329c
tag
*
The object representing a tag by its title. The tag is identified by the lowercase space trimmed version of the title. A "tag1" item is the same as "Tag1" and " TAG1".
expected in body, sample value:
annual
Expected response codes
201tagResponse
304string message returned by the service
400bad request error message.
500internal server error message.

curl -X POST 'https://app.gtmhub.com/api/v1/goals/{id}/tags' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \
-H 'gtmhub-accountId: 5be26318e5274a0007f17f61' \
-d '{"tag":annual}'

var body ='{"tag":annual}'

var settings = { "url": "https://app.gtmhub.com/api/v1/goals/{id}/tags", "method": "POST", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
"gtmhub-accountId": "5be26318e5274a0007f17f61",
},
"data": body
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v1/goals/{id}/tags"

body = annual;

requests.post(url, data=json.dumps(body), headers = headers)
{}
🔗
post
/insights/{id}/tags
Adds a tag to the specified insight. If this is the first usage of the tag it will be created.
Parameters
NameTypeDescription
gtmhub-accountId
*
stringSpecifies the ID of the gtmhub account.
expected in header, sample value:
5be26318e5274a0007f17f61
id
*
stringSpecifies the the insight ID.
expected in path, sample value:
5be26318e5274a0007f17f61
Expected response codes
201tagResponse
400bad request
401unauthorized
402payment required
403forbidden
500internal server error

curl -X POST 'https://app.gtmhub.com/api/v1/insights/{id}/tags' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \
-H 'gtmhub-accountId: 5be26318e5274a0007f17f61' \

var settings = { "url": "https://app.gtmhub.com/api/v1/insights/{id}/tags", "method": "POST", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
"gtmhub-accountId": "5be26318e5274a0007f17f61",
}
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v1/insights/{id}/tags"



requests.post(url, headers = headers)
{}
🔗
post
/tags
Create new tag
Parameters
NameTypeDescription
gtmhub-accountId
*
stringSpecifies the ID of the gtmhub account.
expected in header, sample value:
5be26318e5274a0007f17f61
Expected response codes
200tagsDetailResponse
400bad request
401unauthorized
402payment required
403forbidden
500internal server error

curl -X POST 'https://app.gtmhub.com/api/v1/tags' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \
-H 'gtmhub-accountId: 5be26318e5274a0007f17f61' \

var settings = { "url": "https://app.gtmhub.com/api/v1/tags", "method": "POST", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
"gtmhub-accountId": "5be26318e5274a0007f17f61",
}
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v1/tags"



requests.post(url, headers = headers)
{}
🔗
post
/tags/activate
Activates tags by tag ids.
Parameters
NameTypeDescription
gtmhub-accountId
*
stringSpecifies the ID of the gtmhub account.
expected in header, sample value:
5be26318e5274a0007f17f61
tagIds
*
An array of tag ids of tags to be activated or deactivated.
expected in body, sample value:
["611fce386400780001b19e1e", "611kge386300780081b19e1e"]
Expected response codes
200changeTagStatusResponse
304string message returned by the service
400bad request error message.
500internal server error message.

curl -X POST 'https://app.gtmhub.com/api/v1/tags/activate' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \
-H 'gtmhub-accountId: 5be26318e5274a0007f17f61' \
-d '{"tagIds":["611fce386400780001b19e1e", "611kge386300780081b19e1e"]}'

var body ='{"tagIds":["611fce386400780001b19e1e", "611kge386300780081b19e1e"]}'

var settings = { "url": "https://app.gtmhub.com/api/v1/tags/activate", "method": "POST", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
"gtmhub-accountId": "5be26318e5274a0007f17f61",
},
"data": body
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v1/tags/activate"

body = ["611fce386400780001b19e1e", "611kge386300780081b19e1e"];

requests.post(url, data=json.dumps(body), headers = headers)
{}
🔗
post
/tags/deactivate
Deactivates tags by tag ids.
Parameters
NameTypeDescription
gtmhub-accountId
*
stringSpecifies the ID of the gtmhub account.
expected in header, sample value:
5be26318e5274a0007f17f61
tagIds
*
An array of tag ids of tags to be activated or deactivated.
expected in body, sample value:
["611fce386400780001b19e1e", "611kge386300780081b19e1e"]
Expected response codes
200changeTagStatusResponse
304string message returned by the service
400bad request error message.
403forbidden
500internal server error message.

curl -X POST 'https://app.gtmhub.com/api/v1/tags/deactivate' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \
-H 'gtmhub-accountId: 5be26318e5274a0007f17f61' \
-d '{"tagIds":["611fce386400780001b19e1e", "611kge386300780081b19e1e"]}'

var body ='{"tagIds":["611fce386400780001b19e1e", "611kge386300780081b19e1e"]}'

var settings = { "url": "https://app.gtmhub.com/api/v1/tags/deactivate", "method": "POST", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
"gtmhub-accountId": "5be26318e5274a0007f17f61",
},
"data": body
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v1/tags/deactivate"

body = ["611fce386400780001b19e1e", "611kge386300780081b19e1e"];

requests.post(url, data=json.dumps(body), headers = headers)
{}
🔗
post
/tags/merge
Merge tags by given ids.
If tag with the given name exists will be used, otherwise it will be created.
Parameters
NameTypeDescription
gtmhub-accountId
*
stringSpecifies the ID of the gtmhub account.
expected in header, sample value:
5be26318e5274a0007f17f61
Body
*
An object that contains two value pairs: "mergeFrom" and "mergeInto".
expected in body
Expected response codes
200ok
400bad request
402payment required
403forbidden
404not found
500internal server error

curl -X POST 'https://app.gtmhub.com/api/v1/tags/merge' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \
-H 'gtmhub-accountId: 5be26318e5274a0007f17f61' \
-d '{"Body":undefined}'

var body ='{"Body":undefined}'

var settings = { "url": "https://app.gtmhub.com/api/v1/tags/merge", "method": "POST", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
"gtmhub-accountId": "5be26318e5274a0007f17f61",
},
"data": body
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v1/tags/merge"

body = undefined;

requests.post(url, data=json.dumps(body), headers = headers)
🔗
post
/tags/suggestions
GenerateGoalTags returns a list of goal tags suggestions.
Parameters
NameTypeDescription
gtmhub-accountId
*
stringSpecifies the ID of the gtmhub account.
expected in header, sample value:
5be26318e5274a0007f17f61
suggestions
*
The object used for auto-tagging generation.
expected in body
Expected response codes
200tagsConfidenceSuggestion
400bad request
401unauthorized
402payment required
403forbidden
500internal server error

curl -X POST 'https://app.gtmhub.com/api/v1/tags/suggestions' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \
-H 'gtmhub-accountId: 5be26318e5274a0007f17f61' \
-d '{"suggestions":undefined}'

var body ='{"suggestions":undefined}'

var settings = { "url": "https://app.gtmhub.com/api/v1/tags/suggestions", "method": "POST", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
"gtmhub-accountId": "5be26318e5274a0007f17f61",
},
"data": body
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v1/tags/suggestions"

body = undefined;

requests.post(url, data=json.dumps(body), headers = headers)
{}
🔗
patch
/tags/{tagId}
Rename given tag by its id.
Parameters
NameTypeDescription
gtmhub-accountId
*
stringSpecifies the ID of the gtmhub account.
expected in header, sample value:
5be26318e5274a0007f17f61
tagId
*
stringThe unique identifier (ID) of the tag that will be renamed.
expected in query, sample value:
"611fce386400780001b19e1e"
title
*
The new title of the tag.
expected in body, sample value:
{"title":"tag-title"}
Expected response codes
204no content
400bad request
402payment required
403forbidden
404not found
500internal server error

curl -X PATCH 'https://app.gtmhub.com/api/v1/tags/{tagId}?tagId="611fce386400780001b19e1e"' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \
-H 'gtmhub-accountId: 5be26318e5274a0007f17f61' \
-d '{"title":{"title":"tag-title"}}'

var body ='{"title":{"title":"tag-title"}}'

var settings = { "url": "https://app.gtmhub.com/api/v1/tags/{tagId}?tagId="611fce386400780001b19e1e"", "method": "PATCH", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
"gtmhub-accountId": "5be26318e5274a0007f17f61",
},
"data": body
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v1/tags/{tagId}"

body = {"title":"tag-title"};

requests.patch(url, data=json.dumps(body), headers = headers)
🔗
delete
/dashboards/{dashboardId}/tags
Removes the tag from the specified dashboard.
The tag will not be deleted even if the specified dashboard is the only item tagged with it.
Parameters
NameTypeDescription
gtmhub-accountId
*
stringSpecifies the ID of the gtmhub account.
expected in header, sample value:
5be26318e5274a0007f17f61
dashboardId
*
stringSpecifies the unique identifier (id) of the dashboard.
expected in path
Expected response codes
204no content
400bad request
401unauthorized
402payment required
403forbidden
404not found
500internal server error

curl -X DELETE 'https://app.gtmhub.com/api/v1/dashboards/{dashboardId}/tags' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \
-H 'gtmhub-accountId: 5be26318e5274a0007f17f61' \

var settings = { "url": "https://app.gtmhub.com/api/v1/dashboards/{dashboardId}/tags", "method": "DELETE", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
"gtmhub-accountId": "5be26318e5274a0007f17f61",
}
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v1/dashboards/{dashboardId}/tags"



requests.delete(url, headers = headers)
🔗
delete
/goals/{id}/tags
Removes the tag from the specified goal. The tag will not be deleted even if the specified goal is the only item tagged with it.
Parameters
NameTypeDescription
gtmhub-accountId
*
stringSpecifies the ID of the gtmhub account.
expected in header, sample value:
5be26318e5274a0007f17f61
goalId
*
stringSpecifies the unique identifier of the goal (objective).
expected in path, sample value:
6138969ab6adf10001fc329c
tag
*
The object representing a tag by its title. The tag is identified by the lowercase space trimmed version of the title. A "tag1" item is the same as "Tag1" and " TAG1".
expected in body, sample value:
annual
Expected response codes
204no content
500internal server error message.

curl -X DELETE 'https://app.gtmhub.com/api/v1/goals/{id}/tags' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \
-H 'gtmhub-accountId: 5be26318e5274a0007f17f61' \
-d '{"tag":annual}'

var body ='{"tag":annual}'

var settings = { "url": "https://app.gtmhub.com/api/v1/goals/{id}/tags", "method": "DELETE", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
"gtmhub-accountId": "5be26318e5274a0007f17f61",
},
"data": body
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v1/goals/{id}/tags"

body = annual;

requests.delete(url, data=json.dumps(body), headers = headers)
🔗
delete
/insights/{id}/tags
Removes the tag from the specified insight. The tag will not be deleted even if the specified insight is the only item tagged with it.
Parameters
NameTypeDescription
gtmhub-accountId
*
stringSpecifies the ID of the gtmhub account.
expected in header, sample value:
5be26318e5274a0007f17f61
id
*
stringSpecifies the the insight ID.
expected in path, sample value:
5be26318e5274a0007f17f61
Expected response codes
204no content
400bad request
401unauthorized
402payment required
403forbidden
404not found
500internal server error

curl -X DELETE 'https://app.gtmhub.com/api/v1/insights/{id}/tags' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \
-H 'gtmhub-accountId: 5be26318e5274a0007f17f61' \

var settings = { "url": "https://app.gtmhub.com/api/v1/insights/{id}/tags", "method": "DELETE", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
"gtmhub-accountId": "5be26318e5274a0007f17f61",
}
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v1/insights/{id}/tags"



requests.delete(url, headers = headers)
🔗
delete
/tags
Bulk delete of provided tags ids.
Parameters
NameTypeDescription
gtmhub-accountId
*
stringSpecifies the ID of the gtmhub account.
expected in header, sample value:
5be26318e5274a0007f17f61
tagIds
*
An array of tag ids of tags to be deleted.
expected in body
Expected response codes
200deleteTagResponse
400bad request
401unauthorized
402payment required
403forbidden
500internal server error

curl -X DELETE 'https://app.gtmhub.com/api/v1/tags' \ -H 'Content-Type: application/json' \ -H 'Accept: application/json' \ -H 'Authorization: Bearer {token}' \
-H 'gtmhub-accountId: 5be26318e5274a0007f17f61' \
-d '{"tagIds":undefined}'

var body ='{"tagIds":undefined}'

var settings = { "url": "https://app.gtmhub.com/api/v1/tags", "method": "DELETE", "timeout": 0, "headers": { "Content-Type": "application/json", "Accept": "application/json", "Authorization": "Bearer {token}",
"gtmhub-accountId": "5be26318e5274a0007f17f61",
},
"data": body
}; $.ajax(settings).done(function (response) { console.log(response); });
 NOTE: You must install the module requests.
In a terminal window do: pip install requests



import requests, json

headers = { "Authorization" : "Bearer {token}", "gtmhub-accountId" : "{accountId}", "Content-Type" : "application/json" };

url = "https://app.gtmhub.com/api/v1/tags"

body = undefined;

requests.delete(url, data=json.dumps(body), headers = headers)
{}