Zoho: Create Territories
Zoho territories.createTerritories: arguments, response, policy and SDK examples.
← Territories operations · Get started
Operation zoho.createterritories
Provider route: POST /crm/v8/settings/territories. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”Install @alter-ai/sdk @alter-ai/zoho with npm, or alter-sdk-zoho with pip. Supply your connected customer’s grant ID and the arguments described below.
import { App } from "@alter-ai/sdk";import { ZohoIntegration } from "@alter-ai/zoho";
async function execute(input: Parameters<ZohoIntegration["territories"]["createTerritories"]>[0]) { const app = new App({ apiKey: process.env.ALTER_API_KEY! }); try { const provider = new ZohoIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! }); const call = await provider.territories.createTerritories(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom alter_sdk_zoho import ZohoIntegration
async def execute(arguments): async with App(api_key=os.environ["ALTER_API_KEY"]) as app: provider = ZohoIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]}) call = await provider.territories.create_territories(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
body | object | Required within parent | Specify the territories to create in your organization. Additional keys: not allowed |
body.territories | array | Required within parent | Specify the list of territories to create. Maximum items: 100 Minimum items: 1 |
body.territories[] | object | Each item | Specify the details for each territory to create. Additional keys: not allowed |
body.territories[].account_rule_criteria | JSON | Optional | Specify the criteria for auto-assigning accounts to the territory. To remove an existing criteria, set this field to null. |
body.territories[].account_rule_criteria (anyOf 1) | Model | Alternative | Expand Related Records — request body — query filters value |
body.territories[].account_rule_criteria (anyOf 2) | Model | Alternative | Expand Related Records — request body — query / filters / group_operator: AND, OR, and, or |
body.territories[].account_rule_criteria (anyOf 3) | null | Alternative | Represents the absence of an account rule criteria. Set this value to remove any existing account rule criteria from the territory. Must equal: null |
body.territories[].deal_rule_criteria | JSON | Optional | Specify the criteria for auto-assigning deals to the territory. To remove an existing criteria, set this field to null. |
body.territories[].deal_rule_criteria (anyOf 1) | Model | Alternative | Expand Related Records — request body — query filters value |
body.territories[].deal_rule_criteria (anyOf 2) | Model | Alternative | Expand Related Records — request body — query / filters / group_operator: AND, OR, and, or |
body.territories[].deal_rule_criteria (anyOf 3) | null | Alternative | Represents the absence of a deal rule criteria. Set this value to remove any existing deal rule criteria from the territory. Must equal: null |
body.territories[].description | string or null | Optional | Specify the description for the territory. Maximum length: 250 |
body.territories[].lead_rule_criteria | JSON | Optional | Specify the criteria for auto-assigning leads to the territory. To remove an existing criteria, set this field to null. |
body.territories[].lead_rule_criteria (anyOf 1) | Model | Alternative | Expand Related Records — request body — query filters value |
body.territories[].lead_rule_criteria (anyOf 2) | Model | Alternative | Expand Related Records — request body — query / filters / group_operator: AND, OR, and, or |
body.territories[].lead_rule_criteria (anyOf 3) | null | Alternative | Represents the absence of a lead rule criteria. Set this value to remove any existing lead rule criteria from the territory. Must equal: null |
body.territories[].manager | JSON | Optional | |
body.territories[].manager (anyOf 1) | object | Alternative | Represents a territory manager specified by user ID. Additional keys: not allowed |
body.territories[].manager (anyOf 1).id | string | Required within parent | Specify the unique ID of the user to assign as the territory manager. Maximum length: 19 |
body.territories[].manager (anyOf 2) | null | Alternative | Represents the absence of a territory manager. Set this value to remove any assigned manager from the territory. Must equal: null |
body.territories[].name | string | Required within parent | Specify the name of the territory. Maximum length: 50 |
body.territories[].permission_type | string | Required within parent | Specify the access permission for users in this territory. Possible values: read_write_delete - Grants users read, write, and delete access to records assigned to the territory. read_only - Grants users read-only access to records assigned to the territory. One of: read_write_delete, read_only |
body.territories[].reporting_to | JSON | Required within parent | |
body.territories[].reporting_to (anyOf 1) | object | Alternative | Represents the parent territory to which this territory reports in the hierarchy. Additional keys: not allowed |
body.territories[].reporting_to (anyOf 1).id | string | Required within parent | Specify the unique ID of the parent territory. Format: int64 |
body.territories[].reporting_to (anyOf 2) | null | Alternative | Represents the absence of a parent territory. Set this field to null when the territory has no parent in the hierarchy. Must equal: null |
Referenced models: Related Records — request body — query / filters / group_operator: AND, OR, and, or, Related Records — request body — query filters value
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | Model | Root | Expand Create Territories — response body |
Referenced models: Create Territories — response body
Schemas
Section titled “Schemas”11 more schemas are linked from the tables above, on the schema pages.
Related Records — request body — query / filters / group_operator: AND, OR, and, or
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Represents a grouped filter criterion containing multiple filter conditions evaluated with a logical operator. Supports recursive nesting for complex filtering logic. Additional keys: not allowed |
group | array | Required within parent | Contains an array of filter conditions grouped together and evaluated with the specified logical operator. Maximum items: 25 Minimum items: 2 |
group[] | JSON | Each item | |
group[] (anyOf 1) | Model | Alternative | Expand Related Records — request body — query filters value |
group[] (anyOf 2) | Model | Alternative | Expand Related Records — request body — query / filters / group_operator: AND, OR, and, or |
group_operator | string | Required within parent | Represents the logical operator applied between the filter conditions in the group. Possible values: AND - All conditions in the group must be satisfied. OR - At least one condition in the group must be satisfied. and - Equivalent to AND; all conditions in the group must be satisfied. or - Equivalent to OR; at least one condition in the group must be satisfied. One of: AND, OR, and, or |
Referenced models: Related Records — request body — query / filters / group_operator: AND, OR, and, or, Related Records — request body — query filters value
Create Territories — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Represents the response returned when one or more territories are successfully created. Additional keys: not allowed |
territories | array | Required within parent | Represents the list of territory objects created by the request. Maximum items: 100 Minimum items: 1 |
territories[] | object | Each item | Represents the error details for a single territory creation operation. Additional keys: not allowed |
territories[].code | string | Required within parent | Represents the result code for the territory creation. Possible values: **SUCCESS**. Known values: SUCCESS |
territories[].details | object | Required within parent | Represents additional details about the created territory, including its unique identifier. Additional keys: not allowed |
territories[].details.id | string | Required within parent | Represents the unique identifier of the created territory. Format: int64 |
territories[].message | string | Required within parent | Represents the success message returned for the territory creation. Possible values: **Territory Created Successfully**. Known values: Territory Created Successfully Maximum length: 100 |
territories[].status | string | Required within parent | Represents the status of the territory creation operation. Possible values: **success**. Known values: success |
Related Records — request body — query filters value
Referenced models: Related Records — request body — query / filters / value / comparator: between, not between, type: merge field, pre defined, value, field, Related Records — request body — query filters value value, Related Records — request body — query / filters / value / comparator: include all, include any, exclude all, exclude any, type: merge field, pre defined, value, field, Related Records — request body — query / filters / value / comparator: less than, less equal, greater than, greater equal, type: merge field, pre defined, value, field, Related Records — request body — query / filters / value / comparator: in, not in, type: merge field, pre defined, value, field, Related Records — request body — query / filters / value / comparator: like, not like, starts with, ends with, contains, not contains, type: merge field, pre defined, value, field
Related Records — request body — query / filters / value / comparator: between, not between, type: merge field, pre defined, value, field
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Represents a filter criterion for the between and not_between comparators. The value must be an array of exactly two elements — [lower_bound, upper_bound]. The value type is determined by the field's data_type: use SimpleFilterCriterionValueString for date or datetime fields, and SimpleFilterCriterionValueNumber for integer, currency, or double fields. Resolve the data_type from the field's FieldSchema. For formula fields, use formula.return_type as the effective data_type; for rollup_summary fields, use rollup_summary.return_type. Additional keys: not allowed |
comparator | string | Required within parent | Represents the range comparison operator applied to the criterion, indicating whether the field value falls within or outside the specified bounds. Possible values: between - Matches records where the field value falls within the specified range. not_between - Matches records where the field value falls outside the specified range. One of: between, not_between |
field | JSON | Required within parent | Represents the target field definition to which the range filter criterion is applied, conforming to the base field structure. |
field (allOf 1) | Model | All variants apply | Expand Related Records — request body — query / filters / value / comparator: in, not in, type: merge field, pre defined, value, field field api name, id |
field (allOf 2) | object | All variants apply | Represents the field reference constraint that requires the api_name property to be present for the range filter criterion. Additional keys: allowed |
type | string | Optional | Indicates the value resolution mode of the criterion, distinguishing whether the filter value is a literal value, a merge field reference, a predefined system variable, or another field reference. Possible values: value - The value is a direct literal. merge_field - The value is a merge field reference. pre_defined - The value is a predefined system variable placeholder. field - The value references another field. Default: value One of: merge_field, pre_defined, value, field |
value | array | Required within parent | Contains the two boundary values — [lower_bound, upper_bound] — against which the field is evaluated for the between or not_between comparator. Maximum items: 2 Minimum items: 2 |
value[] | JSON | Each item | |
value[] (anyOf 1) | string | Alternative | Represents a string filter criterion value applicable to fields with a data_type of text, textarea, email, phone, website, autonumber, picklist, multiselectpicklist, date, or datetime, as well as any data_type not explicitly covered by SimpleFilterCriterionValueNumber, SimpleFilterCriterionValueBoolean, SimpleFilterCriterionValueObjectRequest, SimpleFilterCriterionValueObjectResponse, or the multiselect lookup value schemas. Maximum length: 255 |
value[] (anyOf 2) | number | Alternative | Represents a numeric filter criterion value applicable to fields with a data_type of integer, currency, or double. |
Referenced models: Related Records — request body — query / filters / value / comparator: in, not in, type: merge field, pre defined, value, field field api name, id
Related Records — request body — query filters value value
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | JSON | Root | Represents an equality filter criterion that dispatches to either the EqualFilterCriterionRequest or NotEqualFilterCriterionRequest schema based on the comparator value. |
$ (anyOf 1) | Model | Alternative | Expand Related Records — request body — query / filters / value / value / comparator: equal, type: merge field, pre defined, value, field |
$ (anyOf 2) | Model | Alternative | Expand Related Records — request body — query / filters / value / value / comparator: not equal, type: merge field, pre defined, value, field |
Referenced models: Related Records — request body — query / filters / value / value / comparator: equal, type: merge field, pre defined, value, field, Related Records — request body — query / filters / value / value / comparator: not equal, type: merge field, pre defined, value, field
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: zoho.createterritories. Catalog operation: createTerritories. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.
Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.