Transfer and Delete Territories
Purpose
To delete territories with child territories in your Zoho CRM 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.
End points
- POST /settings/territories/actions/transfer_and_delete
- POST /settings/territories/{territory_ID}/actions/transfer_and_delete
Request Details
Request URL
To transfer and delete a specific territory:
{api-domain}/crm/{version}/settings/territories/{territory_ID}/actions/transfer_and_delete
To transfer and delete multiple territories:
{api-domain}/crm/{version}/settings/territories/actions/transfer_and_delete
Header
Authorization: Zoho-oauthtokend92d4xxxxxxxxxxxxx15f52
Scope
scope=ZohoCRM.settings.territories.All
Sample Request
Copiedcurl "https://www.zohoapis.com/crm/v8/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
- idstring, mandatory if ID is not mentioned in the endpoint
The unique ID of the territory you want to delete.Use the Get Territories 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 hierarchy 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.
- OAUTH_SCOPE_MISMATCHHTTP 401
The access token you have used to make this API call does not have the required scope.
Resolution: Generate a new access token with the required scopes for this API. Refer to Scope section at the beginning of this page for the list of required scopes. - INVALID_URL_PATTERNHTTP 404
The request URL is incorrect.
Resolution: Specify a valid request URL. Refer to request URL section at the beginning of this page for more details. - INTERNAL_ERRORHTTP 500
Unexpected and unhandled exception in the server.
Resolution: Contact the support team at support@zohocrm.com.
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"
}
]
}