latestOpenAPI 3.0.2cPanel License2026-08-106251554.3 MB

3da41671c02c

Authentication
API Token Management

Create WHM API token

This function creates an API token. You can use API tokens instead of a password or access hash key to execute WHM API 1 functions over HTTPS. For more information about API tokens, read our Manage API Tokens in WHM documentation.

Important:

You must call this function over an SSL connection.

get/api_token_create

Query parameters

token_namestring required
Example:example

The API token's name.

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.
aclstring

The privileges to assign to the token. If you do not use this parameter, the system assigns all of your privileges to the token.

Note:

  • You can only assign privileges that you possess to the API token.
  • To assign multiple privileges to the token, increment the parameter name. For example: acl-0, acl-1acl-2.
expires_atinteger
Example:1609372800

The API token's expiration time. If you do not use this parameter, 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.

string ipv4
OR
string ipv6
OR
string cidr

One or more optional remote IP or CIDR IP ranges this token may be used from. If you do not use this parameter, the system does not limit which IPs can use this token.

Note:

  • To assign multiple whitelisted IPs to the token, increment the parameter name. For example: whitelist_ip-0, whitelist_ip-1whitelist_ip-2.

Response

HTTP Request was successful.

Example response

{
  "data": {
    "acls": [
      "kill-acct"
    ],
    "create_time": 1483625276,
    "expires_at": 1609372800,
    "name": "example",
    "token": "UWU28DCA23NKY76CN17MDPKM3O7EFQY8",
    "whitelist_ips": [
      "1.1.1.1",
      "1.1.1.2",
      "1.1.1.8/29",
      "fc00:abcd:0000:0000:0000:0000:0000:000f",
      "2620:0000:28a4:0000:0000:0000:0000:0000/48"
    ]
  },
  "metadata": {
    "command": "api_token_create",
    "reason": "OK",
    "result": 1,
    "version": 1
  }
}