apitoken create

Prev Next

This command creates an API token, which can be used to securely authenticate calls to the VMS REST API.

The token is displayed in the command output and cannot be displayed again.

The number of tokens per user is limited to five by default and configurable using vms set_max_api_tokens_per_user.

The command enables you to create a token for yourself or for another user.

Note

Creating a token for another user requires Create permission for the Security realm.

Usage

apitoken create [--name TOKEN_NAME]
                [--expiry-date EXPIRATION_TIME]
                [--owner OWNER]

Options

--name TOKEN_NAME

Customizes the name of the API token.

If not specified, the token is named OWNER_api_token, where OWNER is the user name of the token owner.

--expiry-date EXPIRATION_TIME

Sets the token's expiration date by specifying an amount of time from token creation until the token should expire. The expiration date is equal to the token creation date in UTC + the specified time period.  

Specify EXPIRATION_TIME as a whole integer followed by a unit of time: 'Y' for (365 day) years, 'M' for (30 day) months, 'w' or 'W' for weeks, 'd' or 'D' for days, 'h' or 'H' for hours, 'm' for minutes, 's' or 'S' for seconds.

The maximum and default expiration time is the password expiration timeout, which is set by the --pwd-expiration-timeout parameter of the vms modify_pwd_settings command. If password expiration is not enabled, tokens do not expire unless --expiry-date is set.

Example: To set the token to expire after 180 days: --expiry-date 180D

--owner OWNER

Sets the owner of the token. Use this parameter to create a token for another user.

If not specified, the token is owned by the requesting user.

Note

Creating a token for another user requires Create permission for the Security realm.

Examples

This example creates a token for the admin user, named admin_api_token:  

vcli: admin> apitoken create
ApiToken with id: JhxND7ci has been created, your token is: JhxND7ci.AWrRmHXRtbcjUSCANl9KLrxRT6sMqesu please keep it safe

This example creates a token for the user admin_jb, named AWS_TOKEN that will expire in one day:

vcli: admin> apitoken create --name AWS_TOKEN --expiry-date 1D --owner adminjb
ApiToken with id: L7k8ljIC has been created, your token is: L7k8ljIC.jm1P5Y0ONaJfUJhslJbAjRAyr9jcy89X please keep it safe