create
create tokens
🔑 Create a new API token for the current user.
This command creates a new API token for the current user. The token can be used to authenticate with the ComputeSphere API.
The token can be created with a specific name, scope, and expiry date.
Name should be 1-50 characters long and can contain letters, numbers, and underscores.
Expiry date should be in the date time format YYYY-MM-DD HH:MM:SS.
Scope of the token determines the level of access that the token has. The token can have one of the following scopes:
full: The token has full access to all accounts and projects.account: The token has access to all resources in the specified accounts.project: The token has access to all resources in the specified projects.
To specify the accounts or projects that the token has access to, use the --restrictions flag. The flag should be a comma-separated list of account or project IDs.
Type of resources should be specified in the --scope flag.
Both interactive and non-interactive modes respond with the token value only. The token value is a secret and should be stored securely.
This command supports reading input from a file.
Files can be supplied via the --file flag or piped into the command.
Example of file structure
{
"expiry": "0001-01-01T00:00:00Z",
"name": "My Token",
"scope": "full"
}
Usage​
csph auth token create [flags]
Aliases​
auth token create, auth token new, auth tokens create, auth tokens new, auth api-token create, auth api-token new, auth api-tokens create, auth api-tokens new
Options​
Command Specific​
Inherited​
Examples​
# start a prompt to create a new token
> csph auth token create
# create a new token directly, with a name, full scope, and expiry date
> csph auth token create \
--name my-token \
--scope full \
--expiry "2027-12-31 23:59:59"
# create a new token directly, with a name, account scope, and expiry date
> csph auth token create \
--name my-token \
--scope account \
--restrictions <account-id>,<account-id> \
--expiry "2027-12-31 23:59:59"
# create a new token directly, with a name, project scope, and expiry date
> csph auth token create \
--name my-token \
--scope project \
--restrictions <project-id>,<project-id> \
--expiry "2027-12-31 23:59:59"
See also​
- csph auth token — work with API tokens
- csph auth token get — get tokens
- csph auth token list — list tokens
- csph auth token delete — delete tokens
- csph auth token set — set tokens
- csph auth token provision — provision tokens