Create a New Label

Purpose

The API creates a new label in the specified account. 

OAuth Scope

Use the scope

ZohoMail.tags.ALL (or) ZohoMail.tags.CREATE

to generate the Authtoken.

ALL - Full access to tags.

CREATE - Provides access to create a label.

Request URL

Method : CREATE

https://mail.zoho.com/api/accounts/{accountId}/labels

Path Parameters

  • accountIdlong
    • This parameter is used to identify the account whose details are retrieved.
    • This parameter can be retrieved from the Get User Account Details API.

 

Request Body ( JSON Object)

  • displayName* string
    • Specify a name to the label.
  • color string
    • Specify a color for the label using its hexadecimal value.
    • Default color will be #ffd700

 

* - Mandatory parameter

Response Codes

Refer here for the response codes and their meaning.

Sample Request

Copiedcurl "https://mail.zoho.com/api/accounts/12345678/labels" \
-X POST \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization:Zoho-oauthtoken ***" 
-d '{
   "color": "#FFFFFF",
   "displayName": "Campaigns"
}'

Sample Response

Copied{
"status": {
"code": 201,
"description": "Created"
},
"data": {
"sequence": 4,
"labelId": "9000000014002",
"color": "#FFFFFF",
"tagId": "9000000014002",
"displayName": "Campaigns",
"URI": "https://mail.zoho.com/api/accounts/12345678/labels/9000000014002"
}
}