Authentication

Every API call needs a Tabstack API key. The CLI resolves it in a strict priority order so you can override at any scope without editing config files.

Resolution order

--api-key <key>   →   TABSTACK_API_KEY env   →   stored key from login

The first source that has a value wins. Later sources are never consulted.

This means:

  • --api-key in a single command overrides everything, including the stored key
  • TABSTACK_API_KEY in the environment overrides the stored key (good for CI)
  • The stored key is the fallback for interactive use

Run tabstack status to see which source resolved and what key prefix it found — without printing the key itself.

tabstack status
# key source:  stored (~/.config/tabstack/config.json)
# key prefix:  ts_abc...
# base URL:    https://api.tabstack.ai

Login

tabstack login

This does three things:

  1. Opens the Tabstack console in your default browser (API Keys → Create New Key)
  2. Prompts you to paste the key
  3. Makes one cheap API call to verify the key is valid before storing it

The verification step is deliberate. A stored key that’s already expired or typo’d is worse than no stored key — it causes confusing errors later. Better to catch the problem at setup.

# Non-interactive — for CI, scripting
tabstack login --with-key ts_xxx

# From a pipe — skip verification (use when you know the key is fresh)
echo "$TABSTACK_KEY" | tabstack login --no-verify

Keys are stored at ~/.config/tabstack/config.json with Unix permissions 0600 (owner read/write only).

Logout

tabstack logout

Removes the stored key. Does not revoke it on the Tabstack side — do that from the console if needed.

Environment variable

export TABSTACK_API_KEY=ts_xxx
tabstack extract markdown https://example.com

Useful for CI pipelines, Docker containers, or when you want a different key per project without changing the stored default.

Multiple environments

For staging or self-hosted deployments:

# Per-command
tabstack --base-url https://api.staging.example.com extract markdown https://example.com

# Per-session
export TABSTACK_BASE_URL=https://api.staging.example.com
tabstack extract markdown https://example.com

--base-url sets the API root for that invocation only.