Skip to content

Authentication

atlcli supports authentication for both Atlassian Cloud and Server/Data Center installations, with multiple profiles for different instances.

Terminal window
# Initialize credentials (interactive)
atlcli auth init
# Check current status
atlcli auth status
# List all profiles
atlcli auth list

atlcli supports both Atlassian deployment types with different authentication methods:

DeploymentAuth MethodToken Type
Cloud (*.atlassian.net)Basic AuthAPI Token
Server / Data CenterBearer AuthPersonal Access Token (PAT)

Cloud instances use your email address and an API token for authentication. This is the default mode.

Server/Data Center instances use Bearer authentication with a Personal Access Token (PAT). Use the --bearer flag when logging in.

  1. Visit Atlassian Account Settings
  2. Click Create API token
  3. Enter a label (e.g., “atlcli”)
  4. Copy the generated token immediately (it won’t be shown again)

API tokens inherit your account permissions. For atlcli to work fully, your account needs:

  • Confluence: Space admin or contributor permissions
  • Jira: Project access for issues you want to manage

Interactive setup that prompts for all credentials:

Terminal window
atlcli auth init
atlcli auth init --profile work

Login with credentials provided via flags or environment.

Terminal window
atlcli auth login --site https://company.atlassian.net --email you@company.com --token YOUR_TOKEN
atlcli auth login --profile work --site https://work.atlassian.net

Use the --bearer flag for PAT authentication:

Terminal window
# With token provided directly
atlcli auth login --bearer --site https://jira.company.com --token YOUR_PAT
# With keychain lookup (macOS)
atlcli auth login --bearer --site https://jira.company.com --username myuser

Options:

FlagDescription
--siteAtlassian instance URL
--emailAccount email (Cloud)
--tokenAPI token (Cloud) or PAT (Server/DC)
--bearerUse Bearer auth with PAT (for Server/DC)
--usernameUsername for keychain lookup (Server/DC)
--profileProfile name to create/update

Check current authentication status:

Terminal window
atlcli auth status

Output:

Profile: work (active)
Site: https://company.atlassian.net
Email: you@company.com
Status: Authenticated ✓
Terminal window
atlcli auth list

Output:

PROFILE SITE EMAIL ACTIVE
default https://company.atlassian.net you@company.com
work https://work.atlassian.net work@company.com ✓
personal https://personal.atlassian.net me@gmail.com

Change the active profile:

Terminal window
atlcli auth switch work
atlcli auth switch personal
Terminal window
atlcli auth rename old-name new-name

Clear credentials but keep the profile (for easy re-login):

Terminal window
atlcli auth logout
atlcli auth logout work

Remove a profile entirely:

Terminal window
atlcli auth delete old-profile
atlcli auth delete old-profile --delete-keychain # macOS only

When deleting a profile with a keychain-backed token, use --delete-keychain to remove the stored credentials. Without it, keychain credentials (if any) are left intact.

Initialize the default profile:

Terminal window
atlcli auth init

Enter your instance URL, email, and API token when prompted.

Create profiles for multiple instances:

Terminal window
atlcli auth init --profile work
atlcli auth init --profile personal
atlcli auth init --profile client-acme

Use a profile with any command:

Terminal window
atlcli jira search --assignee me --profile work
atlcli wiki docs pull ./docs --profile client-acme
Terminal window
# Use specific profile for one command
atlcli wiki page list --space TEAM --profile work

Credentials are stored at ~/.atlcli/credentials.json:

{
"currentProfile": "work",
"profiles": {
"default": {
"name": "default",
"baseUrl": "https://company.atlassian.net",
"email": "you@company.com",
"apiToken": "ATATT3x..."
},
"work": {
"name": "work",
"baseUrl": "https://work.atlassian.net",
"email": "work@company.com",
"apiToken": "ATATT3x..."
}
}
}

For Server/Data Center profiles using Bearer auth, the profile includes authType: "bearer" and may include a username for keychain lookup.

On macOS, you can store tokens securely in the system Keychain instead of the config file. When you provide a --username during login, atlcli stores the token in Keychain and looks it up automatically:

