DataFast CLI — Get started
The DataFast CLI lets you query analytics, manage websites, tokens, alerts, and funnels directly from your terminal. Useful for AI agents and LLMs 🤖
1. Run or install
Run the CLI without installing it:
npx @datafast/cli login bunx @datafast/cli login
Or install it globally if you plan to use it often:
npm install -g @datafast/cli
This installs the
datafast binary globally.2. Authenticate
Use the login command to authenticate the CLI. It will open your DataFast account page in your browser, prompt you to create an account token, and paste it into the CLI.
datafast login
The token is saved locally at
~/.config/datafast/config.json.By default,
datafast login uses a dft_ account token so the CLI can manage your DataFast account. If you only want analytics access for one website, you can use a df_ website API key instead. Read the permissions & roles guide for the full difference.3. Use (commands)
Most commands are interactive when you omit IDs or required flags. For example,
datafast analytics overview prompts you to choose a website when using a dft_ account token, and datafast websites update opens a guided editor. Press Ctrl+C at any prompt to exit cleanly.- Manage websites
- Manage tokens
- Query analytics
- Get visitor details
- Manage alerts
- Manage funnels
- Set up shell completion
And more to come... DataFast aims to give your AI agent full control over your DataFast account.
More about the CLI
Permissions & roles
Read more about roles & permissions
Log out
datafast logout
Removes the saved token from
~/.config/datafast/config.json.Global flags
These flags work with every command:
| Flag | Description |
|---|---|
--json | Compact JSON output (default: pretty-printed) |
--verbose | Print the request URL and response status to stderr |
# Compact JSON output — pipe it into jq, save to file, etc.
datafast --json websites list | jq '.[].domain'
Environment variables (override the saved config)
DATAFAST_TOKEN=dft_xxx # user token
DATAFAST_SITE_KEY=df_xxx # analytics-only site key
DATAFAST_API_BASE=http://localhost:3000 # default: https://datafa.st
Other ways to authenticate
# Pipe the token via stdin (great for CI)
echo $MY_TOKEN | datafast login
# Pass it inline (avoid: it leaks into shell history)
datafast login --token dft_xxx