# dflow tokens:create

> Create a workspace token and print the secret once.

Web page: /docs/cli/access/tokens-create/

This creates a workspace token and prints the secret once. A script or an editor uses that secret as a bearer token. Store it, and keep it out of a repository and a chat log. It will not be shown again.

```bash
dflow tokens:create
```

## Flags

`--role` is optional. `--expires-in` defaults to `90d`. The shortest value is `1m` and the longest is `365d`. `never` is refused. `--name` is optional and is at most 64 characters. `dflow tokens:list` shows that name. The secret is printed once.

## What you see

The secret is in the JSON field once. It is not shown again.

## When it fails

Do not write the secret into the repository or a chat log.

## Stage-only tokens

`dflow tokens:create` makes a full workspace API token by default. A **stage-only** workspace token can stage changes but cannot deploy or run other cluster writes, and it cannot trust-skip staging. Create one on the dashboard Tokens page with **Stage only** checked, or with `POST /v1/workspaces/{workspace_id}/tokens` and `stage_only: true`. There is no `dflow tokens:create --stage-only` flag yet.
