Add Tags to Records
Purpose
To add tags to records.
Endpoints
- POST /{module_API_name}/actions/add_tags
- POST /{module_API_name}/{record_ID}/actions/add_tags
Request Details
Request URL
To add Multiple Tags to Multiple Records:
{api-domain}/crm/{version}/{module_API_name}/actions/add_tags
To add tags to a specific record:
{api-domain}/crm/{version}/{module_API_name}/{record_ID}/actions/add_tags
Supported modules
Leads, Accounts, Contacts, Deals, Campaigns, Tasks, Cases, Events, Calls, Solutions, Products, Vendors, Price Books, Quotes, Sales Orders, Purchase Orders, Invoices, and Custom modules.
Header
Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52
Scope
ZohoCRM.modules.ALL
(or)
ZohoCRM.modules.{module_name}.{operation_type}
Possible module names
leads, accounts, contacts, deals, campaigns, tasks, cases, events, calls, solutions, products, vendors, pricebooks, quotes, salesorders, purchaseorders, invoices, and custom modules.
Possible operation types
ALL - Full access to the record
WRITE - Edit records in the module
CREATE - Create records in the module
Input JSON
- tagsJSON Object, mandatory
The "name", "id", and "color_code" of the tag you want to add to the records. Refer to the Get the List of Tags API for the available tags and their respective color codes. Note that the ID of the tag takes precedence over the name.
- over_writeBoolean, optional
Specify if the existing tags are to be overwritten. Default value is false.
- idsJSON Array, mandatory when adding tags to multiple records
Specify the unique IDs of the records. You can specify a maximum of 500 records IDs. Retrieve the record IDs using the GET - Records API.
Sample Input to add Multiple Tags to Multiple Records
Copied{
"tags": [
{
"name": "Nurturing Lead",
"id": "4876876000001140124",
"color_code": null
},
{
"name": "Active",
"id": "4876876000001143001",
"color_code": "#F17574"
}
],
"ids": [
"4876876000003643731",
"4876876000003662003"
]
}
Possible Errors
- INVALID_REQUEST_METHODHTTP 400
The http request method type is not a valid one
Resolution: You have specified an invalid HTTP method to access the API URL. Specify a valid request method. Refer to the Endpoints section. - AUTHORIZATION_FAILEDHTTP 400
User does not have sufficient privilege to add tags
Resolution: The user does not have the permission to add tags to the records. Contact your system administrator. - INVALID_MODULEHTTP 400
The module name given seems to be invalid
Resolution: You have specified an invalid module name or there is no tab permission, or the module could have been removed from the available modules. Specify a valid module API name. - INVALID_MODULEHTTP 400
The given module is not supported in API
Resolution: The modules such as Documents and Projects are not supported in the current API. (This error will not be shown, once these modules are been supported). Specify a valid module API name. Use the Modules API to get the module API names. - PATTERN_NOT_MATCHEDHTTP 400
Please check whether the input values are correct
Resolution: The value specified for one of the input keys is incorrect. Refer to the Request JSON section and specify valid values. - RECORD_LOCKEDHTTP 400
You cannot perform this operation as the record is locked.
Resolution: Please wait until the record is unlocked. - OAUTH_SCOPE_MISMATCHHTTP 401
Unauthorized
Resolution: Client does not have ZohoCRM.modules.{module_name}.WRITE scope. Create a new client with valid scope. Refer to the Scope section. - NO_PERMISSIONHTTP 403
Permission denied to update records
Resolution: The user does not have permission to add tags to the records. Contact your system administrator. - INVALID_URL_PATTERNHTTP 404
Please check if the URL trying to access is a correct one
Resolution: The request URL specified is incorrect. Specify a valid request URL. Refer to the Request URL section. - INTERNAL_ERRORHTTP 500
Internal Server Error
Resolution: Unexpected and unhandled exception in Server. Contact support team.
Sample Response
Copied{
"data": [
{
"code": "SUCCESS",
"details": {
"id": "4876876000003643731",
"tags": [
{
"name": "Nurturing Lead",
"id": "4876876000001140124",
"color_code": null
},
{
"name": "Active",
"id": "4876876000001143001",
"color_code": "#F17574"
}
]
},
"message": "tags updated successfully",
"status": "success"
},
{
"code": "SUCCESS",
"details": {
"id": "4876876000003662003",
"tags": [
{
"name": "Nurturing Lead",
"id": "4876876000001140124",
"color_code": null
},
{
"name": "Active",
"id": "4876876000001143001",
"color_code": "#F17574"
}
]
},
"message": "tags updated successfully",
"status": "success"
}
],
"success_count": "2",
"locked_count": "0"
}
Sample Request to Add Tags to a Record
Copiedcurl "https://www.zohoapis.com/crm/v8/Leads/4876876000003643731/actions/add_tags"
-X POST
-d @input.json
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
Copiedag1 = Map();
tag1.put("name","Nurturing Lead");
tag1.put("color_code","#57B1FD");
tag2 = Map();
tag2.put("name","Attend First");
tag2.put("color_code","#E7A826");
tags_list = List();
tags_list.add(tag1);
tags_list.add(tag2);
param = Map();
param.put("tags",tags_list);
res = invokeurl
[
url :"https://www.zohoapis.com/crm/v8/Leads/554023000000846002/actions/add_tags"
type :POST
parameters: param.toString()
connection:"zohooauth"
];
Sample Input to Add Tags to a Single Record
Copied{
"tags": [
{
"name": "Nurturing Lead",
"id": "4876876000001140124",
"color_code": null
},
{
"name": "Active",
"id": "4876876000001143001",
"color_code": "#F17574"
}
]
}
Sample Response
Copied{
"data": [
{
"code": "SUCCESS",
"details": {
"id": "4876876000003643731",
"tags": [
{
"name": "Active",
"id": "4876876000001143001",
"color_code": "#F17574"
},
{
"name": "Nurturing Lead",
"id": "4876876000001140124",
"color_code": null
}
]
},
"message": "tags updated successfully",
"status": "success"
}
]
}