Request Details

Request URL

{api-domain}/crm/{version}/{module_api_name}/actions/remove_tags?ids={record_id1},{record_id2}&tag_names={tag1},{tag2}

To remove tags from specific records:
{api-domain}/crm/{version}/{module_api_name}/{record_id}/actions/remove_tags?tag_names={tag1},{tag2}

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

Parameters

  • tag_namesstring, optional

    Specify the names of the tags you want to remove from the record.

  • idsstring, mandatory when removing tags from multiple records

    Specify comma separated records IDs from which the tags must be removed.

Sample Request to Remove Multiple Tags from Multiple Records

Copiedcurl "https://www.zohoapis.com/crm/v2.1/Leads/actions/remove_tags?ids=3652397000003971077,3652397000003971108&tag_names=Pharma,Agricultural"
-X POST
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
4.0.04.x
Copied//Get instance of TagsOperations Class
$tagsOperations = new TagsOperations();
//Get instance of ParameterMap Class
$paramInstance = new ParameterMap();
foreach($tagNames as $tagName)
{
    $paramInstance->add(RemoveTagsFromRecordParam::tagNames(), $tagName);
}
//Call removeTagsFromRecord method that takes paramInstance, moduleAPIName and recordId as parameter
$response = $tagsOperations->removeTagsFromRecord($recordId, $moduleAPIName,$paramInstance);


//Get instance of TagsOperations Class
$tagsOperations = new TagsOperations();
$paramInstance = new ParameterMap();
foreach($tagNames as $tagName)
{
    $paramInstance->add(RemoveTagsFromMultipleRecordsParam::tagNames(), $tagName);
}
foreach($recordIds as $recordId)
{
    $paramInstance->add(RemoveTagsFromMultipleRecordsParam::ids(), $recordId);
}
//Call RemoveTagsFromMultipleRecordsParam method that takes paramInstance, moduleAPIName as parameter
$response = $tagsOperations->removeTagsFromMultipleRecords($moduleAPIName, $paramInstance);
Copied<?php

class RemoveTagsfromRecords
{
    public function execute(){
        $curl_pointer = curl_init();
        
        $curl_options = array();
        $url = "https://www.zohoapis.com/crm/v2.1/Leads/actions/remove_tags?";
        $parameters = array();
        $parameters["ids"]="3524033000005495065";
        $parameters["tag_names"]="Leads";
        $parameters["over_write"]="true";
        
        foreach ($parameters as $key=>$value){
            $url =$url.$key."=".$value."&";
        }
        $curl_options[CURLOPT_URL] =$url;
        $curl_options[CURLOPT_RETURNTRANSFER] = true;
        $curl_options[CURLOPT_HEADER] = 1;
        $curl_options[CURLOPT_CUSTOMREQUEST] = "POST";
        
        $headersArray = array();
        
        $headersArray[] = "Authorization". ":" . "Zoho-oauthtoken " . "1000.30f3a589XXXXXXXXXXXXXXXXXXX4077.dc5XXXXXXXXXXXXXXXXXXXee9e7c171c";
        
        $curl_options[CURLOPT_HTTPHEADER]=$headersArray;
        
        curl_setopt_array($curl_pointer, $curl_options);
        
        $result = curl_exec($curl_pointer);
        $responseInfo = curl_getinfo($curl_pointer);
        curl_close($curl_pointer);
        list ($headers, $content) = explode("\r\n\r\n", $result, 2);
        if(strpos($headers," 100 Continue")!==false){
            list( $headers, $content) = explode( "\r\n\r\n", $content , 2);
        }
        $headerArray = (explode("\r\n", $headers, 50));
        $headerMap = array();
        foreach ($headerArray as $key) {
            if (strpos($key, ":") != false) {
                $firstHalf = substr($key, 0, strpos($key, ":"));
                $secondHalf = substr($key, strpos($key, ":") + 1);
                $headerMap[$firstHalf] = trim($secondHalf);
            }
        }
        $jsonResponse = json_decode($content, true);
        if ($jsonResponse == null && $responseInfo['http_code'] != 204) {
            list ($headers, $content) = explode("\r\n\r\n", $content, 2);
            $jsonResponse = json_decode($content, true);
        }
        var_dump($headerMap);
        var_dump($jsonResponse);
        var_dump($responseInfo['http_code']);
        
    }
    
}
(new RemoveTagsfromRecords())->execute();
2.1.0
Copied# Get instance of TagsOperations Class
to = Tags::TagsOperations.new
# Get instance of ParameterMap Class
pm = ParameterMap.new
# Possible parameters of remove Tags to record  operation
tag_names.each do |tag_name|
  pm.add(Tags::TagsOperations::RemoveTagsFromRecordParam.tag_names, tag_name)
