Transfer and Delete Territories

Purpose

To delete territories with child territories in your organization. Such territories cannot be deleted directly through Delete Territories API. With this API, you can transfer the child territory to another parent territory and delete the territory you want to delete.

Request Details

Request URL

{api-domain}/crm/{version}/settings/territories/{territoryid}/actions/transfer_and_delete
{api-domain}/crm/{version}/settings/territories/actions/transfer_and_delete

Header

Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52

Scope

scope=ZohoCRM.settings.territories.All
 

Sample Request

Copiedcurl "https://www.zohoapis.com/crm/v6/settings/territories/actions/transfer_and_delete"
-X POST
-d "@deleteterritories.json"
-H "Authorization: Zoho-oauthtoken 1000.8cb99dxxxxxxxxxxxxx9be93.9b8xxxxxxxxxxxxxxxf"

In the request, "@deleteterritories.json" contains the sample input.

Request JSON Key
  • idstring, mandatory if ID is not mentioned in the endpoint

    The unique ID of the territory you want to delete.Use the Get Terriotories API to get the ID of the territory.

  • delete_previous_forecastsBoolean, mandatory

    Delete previous forecasts made by the territory

  • transfer_to_idnumber, mandatory

    Parent territory to which child territory must be transferred. This territory must not be at the same heirarchy as the territory you want to delete.

Note

Child territory must not be transferred to a territory that is lower in hierarchy than its current parent territory.

Maximum number of territories that can be deleted in one API call is 10

Sample Request

Copied{
    "territories" : [
     {
            "id" : "431581000000734117",
            "transfer_to_id" : "431581000000734217",
            "delete_previous_forecasts":false
     }
   ]
}
  

Possible Errors

  • INVALID_DATA HTTP 400
    • Transfer_to_id is same as current parent territory
    • Transfer_to_id is not a valid territory
    • Transfer_to_id is not at a higher heirarchy than current parent territory
    • Can't update the Org Territory Properties Except its Name

    Resolution: Refer to the "details" key in the response for the API name of the field that has the error in the input.

Sample Response

Copied{
    "territories": [
        {
            "code": "SUCCESS",
            "details": {
                "id": "431581000000734117"
            },
            "message": "Given Territory Removed Successfully and its child Territories moved to the another territory",
            "status": "success"
        }
    ]
}