CLI
Login Command
Authenticate with HumanLayer and save your API token
npx humanlayer login
The login
command authenticates you with HumanLayer and saves your API token for future CLI usage. This is typically the first command you’ll run when setting up the CLI.
Usage
Options
Flag | Description | Default |
---|---|---|
--api-base <url> | API base URL | https://api.humanlayer.dev |
--app-base <url> | App base URL | https://app.humanlayer.dev |
--config-file <path> | Path to config file | ~/.config/humanlayer/humanlayer.json |
How It Works
- Open login page: The command will attempt to open your default browser to the HumanLayer login page
- Get API token: After logging in, copy your API token from the dashboard
- Paste token: Return to the terminal and paste your API token when prompted
- Save configuration: The token is saved to your configuration file for future use
Interactive Flow
Examples
Basic Login
Login with Custom Config File
Login with Custom API Endpoints
Configuration File
After successful login, your configuration file will contain:
Troubleshooting
Browser Won’t Open
If the browser doesn’t open automatically, you can:
- Press ESC when prompted
- Manually navigate to the URL shown in the terminal
- Complete the login process and copy your token
Permission Errors
If you get permission errors writing to the config file:
- Check that the directory exists:
~/.config/humanlayer/
- Ensure you have write permissions to the directory
- Use a custom config file location with
--config-file
Token Issues
- Make sure you copy the complete token from the dashboard
- Tokens start with
hl_
prefix - If the token seems invalid, try logging in again