end
# pm.add(Tags::TagsOperations::RemoveTagsFromRecordParam.over_write,"false")
# Call remove_tags_from_record method that takes ParameterMap instance and module_api_name as parameter
response = to.remove_tags_from_record(record_id, module_api_name, pm)



# Get instance of TagsOperations Class
to = Tags::TagsOperations.new
# Get instance of ParameterMap Class
pm = ParameterMap.new
# Possible parameters of remove Tags from records operation
tag_names.each do |tag_name|
  pm.add(Tags::TagsOperations::RemoveTagsFromMultipleRecordsParam.tag_names, tag_name)
end
record_ids.each do |record_id|
  pm.add(Tags::TagsOperations::RemoveTagsFromMultipleRecordsParam.ids, record_id)
end
pm.add(Tags::TagsOperations::AddTagsToRecordParam.over_write, 'false')
# Call remove_tags_from_multiple_records method that takes ParameterMap instance, module_api_name as parameters
response = to.remove_tags_from_multiple_records(module_api_name,pm)
Copied<?php

class RemoveTagsfromRecords
{
    public function execute(){
        $curl_pointer = curl_init();
        
        $curl_options = array();
        $url = "https://www.zohoapis.com/crm/v2.1/Leads/actions/remove_tags?";
        $parameters = array();
        $parameters["ids"]="3524033000005495065";
        $parameters["tag_names"]="Leads";
        $parameters["over_write"]="true";
        
        foreach ($parameters as $key=>$value){
            $url =$url.$key."=".$value."&";
        }
        $curl_options[CURLOPT_URL] =$url;
        $curl_options[CURLOPT_RETURNTRANSFER] = true;
        $curl_options[CURLOPT_HEADER] = 1;
        $curl_options[CURLOPT_CUSTOMREQUEST] = "POST";
        
        $headersArray = array();
        
        $headersArray[] = "Authorization". ":" . "Zoho-oauthtoken " . "1000.30f3a589XXXXXXXXXXXXXXXXXXX4077.dc5XXXXXXXXXXXXXXXXXXXee9e7c171c";
        
        $curl_options[CURLOPT_HTTPHEADER]=$headersArray;
        
        curl_setopt_array($curl_pointer, $curl_options);
        
        $result = curl_exec($curl_pointer);
        $responseInfo = curl_getinfo($curl_pointer);
        curl_close($curl_pointer);
        list ($headers, $content) = explode("\r\n\r\n", $result, 2);
        if(strpos($headers," 100 Continue")!==false){
            list( $headers, $content) = explode( "\r\n\r\n", $content , 2);
        }
        $headerArray = (explode("\r\n", $headers, 50));
        $headerMap = array();
        foreach ($headerArray as $key) {
            if (strpos($key, ":") != false) {
                $firstHalf = substr($key, 0, strpos($key, ":"));
                $secondHalf = substr($key, strpos($key, ":") + 1);
                $headerMap[$firstHalf] = trim($secondHalf);
            }
        }
        $jsonResponse = json_decode($content, true);
        if ($jsonResponse == null && $responseInfo['http_code'] != 204) {
            list ($headers, $content) = explode("\r\n\r\n", $content, 2);
            $jsonResponse = json_decode($content, true);
        }
        var_dump($headerMap);
        var_dump($jsonResponse);
        var_dump($responseInfo['http_code']);
        
    }
    
}
(new RemoveTagsfromRecords())->execute();
Copiedresponse = invokeurl
[
	url :"https://www.zohoapis.com/crm/v2.1/Leads/actions/remove_tags?ids=3652397000003971077,3652397000003971108&tag_names=Pharma,Agricultural"
	type :POST
	connection:"crm_oauth_connection"
];
info response;

Sample Response

Copied{
    "data": [
        {
            "code": "SUCCESS",
            "details": {
                "id": "3652397000003971077",
                "tags": []
            },
            "message": "tags updated successfully",
            "status": "success"
        },
        {
            "code": "SUCCESS",
            "details": {
                "id": "3652397000003971108",
                "tags": []
            },
            "message": "tags updated successfully",
            "status": "success"
        }
    ],
    "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 remove tags
    Resolution: The user does not have permission to remove tags from 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 remove tags
    Resolution: The user does not have the permission to remove tags from 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.

Sample Request to Remove Tags from a Record

Copiedcurl "https://www.zohoapis.com/crm/v2.1/Leads/3652397000003971077/actions/remove_tags?tag_names=Pharma,Chem"
-X POST
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
Copiedresponse = invokeurl
[
url :"https://www.zohoapis.com/crm/v2.1/Leads/3652397000003971077/actions/remove_tags?tag_names=Pharma,Chem"
	type :POST
	connection:"crm_oauth_connection"
];
info response;

Sample Response

Copied{
    "data": [
        {
            "code": "SUCCESS",
            "details": {
                "id": "3652397000003971077",
                "tags": []
            },
            "message": "tags updated successfully",
            "status": "success"
        }
    ]
}