How to Delete a Domain from a Zoho Organization Using the API: A Step-by-Step Guide - Solution for Guru

Skip to main content
Table of Contents
< All Topics
Print

How to Delete a Domain from a Zoho Organization Using the API: A Step-by-Step Guide

Prerequisites

Before deleting a domain from a Zoho organization using the API, ensure the following conditions are met:

  1. A valid Zoho organization identifier (zoid) is available. This can be retrieved via the Get Organization Details API.
  2. An OAuth token with the scope ZohoMail.organization.domains.DELETE is generated. This scope grants the necessary permissions to delete domains.
  3. The exact domain name to be deleted is known and confirmed to be associated with the organization.

Practical Steps to Delete a Domain

Construct the DELETE Request

Send a DELETE request to the API endpoint https://mail.zoho.com/api/organization/{zoid}/domains/{domainName}. Replace {zoid} with the organization identifier and {domainName} with the domain name to be deleted.

Include Authentication Header

Include the Authorization header with the Zoho-oauthtoken value. This token must have the ZohoMail.organization.domains.DELETE scope to authorize the deletion.

Send the Request

Execute the DELETE request using a tool like curl or a REST client. Ensure the request includes the Accept and Content-Type headers set to application/json.

Verification

Check the Response Code

A successful deletion returns a 200 OK status code with the description success. Verify the response to confirm the operation completed without errors.

Confirm Domain Removal

Log in to the Zoho Mail admin console and navigate to the organization’s domain settings. Ensure the domain is no longer listed as an active domain for the organization.

Troubleshooting

Common Issues and Solutions

  1. Domain Not Deleted: Verify that the zoid and domainName parameters are correct. Incorrect values may prevent the API from locating the domain.
  2. OAuth Scope Error: Ensure the OAuth token includes the ZohoMail.organization.domains.DELETE scope. Missing or invalid scopes will result in authentication failures.
  3. Domain in Use: The API does not support deleting domains currently used for email hosting. Confirm the domain is not actively hosting email accounts or services.

Limitations

  • The API cannot delete domains that are actively used for email hosting. Ensure the domain is not associated with any email accounts or services before deletion.
  • The domain must be explicitly associated with the organization. Unlinked domains will not be deleted.
  • Once deleted, the API does not provide a recovery mechanism. Deleted domains cannot be restored through the API.

Escalation

If the API request fails, contact Zoho support with the request details and error message. Refer to the Zoho API documentation for further guidance on domain management.

FAQs

What happens to email accounts associated with the domain after deletion?

Email accounts associated with the domain remain unaffected. However, the domain will no longer be used for email hosting, and new accounts cannot be created under it.

Can I delete a domain that is currently being used for email hosting?

No, the API does not support deleting domains that are actively used for email hosting. Ensure the domain is not associated with any email accounts or services before attempting deletion.

What if the domain is not found in the organization?

The API will return an error indicating that the domain is not found or not associated with the organization. Verify the zoid and domainName parameters for accuracy.

What if the OAuth token is invalid or lacks the correct scope?

The API will return an authentication error, and the request will fail. Ensure the OAuth token includes the ZohoMail.organization.domains.DELETE scope and is valid.

How can I verify that the domain was successfully deleted?

Check the response code (200) and confirm the domain is no longer listed in the organization’s domain settings. This ensures the deletion was processed correctly.
Note: This guide is based on official Zoho documentation reviewed with local AI screening. No hands-on testing was conducted. Always refer to the Zoho API documentation for the most accurate and up-to-date information.