Request Details

Request URL

{api-domain}/crm/{version}/{module_api_name}/actions/add_tags

To add tags to a specific record:
https://www.zohoapis.com/crm/v3/{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, Custom, and Activities

Header

Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52

Scope

scope=ZohoCRM.modules.ALL
(or)
scope=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

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.

Sample Request to Add Multiple Tags to Multiple Records

Copiedcurl "https://www.zohoapis.com/crm/v3/Leads/actions/add_tags"
-X POST
-d @input.json
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
Copiedtag1 = 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);
recordIDs = List();
recordIDs.add('554023000002365002');
recordIDs.add('554023000001736019');
param.put("ids",recordIDs);

res = invokeurl
[
	url :"https://www.zohoapis.com/crm/v3/Leads/actions/add_tags"
	type :POST
	parameters: param.toString()
	connection:"zohooauth"
];

Sample Input

Copied{
    "tags": [
        {
            "name": "Nurturing Lead",
            "id": "4876876000001140124",
            "color_code": null
        },
        {
            
            "name": "Active",
            "id": "4876876000001143001",
            "color_code": "#F17574"
        }
    ],
    "ids": [
        "4876876000003643731",
        "4876876000003662003"
    ]
}

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"
}

Possible Errors

  • 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 request URL section above.

  • 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 scope section above.

  • 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.

  • INTERNAL_ERRORHTTP 500

    Internal Server Error
    Resolution: Unexpected and unhandled exception in Server. Contact support team.

  • 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 endpoints section above.

  • 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.

  • PATTERN_NOT_MATCHEDHTTP 400

    Please check whether the input values are correct
    Resolution: The value specified for one of the parameters is incorrect. Refer to parameters section above and specify valid parameter values.

  • RECORD_LOCKEDHTTP 400

    You cannot perform this operation as the record is locked.
    Resolution: Please wait until the record is unlocked.

Sample Request to Add Tags to a Record

Copiedcurl "https://www.zohoapis.com/crm/v3/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/v3/Leads/554023000000846002/actions/add_tags"
	type :POST
	parameters: param.toString()
	connection:"zohooauth"
];

Sample Input

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"
        }
    ]
}