Sazabi
CLI

Authentication

Authenticate the Sazabi CLI using browser-based OAuth or API keys for automated workflows.

The Sazabi CLI supports two authentication methods: browser-based OAuth for interactive use, and API keys for scripts and CI pipelines.

Logging in

Authenticate using your Sazabi account:

sazabi auth login

This opens your default browser where you can log in to Sazabi. Once authenticated, the CLI stores your credentials locally and you can start running commands.

The CLI stores credentials in ~/.sazabi/settings.json. This file is only readable by your user account.

Profiles

If you work with multiple Sazabi accounts or organizations, use profiles to switch between them without logging out.

Creating profiles

Create a named profile when logging in:

sazabi auth login --profile work
sazabi auth login --profile personal

Using profiles

Set the active profile for a single command using the SAZABI_PROFILE environment variable:

SAZABI_PROFILE=work sazabi projects list

Or use the --profile flag:

sazabi projects list --profile work

Default profile

When no profile is specified, the CLI uses the default profile. The first time you run sazabi auth login without a profile name, it creates the default profile.

Environment variables

Configure the CLI using environment variables. These are useful for CI/CD pipelines and scripts where interactive authentication is not possible.

VariableDescription
SAZABI_PROFILESelect which profile to use
SAZABI_TOKENUse an API key instead of OAuth credentials
SAZABI_ORG_IDOverride the default organization
SAZABI_PROJECT_IDOverride the default project

Using API keys

For automated workflows, use an API key instead of OAuth:

export SAZABI_TOKEN="sk_live_..."
sazabi logs tail

API keys provide full access to your organization. Store them securely and never commit them to source control.

You can create API keys in the Sazabi dashboard under Settings > API Keys.

Verifying authentication

Check your current authentication status:

sazabi auth whoami

This shows:

  • The currently active profile
  • The authenticated user's email
  • The default organization and project
Profile: default
User: you@example.com
Organization: Acme Corp
Project: production-api

Logging out

Remove stored credentials for a profile:

# Log out of the current profile
sazabi auth logout

Troubleshooting

Browser does not open

If the browser does not open automatically during login, copy the URL from the terminal and paste it into your browser manually.

"Invalid credentials" error

Your stored credentials may have expired. Run sazabi auth login to re-authenticate.

"Organization not found" error

Your account may not have access to the organization. Check that:

  1. You are logged in with the correct account (sazabi auth whoami)
  2. Your account has been invited to the organization
  3. If using an API key, verify it belongs to the correct organization

Permission denied on settings file

The settings file at ~/.sazabi/settings.json may have incorrect permissions. Fix them with:

chmod 600 ~/.sazabi/settings.json

Next steps