Terminal window
# Store token in Keychain during login
atlcli auth login --bearer --site https://jira.company.com --username myuser --token YOUR_PAT
# Token is now stored in Keychain - subsequent logins can use keychain lookup
atlcli auth login --bearer --site https://jira.company.com --username myuser

The token is stored with:

  • Service: atlcli
  • Account: Your username

Tokens are resolved in this order (first found wins):

  1. ATLCLI_API_TOKEN environment variable
  2. Mac Keychain (if username is configured in profile)
  3. Config file (~/.atlcli/credentials.json)

Use --json to see where your token is coming from:

Terminal window
atlcli auth status --json

The output includes:

  • hasEnvToken: Token is set via environment variable
  • hasKeychainToken: Token is available from Keychain
  • hasPatInConfig: Token is stored in config file

Override credentials with environment variables:

VariableDescription
ATLCLI_SITEAtlassian instance URL
ATLCLI_EMAILAccount email (Cloud)
ATLCLI_API_TOKENAPI token (Cloud) or PAT (Server/DC)
ATLCLI_PROFILEDefault profile name

Environment variables take precedence over config files:

Terminal window
export ATLCLI_SITE="https://ci.atlassian.net"
export ATLCLI_EMAIL="ci@company.com"
export ATLCLI_API_TOKEN="$CI_ATLASSIAN_TOKEN"
atlcli jira search --jql "project = PROJ"

Credentials are resolved in this order (later wins):

  1. Default profile in config
  2. ATLCLI_PROFILE environment variable
  3. ATLCLI_SITE / ATLCLI_EMAIL / ATLCLI_API_TOKEN env vars
  4. --profile command flag

For CI/CD pipelines, use environment variables or secrets:

- name: Search Jira
env:
ATLCLI_SITE: ${{ secrets.ATLASSIAN_URL }}
ATLCLI_EMAIL: ${{ secrets.ATLASSIAN_EMAIL }}
ATLCLI_API_TOKEN: ${{ secrets.ATLASSIAN_TOKEN }}
run: atlcli jira search --jql "fixVersion = ${{ github.ref_name }}"
jira-update:
script:
- atlcli jira issue transition --key $ISSUE_KEY --to Done
variables:
ATLCLI_SITE: $ATLASSIAN_URL
ATLCLI_EMAIL: $ATLASSIAN_EMAIL
ATLCLI_API_TOKEN: $ATLASSIAN_TOKEN
environment {
ATLCLI_SITE = credentials('atlassian-url')
ATLCLI_EMAIL = credentials('atlassian-email')
ATLCLI_API_TOKEN = credentials('atlassian-token')
}
Terminal window
docker run -e ATLCLI_SITE -e ATLCLI_EMAIL -e ATLCLI_API_TOKEN atlcli jira search
Error: Authentication failed (401)
  • Verify your API token hasn’t expired
  • Check the instance URL includes https://
  • Confirm email matches your Atlassian account
  • Re-initialize: atlcli auth init
Error: You don't have permission (403)
  • Check your account has access to the project/space
  • For Jira, verify project permissions
  • For Confluence, verify space permissions
Terminal window
# Check which profile is active
atlcli auth status
# Switch if needed
atlcli auth switch correct-profile

Atlassian API tokens can expire. Regenerate and update:

Terminal window
# Generate new token at https://id.atlassian.com/manage-profile/security/api-tokens
# Then update
atlcli auth init --profile work
Error: Authentication failed (401)

For Server/Data Center instances:

  • Verify you used --bearer flag when logging in
  • Check that your PAT hasn’t expired (Server/DC PATs have expiration dates)
  • Confirm the PAT has the required permissions in your Atlassian admin settings
  • Ensure the instance URL is correct and accessible

To re-authenticate:

Terminal window
atlcli auth login --bearer --site https://jira.company.com --token YOUR_NEW_PAT

If Keychain lookup fails:

  • Verify the token was stored: security find-generic-password -s atlcli -a <username>
  • Re-store the token: atlcli auth login --bearer --site <url> --username <user> --token <pat>
  • Check Keychain Access app for any access issues
Jira and Confluence are trademarks of Atlassian Corporation Plc. atlcli is not affiliated with, endorsed by, or sponsored by Atlassian.