We have a new documentation site for cPanel & WHM! You can find our new documentation site at docs.cpanel.net.

We will continue to maintain our API documentation on this server.

Child pages
  • WHM API 1 Functions - delete_domain
Skip to end of metadata
Go to start of metadata

Description

This function deletes a domain.

Note:

This function does not remove an addon domain's associated subdomain. You must also run this function for the associated subdomain.

Examples


 JSON API
https://hostname.example.com:2087/cpsess##########/json-api/delete_domain?api.version=1&domain=example.com
 Command Line
whmapi1 delete_domain domain=example.com


Notes:

  • Unless otherwise noted, you must URI-encode values.
  • For more information and additional output options, read our Guide to WHM API 1 documentation or run the whmapi1 --help command.
  • If you run CloudLinux™, you must use the full path of the whmapi1 command:

    /usr/local/cpanel/bin/whmapi1

 Output (JSON)
{
  "data": {
    "username": "username",
    "type": "addon"
  },
  "metadata": {
    "version": 1,
    "reason": "OK",
    "result": "1",
    "command": "delete_domain"
  }
}


Note:

Use WHM's API Shell interface (WHM >> Home >> Development >> API Shell) to directly test WHM API calls.

Parameters

ParameterTypeDescriptionPossible valuesExample

domain

string

Required

The name of the domain to delete.

A valid domain name that exists on the server.

example.com

Returns

ReturnTypeDescriptionPossible valuesExample
usernamestring

The cPanel user that owned the domain.

  • A cPanel account username.
  • null — The function did not find a cPanel account that owns the given domain.
username
typestring

The type of domain that the function deleted.

  • addon — An addon domain.
  • parked — A parked (alias) domain.
  • sub — A subdomain.
  • null — The domain does not exist on the server.
addon