Authentication
SENTRY_AUTH_TOKEN
Type: StringPriority: Highest (overrides
SENTRY_TOKEN and stored OAuth tokens)
Authentication token for Sentry API requests. This can be:
- An OAuth access token (from
sentry auth login) - A user auth token (from Sentry settings)
- An org auth token (for CI/CD)
- Skips all OAuth flows
- Ignores stored tokens in the database
- Assumes the token is valid (no refresh/expiry checks)
SENTRY_TOKEN
Type: StringPriority: Medium (used if
SENTRY_AUTH_TOKEN is not set)
Alternative to SENTRY_AUTH_TOKEN. Provided for compatibility with legacy Sentry CLI tools.
Configuration
SENTRY_URL
Type: URLDefault:
https://sentry.io
The base URL of your Sentry instance. Required for self-hosted Sentry installations.
- OAuth device flow
- API requests (for control silo)
- Region discovery
SENTRY_ORG
Type: String Default organization slug for commands that require an organization context.- Commands use this org by default
- Can be overridden by positional arguments or
--orgflag - Auto-detection is skipped
SENTRY_PROJECT
Type: String Default project slug for commands that require a project context.- Commands use this project by default
- Can be overridden by positional arguments
- Auto-detection is skipped
SENTRY_ORG and SENTRY_PROJECT must be set together for project-scoped commands.
SENTRY_DSN
Type: DSN URL Sentry DSN (Data Source Name) for auto-detecting org/project context.- The CLI extracts org and project information from the DSN
- Takes precedence over file-based DSN detection
- Can be overridden by
SENTRY_ORG/SENTRY_PROJECTor command arguments
SENTRY_CONFIG_DIR
Type: Directory pathDefault:
~/.config/sentry-cli (Linux/macOS), %APPDATA%\sentry-cli (Windows)
Custom location for the CLI’s configuration directory and SQLite database.
- Running multiple CLI instances with separate configs
- Testing and development
- Containerized environments
SENTRY_CLIENT_ID
Type: StringRequired: For self-hosted OAuth OAuth client ID for device flow authentication. Required for self-hosted Sentry instances (version 26.1.0+).
- Go to your Sentry instance Settings → Developer Settings
- Create a new public OAuth application
- Copy the client ID
Behavior Control
SENTRY_LOG_LEVEL
Type: StringDefault:
infoValues:
error, warn, info, debug, trace
Controls the verbosity of CLI logging output.
error(0): Only errorswarn(1): Errors and warningsinfo(3): Normal output (default)debug(4): Detailed debugging informationtrace(5): Very verbose (includes HTTP requests)
--log-level flag or --verbose flag (sets level to debug).
NO_COLOR
Type: Boolean (1 or unset)Default: Unset Disables colored output in the CLI.
- All ANSI color codes are stripped from output
- Markdown formatting is rendered as plain text
- Useful for CI/CD environments or when piping output
SENTRY_PLAIN_OUTPUT
Type: Boolean (1 or unset)Default: Unset Forces plain text output (disables color and fancy formatting).
NO_COLOR but with higher priority. Checked before NO_COLOR and TTY detection.
SENTRY_DISABLE_UPDATE_CHECK
Type: Boolean (1 or unset)Default: Unset Disables automatic version update checks.
- The CLI won’t check for new versions on startup
- Update notifications are suppressed
- Useful for CI/CD environments
Advanced
SENTRY_CLI_NO_AUTO_REPAIR
Type: Boolean (1 or unset)Default: Unset Disables automatic database schema repair.
- Schema errors will cause the CLI to exit instead of auto-fixing
- Useful for debugging schema migration issues
- Not recommended for normal use
SENTRY_CLI_DSN
Type: DSN URLDefault:
https://[email protected]/4510776311808000 (hardcoded)
DSN for CLI telemetry (error tracking of the CLI itself, not your projects).
SENTRY_DSN.
Test Environment Variables
These variables are used by the CLI’s test suite and should not be set in production.SENTRY_TEST_AUTH_TOKEN
Type: StringPurpose: Authentication token for E2E tests
SENTRY_TEST_ORG
Type: StringPurpose: Test organization slug for E2E tests
SENTRY_TEST_PROJECT
Type: StringPurpose: Test project slug for E2E tests
Precedence Rules
When multiple sources provide the same configuration, the CLI uses this precedence order (highest to lowest):Authentication
SENTRY_AUTH_TOKENenvironment variableSENTRY_TOKENenvironment variable- Stored OAuth token in database
Organization/Project Context
- Command-line positional arguments (e.g.,
sentry issue list org/project) - Command-line flags (
--org,--project) SENTRY_ORGandSENTRY_PROJECTenvironment variablesSENTRY_DSNenvironment variable (extracts org/project)- DSN auto-detection (scans files in current directory)
- Stored defaults in database
Output Formatting
--jsoncommand-line flagSENTRY_PLAIN_OUTPUTenvironment variableNO_COLORenvironment variable- TTY detection (auto-detects if output is a terminal)
Usage Examples
CI/CD Environment
Self-Hosted Sentry
Development/Testing
Multiple Environments
Security Best Practices
Protecting Sensitive Environment Variables
Protecting Sensitive Environment Variables
-
Never commit tokens to version control
- Add
.env.localto.gitignore - Use secret management services (GitHub Secrets, AWS Secrets Manager, etc.)
- Add
-
Use restricted tokens in CI/CD
- Create org auth tokens with minimal scopes
- Avoid using personal user tokens
-
Rotate tokens regularly
- Generate new tokens periodically
- Revoke old tokens after rotation
-
Use environment-specific tokens
- Separate tokens for dev, staging, and production
- Limit token access to specific projects when possible
-
Audit token usage
- Monitor auth token usage in Sentry settings
- Investigate unexpected usage patterns
Related Documentation
- Configuration File - SQLite database structure
- Troubleshooting - Common issues and solutions
- Authentication - Auth command reference