Betterness
Bett-iDocsTutorialsAboutAugmented Wellness

Overview

Trust

Resources

System

Get Started

Recipes

Reference

DocsCLIAuthentication

Authentication

OAuth for humans, API keys for scripts.

Two methods

MethodWhen
OAuthInteractive use — you're sitting at a terminal and want a browser flow
API key (bk_*)Cron, CI, agent pipelines, anything non-interactive

OAuth login

betterness auth login

Opens a browser window. After consent, tokens are saved to ~/.betterness/tokens.json. They auto-refresh when expired.

API key login

Generate a key in the Console, then:

betterness auth login --key bk_your_key_here

Stored in ~/.betterness/credentials.json. Logging in with one method clears the other — only one auth is active at a time.

Verify

betterness auth whoami

Returns your name, email, and Betterness account ID. If this fails, your credentials are missing or expired.

Logout

betterness auth logout

Override per command

# Use a specific key for one call
betterness profile get --api-key bk_other_key

# Or via env var (useful in CI)
export BETTERNESS_API_KEY=bk_your_key
betterness profile get

Resolution order

  1. --api-key flag (highest priority)
  2. BETTERNESS_API_KEY environment variable
  3. OAuth tokens from ~/.betterness/tokens.json
  4. Stored API key from ~/.betterness/credentials.json

Common errors

SymptomCauseFix
401 UnauthorizedNo credentials or expiredbetterness auth whoami to check; re-login
403 ForbiddenKey lacks scope for that toolGenerate a wider-scope key or update the consent grant in the Console
Browser doesn't openHeadless / SSH sessionUse --key flow with an API key instead

Next

Run your first query.

InstallFirst Query
© 2026 Betterness Inc.
Privacy PolicyTerms of ServiceHealth Data