WHM API.
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/
https://{host}:{port}/json-api/
An existing web virtual host to which the new domain name should be added.
Note:
If this is not the cPanel account’s main domain, then the system will consider the new domain to be an addon domain.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/create_parked_domain_for_user
- A server running WHM.
https://whm-server.tld:2087/json-api/create_parked_domain_for_user
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://api.docs.cpanel.net/_mock/specifications/whm.openapi/create_parked_domain_for_user?domain=park.example.com&username=username&web_vhost_domain=vhost.example.com'{ "metadata": { "command": "create_parked_domain_for_user", "reason": "OK", "result": 1, "version": 1 } }
The subdomain's document root within the home directory.
Note:
- An invalid document root path will cause this function to fail.
- If the Restrict document roots to public_html value is set to
Onin WHM's Tweak Settings interface (WHM >> Home >> Server Configuration >> Tweak Settings), this parameter must begin with thepublic_html/path. For more information, read the cpanel.config file documentation.
Whether to use a canonical name in the Apache® configuration for self-referential URLs.
1— Use the canonical name.0— Do not use the canonical name.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/create_subdomain
- A server running WHM.
https://whm-server.tld:2087/json-api/create_subdomain
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://api.docs.cpanel.net/_mock/specifications/whm.openapi/create_subdomain?document_root=public_html%2Fdirectory_name&domain=subdomain.example.com&use_canonical_name=0'{ "data": { "username": "example" }, "metadata": { "command": "create_subdomain", "reason": "OK", "result": 1, "version": 1 } }
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/delete_domain
- A server running WHM.
https://whm-server.tld:2087/json-api/delete_domain
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://api.docs.cpanel.net/_mock/specifications/whm.openapi/delete_domain?domain=example.com'{ "data": { "type": "addon", "username": "username" }, "metadata": { "command": "delete_domain", "reason": "OK", "result": 1, "version": 1 } }
An existing web virtual host to which the new domain name should be added.
Note:
If this is not the cPanel account’s main domain, then the system will consider the new domain to be an addon domain.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/create_parked_domain_for_user
- A server running WHM.
https://whm-server.tld:2087/json-api/create_parked_domain_for_user
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://api.docs.cpanel.net/_mock/specifications/whm.openapi/create_parked_domain_for_user?domain=park.example.com&username=username&web_vhost_domain=vhost.example.com'{ "metadata": { "command": "create_parked_domain_for_user", "reason": "OK", "result": 1, "version": 1 } }
The subdomain's document root within the home directory.
Note:
- An invalid document root path will cause this function to fail.
- If the Restrict document roots to public_html value is set to
Onin WHM's Tweak Settings interface (WHM >> Home >> Server Configuration >> Tweak Settings), this parameter must begin with thepublic_html/path. For more information, read the cpanel.config file documentation.
Whether to use a canonical name in the Apache® configuration for self-referential URLs.
1— Use the canonical name.0— Do not use the canonical name.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/create_subdomain
- A server running WHM.
https://whm-server.tld:2087/json-api/create_subdomain
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://api.docs.cpanel.net/_mock/specifications/whm.openapi/create_subdomain?document_root=public_html%2Fdirectory_name&domain=subdomain.example.com&use_canonical_name=0'{ "data": { "username": "example" }, "metadata": { "command": "create_subdomain", "reason": "OK", "result": 1, "version": 1 } }
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/delete_domain
- A server running WHM.
https://whm-server.tld:2087/json-api/delete_domain
- curl
- JavaScript
- Node.js
- Python
- Java
- C#
- PHP
- Go
- Ruby
- R
- Payload
curl -i -X GET \
-u <username>:<password> \
'https://api.docs.cpanel.net/_mock/specifications/whm.openapi/delete_domain?domain=example.com'{ "data": { "type": "addon", "username": "username" }, "metadata": { "command": "delete_domain", "reason": "OK", "result": 1, "version": 1 } }