Command reference Β· Claude Code
/logout
Signs out of your Anthropic account.
/logout signs you out of the currently connected Anthropic account. The command removes the stored credentials (.credentials.json, depending on the operating system in the macOS keychain, at ~/.claude/.credentials.json on Linux, or at %USERPROFILE%\.claude\.credentials.json on Windows) and additionally resets the first-launch setup state: if you start Claude Code again afterward with claude, it walks you through login and initial setup completely again.
Use /logout to sign in again β for example with a different account or after switching organizations β or to cleanly disconnect an account from a shared machine. The command only affects the login stored via /login; credentials via ANTHROPIC_API_KEY, ANTHROPIC_AUTH_TOKEN, or apiKeyHelper run as separate credential paths independently of it.
π THE SAME TASK (βLOG OUT/LOG INβ) ON OTHER PLATFORMS
β WHEN TO USE IT?
Disconnect an account on a shared machine
After working on a team/test machine, run /logout so the next person has to sign in with their own account.
Switch to a different account or organization
Run /logout and then /login to reconnect with a different Claude account.
β WHEN NOT TO?
Just briefly checking which account is currently active
/logout ends the login immediately instead of just displaying information.
Better: Use /status to view the login line with account and expiration info without signing out.
Wanting to end a login via ANTHROPIC_API_KEY or apiKeyHelper
According to the docs, /logout only manages the .credentials.json login stored via /login; API key- or helper-based access runs via environment variables or configuration.
Better: Remove the environment variable (e.g. ANTHROPIC_API_KEY) in the terminal or adjust the apiKeyHelper setting in the config.
SOURCES
- Claude Code docs (official) β code.claude.com
MORE COMMANDS Β· Claude Code