Update WHM API token's settings

This function updates an API token's settings.

SecurityBasicAuth
Request
query Parameters
token_name
required
string

The API token's name.

Example: token_name=token
acl
string

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-2acl-3.

Examples:
acl=acl-0=create-acct acl-1=list-accts acl-2=kill-acct
acl=all
expires_at
integer <unix_timestamp>
Default: 0

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.

Example: expires_at=1609372800
new_name
string <= 50 characters

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.

Example: new_name=example
string or string or string or string

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-1whitelist_ip-2.

  • If a token has whitelisted IPs set, they can be cleared by passing whitelist_ip=any as a parameter. This will allow any IP to make API calls using that token.

Examples:
whitelist_ip=whitelist_ip=any
whitelist_ip=whitelist_ip-0=192.0.2.1 whitelist_ip-1=192.0.2.5 whitelist_ip-2=192.0.2.8/29 whitelist-ip-3=fc00:abcd::f whitelist-ip-4=2620:0:28a4::/48
whitelist_ip=whitelist_ip=192.0.2.8/29
Responses
200

HTTP Request was successful.

Response Schema: application/json
object
object
get/api_token_update
Request samples
whmapi1 --output=jsonpretty \
  api_token_update \
  token_name='token'
Response samples
application/json
{
  • "data": {
    • "acls": [
      • "create-acct",
      • "kill-acct",
      • "list-accts"
      ],
    • "create_time": 1483625276,
    • "expires_at": 1609372800,
    • "name": "example",
    • "whitelist_ips": [
      • "192.0.2.1",
      • "192.0.2.2",
      • "192.0.2.8/29",
      • "fc00:abcd:0000:0000:0000:0000:0000:000f",
      • "2620:0000:28a4:0000:0000:0000:0000:0000/48"
      ]
    },
  • "metadata": {
    • "command": "api_token_update",
    • "reason": "OK",
    • "result": 1,
    • "version": 1
    }
}