Authentication

The AhaSend CLI uses profile-based authentication to manage your API credentials and support multiple environments.

Getting Started

You’ll need your API Key and Account ID from the AhaSend dashboard.

Interactive Login

ahasend auth login
You’ll be prompted for your API Key, Account ID, and an optional profile name.

Direct Login

ahasend auth login \
  --api-key YOUR_API_KEY \
  --account-id YOUR_ACCOUNT_ID \
  --profile production

Environment Variables

For automation or CI/CD:
export AHASEND_API_KEY="your-api-key"
export AHASEND_ACCOUNT_ID="your-account-id"

Profiles

Profiles let you manage multiple environments easily.

Creating Profiles

ahasend auth login --profile production
ahasend auth login --profile staging

Switching Profiles

# Change default profile
ahasend auth switch production

# Use profile for single command
ahasend messages send --profile staging \
  --from [email protected] \
  --to [email protected] \
  --subject "Test"

Check Status

ahasend auth status

Remove Profile

ahasend auth logout

Configuration

Credentials are stored in ~/.ahasend/config.yaml with secure file permissions.
Keep your API keys secure. Never commit credentials to version control.

Testing Authentication

Verify your setup:
ahasend ping
ahasend auth status

Next Steps