Files
coder/docs/reference/cli/tokens_create.md
T
Thomas Kosiewski cadf1352b4 feat: add scoped token support to CLI (#19985)
<!--

If you have used AI to produce some or all of this PR, please ensure you have read our [AI Contribution guidelines](https://coder.com/docs/about/contributing/AI_CONTRIBUTING) before submitting.

-->

Add support for scoped API tokens in CLI

This PR adds CLI support for creating and viewing API tokens with scopes and allow lists. It includes:

- New `--scope` and `--allow` flags for the `tokens create` command
- A new `tokens view` command to display detailed information about a token
- Updated table columns in `tokens list` to show scopes and allow list entries
- Updated help text and examples

These changes enable users to create tokens with limited permissions through the CLI, similar to the existing functionality in the web UI.
2025-10-27 17:07:25 +01:00

56 lines
1.3 KiB
Markdown
Generated

<!-- DO NOT EDIT | GENERATED CONTENT -->
# tokens create
Create a token
## Usage
```console
coder tokens create [flags]
```
## Options
### --lifetime
| | |
|-------------|------------------------------------|
| Type | <code>string</code> |
| Environment | <code>$CODER_TOKEN_LIFETIME</code> |
Specify a duration for the lifetime of the token.
### -n, --name
| | |
|-------------|--------------------------------|
| Type | <code>string</code> |
| Environment | <code>$CODER_TOKEN_NAME</code> |
Specify a human-readable name.
### -u, --user
| | |
|-------------|--------------------------------|
| Type | <code>string</code> |
| Environment | <code>$CODER_TOKEN_USER</code> |
Specify the user to create the token for (Only works if logged in user is admin).
### --scope
| | |
|------|---------------------------|
| Type | <code>string-array</code> |
Repeatable scope to attach to the token (e.g. workspace:read).
### --allow
| | |
|------|-------------------------|
| Type | <code>allow-list</code> |
Repeatable allow-list entry (<type>:<uuid>, e.g. workspace:1234-...).