The Teak CLI lets you save, search, favorite, update, and delete cards without leaving your terminal.

## Install

```bash
npm i -g teak-cli
```

After installing, the `teak` command is available globally.

## Authentication

### Browser sign-in (recommended)

```bash
teak login
```

Opens your browser to authorize the CLI with your Teak account. Credentials are stored locally so you stay signed in across sessions.

### API key (for scripts and CI)

Set the `TEAK_API_KEY` environment variable to skip interactive sign-in:

```bash
TEAK_API_KEY=teakapi_... teak ls --json
```

Generate and manage API keys in Teak Settings → **Manage API Keys**.

### Sign out

```bash
teak logout
```

Removes stored credentials from your machine.

## Commands

```bash
teak add "A note from the terminal" --tags research
teak add --url https://example.com --tags research,web
teak add --file ./screenshot.png --notes "Inspiration" --tags inspiration
teak add --file ./component.tsx --tags source
teak ls
teak search "blue buttons"
teak cards get <card-id>
teak cards update <card-id> --tags design,reference
teak fav <card-id>
teak rm <card-id>
teak tags
```

`teak add` also accepts a bare URL or file path as the positional argument (for
example `teak add https://example.com`) — the CLI detects whether it's text,
a URL, or a file. Use `--url` / `--file` when you want to be explicit or when
scripting.

File uploads support source and design-token files, Markdown and MDX, ZIP archives, PDF and Office documents, SVG, HEIC, animated GIF, WebM/MP4, Figma `.fig`, and common image/audio formats up to 100 MB. The CLI infers the media and card type from the file name, so no type flag is required.

### Getting help

Run any command with `--help` to see available options:

```bash
teak --help
teak add --help
teak search --help
```

## Output Format

By default, commands print human-readable output. Add `--json` to any command for machine-readable JSON, useful for piping into `jq` or other tools:

```bash
teak search "buttons" --json | jq '.[].url'
```

## Troubleshooting

### `teak: command not found`

- Confirm the package installed globally: `npm ls -g teak-cli`
- Make sure your npm global bin directory is in your `PATH`.

### Login opens the browser but never completes

- Check your internet connection.
- Try again — the local callback server occasionally fails to start if the port is in use.
- As a fallback, use `TEAK_API_KEY` with a key from Settings.

### Commands return "Unauthorized"

- Run `teak login` to refresh your session.
- If using `TEAK_API_KEY`, confirm the key is still active in Teak Settings.

### Still stuck?

Reach out via [Support](/docs/support).