WHM API.
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/
https://{host}:{port}/json-api/
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/api_token_list
- A server running WHM.
https://whm-server.tld:2087/json-api/api_token_list
- 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/api_token_list{ "data": { "tokens": { … } }, "metadata": { "command": "api_token_list", "reason": "OK", "result": 1, "version": 1 } }
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/api_token_revoke
- A server running WHM.
https://whm-server.tld:2087/json-api/api_token_revoke
- 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/api_token_revoke?token_name=subway'{ "metadata": { "command": "api_token_revoke", "reason": "OK", "result": 1, "version": 1 } }
The new privileges to assign to the token. If you do not use this parameter, the system will assign all of your privileges to the token.
For a list of Access Control List (ACL) privileges, read our Edit Reseller Nameservers and Privileges documentation.
Note:
You can only assign privileges that you possess to the API token.
The function replaces all current privileges with the privileges that you pass in this parameter.
To assign multiple privileges to the token, increment the parameter name. For example,
acl-1,acl-2,acl-3.
The API token's expiration time. If you do not use this parameter, the API token will not expire.
- A date, in Unix Epoch format.
0— The API token will not expire.
Important:
When an API token expires, the system does not delete it. You must manually delete expired API tokens.
The API token's new name. If you do not use this parameter, the API token's name remains the same.
Note:
An API token name's maximum length is 50 characters, and the name may only contain alphanumeric characters, dashes (
-), and underscores (_).You must assign a name that does not already exist to the API token.
The new remote IP or CIDR IP ranges to assign to this token. If you do not use this parameter, the system does not limit which IPs can use this token.
Note:
The function replaces all current whitelisted IPs with the IPs you pass in this parameter.
To assign multiple whitelisted IPs to the token, increment the parameter name. For example:
whitelist_ip-0,whitelist_ip-1,whitelist_ip-2.If a token has whitelisted IPs set, they can be cleared by passing
whitelist_ip=anyas a parameter. This will allow any IP to make API calls using that token.
- Mock server
https://api.docs.cpanel.net/_mock/specifications/whm.openapi/api_token_update
- A server running WHM.
https://whm-server.tld:2087/json-api/api_token_update
- 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/api_token_update?token_name=token&acl=string&expires_at=1609372800&new_name=example&whitelist_ip=192.168.0.1'{ "data": { "acls": [ … ], "create_time": 1483625276, "expires_at": 1609372800, "name": "example", "whitelist_ips": [ … ] }, "metadata": { "command": "api_token_update", "reason": "OK", "result": 1, "version": 1 } }