POST /hub/v1/nestedtags

Creates a tag that can be associated with any object that accepts tagging. The tag must contain a unique name. The tag can contain a description and a list of one or more nested tags.

JSON Parameters 

NameTypeDescription
namestringRequired. Name of the tag, up to 120 characters. The only special characters allowed are period (.) and apostrophe (’).
descriptionstringDescription of the tag, up to 256 characters. The only special characters allowed are period (.), apostrophe (’), comma (,), and forward slash (/).
parentIdstringTagId that you want to be the parent of this tag. If you don’t provide a parentId, or if you specify zero as the parentId, the tag is created as a root tag with no parent.
tagsstringA list of tags to create as nested tags. To include no nested tags, omit this field. You can add and modify nested tags using the Update Nested Tags or Patch Nested Tags requests.

Responses 

StatusNameTypeDescription
201  Response includes the newly created tag and all of its properties, including nested tags at the level specified by the depth parameter.
 idintegerTagId of the tag.
 namestringName of the tag.
 descriptionstringDescription of the tag.
 parentIdstringTagId of the parent tag. This field is null or zero if no parent tag exists.
 tagsobjectA list of the tag’s nested tags. Add and modify nested tags using the Update Nested Tags or Patch Nested Tags requests.

Usage 

This example creates a tag using only a name.

1Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com
2
3POST /hub/v1/nestedtags
4Content-Type: application/json
5Authorization: Bearer YOUR_ACCESS_TOKEN
6
7{
8    "name": "Membership Level"
9}

The response includes information about the tag.

1HTTP/1.1 202 Accepted
2{
3  "id": 14,
4  "name": "Membership Level",
5  "description": "",
6  "modifiedDate": "2019-06-14T11:07:00",
7  "parentId": 0,
8  "tags": []
9}

This example creates a parent tag with nested tags.

1Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com
2POST /hub/v1/nestedTags
3Content-Type: application/json
4Authorization: Bearer YOUR_ACCESS_TOKEN
5
6{
7    "name": "Membership Level",
8    "tags": [
9        {
10            "name": "Gold",
11            "description": "Gold Membership Level"
12        },
13        {
14            "name": "Silver",
15            "description": "Silver Membership Level"
16        },
17        {
18            "name": "Bronze",
19            "description": "Bronze Membership Level"
20        }
21    ]
22}

The response includes information about the primary tag and the nested tags.

1HTTP/1.1 202 Accepted
2{
3  "id": 14,
4  "name": "Membership Level",
5  "description": "",
6  "modifiedDate": "2019-06-14T11:07:00",
7  "parentId": 0,
8  "tags": [
9    {
10      "id": 15,
11      "name": "Bronze",
12      "description": "Bronze Membership Level",
13      "modifiedDate": "2019-06-14T11:07:00",
14      "parentId": 14,
15      "tags": []
16    },
17    {
18      "id": 16,
19      "name": "Gold",
20      "description": "Gold Membership Level",
21      "modifiedDate": "2019-06-14T11:07:00",
22      "parentId": 14,
23      "tags": []
24    },
25    {
26      "id": 17,
27      "name": "Silver",
28      "description": "Silver Membership Level",
29      "modifiedDate": "2019-06-14T11:07:00",
30      "parentId": 14,
31      "tags": []
32    }
33  ]
34}

This example adds a new nested tag under an existing tag.

1Host: https://YOUR_SUBDOMAIN.rest.marketingcloudapis.com
2POST /hub/v1/nestedtags
3Content-Type: application/json
4Authorization: Bearer YOUR_ACCESS_TOKEN
5
6{
7    "name": "Platinum",
8    "description": "Platinum Membership Level",
9parentId”: 14
10}

The response includes information about the nested tag.

1HTTP/1.1 200 Accepted
2{
3  "id": 18,
4  "name": "Platinum",
5  "description": "Platinum Membership Level",
6  "modifiedDate": "2019-06-14T11:58:00",
7  "parentId": 14
8}