CLI Authentication
Authenticate the Torale CLI with your account.
Setting Up Authentication
Generate API Key
- Log in to torale.ai
- Navigate to Settings → API Keys
- Click "Generate New Key"
- Enter name (e.g., "CLI Key")
- Copy key immediately (shown only once)
Configure CLI
bash
torale auth set-api-key
# Paste your API key when promptedThe key is stored securely in ~/.torale/config.json.
Verify Authentication
bash
torale auth statusOutput:
✓ Authenticated as user@example.com
API Key: sk_...xyz89Check Current User
bash
torale auth whoamiOutput:
json
{
"id": "660e8400-e29b-41d4-a716-446655440000",
"email": "user@example.com",
"state": "active"
}Logout
bash
torale auth logoutRemoves stored credentials from ~/.torale/config.json.
Environment Variable
Alternatively, use environment variable:
bash
export TORALE_API_KEY=sk_...
torale task listPriority:
--api-keyflag (highest)TORALE_API_KEYenvironment variable~/.torale/config.jsonfile (lowest)
Using --api-key Flag
bash
torale task list --api-key sk_...Useful for:
- CI/CD pipelines
- Temporary access
- Multiple accounts
Development Mode (No Auth)
For local development without authentication:
bash
export TORALE_NOAUTH=1
export TORALE_API_URL=http://localhost:8000
torale task listNote: Only works with local development API.
Troubleshooting
Invalid API Key
bash
torale task list
# Error: Invalid API keySolutions:
- Regenerate key in dashboard
- Run
torale auth set-api-keywith new key - Verify key format:
sk_[32 characters]
Missing Configuration
bash
torale task list
# Error: No API key configuredSolution:
bash
torale auth set-api-keyConnection Refused
bash
torale task list
# Error: Connection refusedCauses:
- API is down
- Network issue
- Wrong API URL (if self-hosted)
For self-hosted:
bash
export TORALE_API_URL=http://localhost:8000Security Best Practices
1. Don't Share API Keys
bash
# ✗ Bad - Don't commit to git
git add .torale/config.json
# ✓ Good - Add to .gitignore
echo ".torale/" >> ~/.gitignore2. Rotate Keys Regularly
bash
# Generate new key in dashboard
torale auth set-api-key
# Paste new key
# Revoke old key in dashboard3. Use Separate Keys
- Development:
Dev CLI Key - Production:
Production CLI Key - CI/CD:
GitHub Actions Key
4. Revoke Unused Keys
Visit torale.ai → Settings → API Keys → Revoke
Next Steps
- Learn Task Commands
- Configure Settings
- Read API Reference