Managing Customer Domains Using API
This article provides information on Zscaler Private Access (ZPA) customer domain use cases using APIs. All APIs are rate limited. To learn more, see ZPA API Rate Limits and Adding DNS Search Domains.
Getting All Domains for a Customer
To get all domains for a customer:
-
Send a
GETrequest to the following endpoint:/mgmtconfig/v1/admin/customers/{customerId}/v2/associationtype/{type}/domains?microtenantId={microtenantId}. -
Provide the following in the request endpoint:
customerId: The ZPA tenant ID of the customer.type: The association type of the domain. You must passSEARCH_SUFFIXas the value fortypeto retrieve details of DNS search domains.microtenantId: The unique identifier of the Microtenant. If you are within a Microtenant, you must pass themicrotenantIdfield when making an API call to retrieve data from that Microtenant. ThemicrotenantIdcan be obtained from the API Keys page, or can be obtained programmatically using the ZPA cloud service API. Access to certain operations is limited when you are within a Microtenant. If you are within the Default Microtenant, passmicrotenantIdas0when making requests to retrieve data from the Default Microtenant. If themicrotenantIdis not passed in the request when creating or updating a resource, then the resource is created or updated in the Default Microtenant. To learn more, see Configuring Microtenants Using API.
For example:
/mgmtconfig/v1/admin/customers/72057594037927936/v2/associationtype/SEARCH_SUFFIX/domains?microtenantId=0.
A successful response returns code 200. To learn more, see ZPA API Codes.
Example Response
[
{
"id": "24493",
"modifiedTime": "1753246146",
"creationTime": "1753246146",
"modifiedBy": "72057594038609323",
"domain": "beta.co",
"associationType": "SEARCH_SUFFIX",
"capture": true,
"name": "beta.co"
}
]
Creating or Updating a Domain for a Customer
To create or update a domain for a customer:
-
Send a
POSTrequest to the following endpoint:/mgmtconfig/v1/admin/customers/{customerId}/v2/associationtype/{type}/domains?microtenantId={microtenantId}. -
Provide the following in the request endpoint:
customerId: The ZPA tenant ID of the customer.type: The association type of the domain. You must passSEARCH_SUFFIXas the value fortypeto create a DNS search domain.microtenantId: The unique identifier of the Microtenant. If you are within a Microtenant, you must pass themicrotenantIdfield when making an API call to retrieve data from that Microtenant. ThemicrotenantIdcan be obtained from the API Keys page, or can be obtained programmatically using the ZPA cloud service API. Access to certain operations is limited when you are within a Microtenant. If you are within the Default Microtenant, passmicrotenantIdas0when making requests to retrieve data from the Default Microtenant. If themicrotenantIdis not passed in the request when creating or updating a resource, then the resource is created or updated in the Default Microtenant. To learn more, see Configuring Microtenants Using API.
For example:
/mgmtconfig/v1/admin/customers/72057594037927936/v2/associationtype/SEARCH_SUFFIX/domains?microtenantId=0. -
Include the request headers to provide information about the request context:
- Content-Type:
application/json - Authorization:
Bearer <access_token>
- Content-Type:
-
Provide the following JSON payload and include the following details:
assocationType: The association type of the domain. You must passSEARCH_SUFFIXto create a DNS search domain.domain: The domain of the customer.name: The name of the customer.microtenantId: The unique identifier of the Microtenant. If you are within a Microtenant, you must pass themicrotenantIdfield when making an API call to retrieve data from that Microtenant. ThemicrotenantIdcan be obtained from the API Keys page, or can be obtained programmatically using the ZPA cloud service API. Access to certain operations is limited when you are within a Microtenant. If you are within the Default Microtenant, passmicrotenantIdas0when making requests to retrieve data from the Default Microtenant. If themicrotenantIdis not passed in the request when creating or updating a resource, then the resource is created or updated in the Default Microtenant. To learn more, see Configuring Microtenants Using API.
A successful response returns code 204, meaning the domain is created or updated. To learn more, see ZPA API Codes.
JSON Payload
[
{
"associationType": "SEARCH_SUFFIX",
"capture": true,
"domain": "string",
"name": "<name>",
"microtenantId": <microtenant ID>
}
]
Example JSON Payload
[
{
"microtenantId": 0,
"domain": "beta.co",
"associationType": "SEARCH_SUFFIX",
"capture": true,
"name": "beta.co"
}
]