Request Details

Request URL

https://www.zohoapis.com/bigin/v1/{module_api_name}/actions/remove_tags?ids={entity_id}&tag_names={tag1},{tag2}

To remove tags from specific records:
https://www.zohoapis.com/bigin/v1/{module_api_name}/{record_id}/actions/remove_tags?tag_names={tag1},{tag2}

Supported modules

Accounts, Contacts, Deals, Tasks, Events, Calls, Products and Activities

Header

Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52

Scope

scope=ZohoBigin.modules.ALL
(or)
scope=ZohoBigin.modules.{module_name}.{operation_type}

Possible module names

accounts, contacts, deals, tasks, events, calls, products

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

Copiedcurl "https://www.zohoapis.com/bigin/v1/Contacts/actions/remove_tags?ids=1234567890,123456789&tag_names=From Email,In progress"
-X POST
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"
3.0.08.0
CopiedString moduleAPIName = "Leads";
ArrayList<Long> recordIds = new ArrayList<Long>(Arrays.asList(3477061000005623115L, 3477061000006114067L));
ArrayList<String> tagNames = new ArrayList<String>(Arrays.asList("addtag1,addtag12"));

//Get instance of TagsOperations Class
TagsOperations tagsOperations = new TagsOperations();

ParameterMap paramInstance = new ParameterMap();

for (String tagName: tagNames) {
    paramInstance.add(RemoveTagsFromMultipleRecordsParam.TAG_NAMES, tagName);
}

for (Long recordId: recordIds) {
    paramInstance.add(RemoveTagsFromMultipleRecordsParam.IDS, recordId);
}

//Call RemoveTagsFromMultipleRecordsParam method that takes moduleAPIName, paramInstance as parameter
APIResponse < RecordActionHandler > response = tagsOperations.removeTagsFromMultipleRecords(moduleAPIName, paramInstance);
Copiedpackage com.zoho.crm.api.sample.restapi.tag;
import javax.net.ssl.SSLContext;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.client.utils.URIBuilder;
import org.apache.http.conn.ssl.NoopHostnameVerifier;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
public class RemoveTagsfromRecords 
{
	private static void removeTagsfromRecords()
	{
		try
		{
			HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
			SSLContext sslContext = SSLContext.getDefault();
			SSLConnectionSocketFactory sslConnectionSocketFactory = new SSLConnectionSocketFactory(sslContext, NoopHostnameVerifier.INSTANCE);
			CloseableHttpClient httpclient = httpClientBuilder.setSSLSocketFactory(sslConnectionSocketFactory).build();
			URIBuilder uriBuilder = new URIBuilder("https://www.zohoapis.com/crm/v2/Leads/actions/remove_tags");
			uriBuilder.addParameter("ids", "34770617753001,34770617736020");
			uriBuilder.addParameter("tag_names", "Leads");
			HttpUriRequest requestObj = new HttpPost(uriBuilder.build());
			requestObj.addHeader("Authorization", "Zoho-oauthtoken 1000.xxxxxxx.xxxxxxx");
			HttpResponse response = httpclient.execute(requestObj);
			HttpEntity responseEntity = response.getEntity();
			System.out.println("HTTP Status Code : " + response.getStatusLine().getStatusCode());
			if(responseEntity != null)
			{
				Object responseObject = EntityUtils.toString(responseEntity);
				String responseString = responseObject.toString();
				System.out.println(responseString);
			}
		}
		catch(Exception ex)
		{
			ex.printStackTrace();
		}
	}
	private static void removeTagsfromRecord()
	{
		try
		{
			HttpClientBuilder httpClientBuilder = HttpClientBuilder.create();
			SSLContext sslContext = SSLContext.getDefault();
			SSLConnectionSocketFactory sslConnectionSocketFactory = new SSLConnectionSocketFactory(sslContext, NoopHostnameVerifier.INSTANCE);
			CloseableHttpClient httpclient = httpClientBuilder.setSSLSocketFactory(sslConnectionSocketFactory).build();
			URIBuilder uriBuilder = new URIBuilder("https://www.zohoapis.com/crm/v2/Leads/34770617753001/actions/remove_tags");
			uriBuilder.addParameter("tag_names", "Leads1");
			HttpUriRequest requestObj = new HttpPost(uriBuilder.build());
			requestObj.addHeader("Authorization", "Zoho-oauthtoken 1000.xxxxxxx.xxxxxxx");
			HttpResponse response = httpclient.execute(requestObj);
			HttpEntity responseEntity = response.getEntity();
			System.out.println("HTTP Status Code : " + response.getStatusLine().getStatusCode());
			if(responseEntity != null)
			{
				Object responseObject = EntityUtils.toString(responseEntity);
				String responseString = responseObject.toString();
				System.out.println(responseString);
			}
		}
		catch(Exception ex)
		{
			ex.printStackTrace();
		}
	}
	public static void main(String[] args) 
	{
		removeTagsfromRecords();
		removeTagsfromRecord();
	}
}
3.0.07.x
Copied//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/Leads/actions/remove_tags?";
        $parameters = array();
        $parameters["ids"]="35240335495065";
        $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.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf";
        
        $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();
Copieddef remove_tag_multiple_records(self):
        try:
            tag_names = ["4", "5"]
            record_ids = ["3719520000000320001", "3719520000000318001"]
            resp = ZCRMModule.get_instance("Leads").remove_tags_from_multiple_records(tag_names, record_ids)
            entity_responses = resp.bulk_entity_response
            for entity_response in entity_responses:
                print(entity_response.details)
                print(entity_response.status)
                print(entity_response.message)
                print(entity_response.code)
                print(entity_response.data.entity_id)
                for tag in entity_response.data.tag_list:
                    print(tag.name)
        except ZCRMException as ex:
            print(ex.status_code)
            print(ex.error_message)
            print(ex.error_code)
            print(ex.error_details)
            print(ex.error_content)
CopiedZCRMModule moduleIns = ZCRMModule.GetInstance("Leads"); // module api name
List<string> tagNames = new List<string> { "Name7", "Name8" };
List<long> recordIds = new List<long> { 3372164000001494008, 3372164000001295433 };
BulkAPIResponse<ZCRMRecord> response = moduleIns.RemoveTagsFromRecords(recordIds, tagNames); //recordIds list of record id, tagNames list of tag names
List<ZCRMRecord> records = response.BulkData; //records - list of ZCRMRecord instances
List<EntityResponse> entityResponses = response.BulkEntitiesResponse; // entityResponses - list of EntityResponse instance
Copiedresponse = invokeurl
[
	url :"https://www.zohoapis.com/crm/v2/Leads/actions/remove_tags?ids=692969000000968004,692969000000981055&tag_names=Agriculture,Chems"
	type :POST
	connection:"crm_oauth_connection"
];
info response;

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

Sample Response

Copied{
    "data": [
       {
            "code": "SUCCESS",
            "details": {
                "id": "2445013000000402006",
                "tags": [
                    "From Email",
                    "In Progress"
                ]
            },
            "message": "tags updated successfully",
            "status": "success"
        },
       {
            "code": "SUCCESS",
            "details": {
                "id": "2445013000000141005",
                "tags": [
                    "From Webforms",
                    "Negotiation"
                ]
            },
            "message": "tags updated successfully",
            "status": "success"
        }
    ]
}