checkly auth
Manage Checkly CLI authentication.
Quick start
# Interactive login (browser-based)
npx checkly login
# Check authentication status
npx checkly whoami
# Manual configuration (for CI/CD)
export CHECKLY_API_KEY="your-api-key"
export CHECKLY_ACCOUNT_ID="your-account-id"
Authentication methods
Interactive login (recommended for local development)
npx checkly login
Opens browser to authenticate and automatically saves credentials to your system config.
Credential storage location:
- Linux/macOS:
~/.config/@checkly/cli/config.json - Windows:
%APPDATA%\@checkly\cli\config.json
Environment variables (recommended for CI/CD)
export CHECKLY_API_KEY="cu_abc123..."
export CHECKLY_ACCOUNT_ID="12345"
# Test authentication
npx checkly whoami
Getting your credentials:
- Log into app.checklyhq.com
- Navigate to Account Settings → API Keys
- Create new API key with appropriate permissions
- Copy Account ID from URL or account settings
Configuration file (manual)
Create/edit config file at ~/.config/@checkly/cli/config.json:
{
"apiKey": "cu_abc123...",
"accountId": "12345"
}
Workflows
First-time setup
Sign up for Checkly account (if needed):
# Opens signup page npx checkly loginAuthenticate CLI:
npx checkly loginVerify authentication:
npx checkly whoamiExpected output:
Logged in as john@example.com Account: Acme Corp (ID: 12345)Initialize project:
npm create checkly@latest
Switching accounts
If you have multiple Checkly accounts:
Logout from current account:
# Manual logout (delete config) rm ~/.config/@checkly/cli/config.jsonLogin to different account:
npx checkly loginVerify new account:
npx checkly whoami
CI/CD authentication
For automated pipelines (GitHub Actions, GitLab CI, etc.):
Create API key in Checkly UI:
- Navigate to Account Settings → API Keys
- Click "Create API Key"
- Name: "CI/CD Pipeline"
- Permissions: Read/Write (for deploy)
- Copy the key (starts with
cu_)
Add secrets to CI/CD platform:
CHECKLY_API_KEY: Your API keyCHECKLY_ACCOUNT_ID: Your account ID
Use in pipeline:
# GitHub Actions example - name: Test checks env: CHECKLY_API_KEY: ${{ secrets.CHECKLY_API_KEY }} CHECKLY_ACCOUNT_ID: ${{ secrets.CHECKLY_ACCOUNT_ID }} run: npx checkly test - name: Deploy checks env: CHECKLY_API_KEY: ${{ secrets.CHECKLY_API_KEY }} CHECKLY_ACCOUNT_ID: ${{ secrets.CHECKLY_ACCOUNT_ID }} run: npx checkly deploy --force
Troubleshooting
"Could not find Checkly credentials"
Cause: No authentication configured
Solution:
# Option 1: Interactive login
npx checkly login
# Option 2: Set environment variables
export CHECKLY_API_KEY="your-key"
export CHECKLY_ACCOUNT_ID="your-account-id"
"401 Unauthorized"
Possible causes:
- API key has been deleted or revoked
- API key doesn't have required permissions
- Account ID doesn't match API key
Solution:
Verify credentials:
npx checkly whoamiIf invalid, re-authenticate:
npx checkly loginFor CI/CD, regenerate API key in Checkly UI
"Account not found"
Cause: Account ID is incorrect
Solution:
- Log into app.checklyhq.com
- Check URL:
app.checklyhq.com/accounts/{ACCOUNT_ID}/... - Or check Account Settings → Account ID
- Update
CHECKLY_ACCOUNT_IDenvironment variable
Permission errors during deploy
Cause: API key has read-only permissions
Solution:
- Go to Account Settings → API Keys in Checkly UI
- Create new API key with "Read/Write" permissions
- Update your API key
Environment variables reference
| Variable | Required | Description |
|---|---|---|
CHECKLY_API_KEY |
Yes | API key (starts with cu_) |
CHECKLY_ACCOUNT_ID |
Yes | Numeric account ID |
CHECKLY_API_URL |
No | Override API URL (default: https://api.checklyhq.com) |
CHECKLY_SKIP_AUTH |
No | Skip authentication (for debugging flags) |
Security best practices
Local development
- ✅ Use
npx checkly login(credentials stored securely) - ✅ Add config file to
.gitignore(if using manual config) - ❌ Don't commit API keys to version control
CI/CD pipelines
- ✅ Store credentials as encrypted secrets
- ✅ Use API keys with minimal required permissions
- ✅ Rotate API keys regularly
- ❌ Don't log API keys in pipeline output
API key management
- ✅ Create separate API keys for different purposes (CI/CD, local dev)
- ✅ Name keys descriptively ("GitHub Actions Deploy", "John's Laptop")
- ✅ Revoke unused or compromised keys immediately
- ❌ Don't share API keys between team members
Related Skills
Next steps after authentication:
- See
checkly-configto configure your project - See
checkly-testto run checks locally - See
checkly-deployto deploy checks to Checkly
Project setup:
- New project: Use
npm create checkly@latest(includes auth setup) - Existing project: Install
checklypackage and authenticate