Source: https://datafa.st/docs/cli-tokens
Markdown source: https://datafa.st/docs/cli-tokens.md
Description: Create, list, and delete API access tokens using the DataFast CLI.

# CLI — Access tokens

Manage a website-scoped API access tokens. Requires a `dft_` admin token. Useful to query analytics from a specific website.

## List all tokens

```sh
datafast tokens list
```

## Create a token

Run without flags for an interactive prompt (name, permissions, optional website scope):

```sh
datafast tokens create
```

Or pass flags to skip the prompts:

```sh
# Full access token
datafast tokens create --name "CI token" --permissions "*"

# Scoped to specific permissions
datafast tokens create --name "Read only" --permissions "analytics:read,websites:read"

# Scoped to specific websites
datafast tokens create --name "Site A token" --permissions "*" --websites <id1>,<id2>
```

**Valid permissions:**

`analytics:read`, `websites:read`, `websites:write`, `api-keys:read`, `api-keys:write`, `team:read`, `team:write`, `alerts:read`, `alerts:write`, `settings:read`, `settings:write`, or `*` for full access.

## Delete a token

```sh
datafast tokens delete <tokenId>

# Skip the confirmation prompt
datafast tokens delete <tokenId> --yes
```

When you create a token, the raw `dft_` key is copied to your clipboard automatically.
