How to Issue an API Token
Generate a Claude API token from the Anthropic Console and set it as an environment variable.
Updated Jul 6, 2026Beginner1 min read
Share
Issue token
- Visit api.anthropic.com
- Click "Profile" at top-right
- Select "API Keys"
- Click "+ Create API Key"
- Enter a token name (e.g., "cli-dev")
- Copy the generated token
Set as environment variable
macOS / Linux (bash/zsh)
bash
export ANTHROPIC_API_KEY="your-api-key-here"For permanent setup, add to .zshrc or .bashrc:
bash
echo 'export ANTHROPIC_API_KEY="your-api-key-here"' >> ~/.zshrc
source ~/.zshrcWindows (PowerShell)
plaintext
$env:ANTHROPIC_API_KEY="your-api-key-here"For permanent setup:
plaintext
[Environment]::SetEnvironmentVariable("ANTHROPIC_API_KEY", "your-api-key-here", "User")Verify
Check that the token is set correctly:
bash
echo $ANTHROPIC_API_KEYOr:
bash
claude --versionNo error means the token is active.