Skip to content
Docs GitHub

Self-Hosted Sentry

The CLI works with self-hosted Sentry instances. Set the SENTRY_URL environment variable to point at your instance:

Terminal window
export SENTRY_URL=https://sentry.example.com

Authenticating

With OAuth (Sentry 26.1.0+)

The OAuth device flow requires Sentry 26.1.0 or later and a public OAuth application registered on your instance.

1. Create a Public OAuth Application

  1. In your Sentry instance, go to Settings → Developer Settings → Applications → Create New Application (or visit https://sentry.example.com/settings/account/api/applications/)
  2. Select Public as the application type
  3. Fill in the required fields (name, redirect URL — can be any placeholder URL)
  4. Save the application and copy the Client ID

2. Log In

Pass your instance URL and the client ID:

Terminal window
SENTRY_URL=https://sentry.example.com SENTRY_CLIENT_ID=your-client-id sentry auth login

With an API Token

If your instance is on an older version or you prefer not to create an OAuth application, you can use an API token instead:

  1. Go to Settings → Developer Settings → Personal Tokens in your Sentry instance (or visit https://sentry.example.com/settings/account/api/auth-tokens/new-token/)
  2. Create a new token with the following scopes: project:read, project:write, org:read, event:read, event:write, member:read, team:read
  3. Pass it to the CLI:
Terminal window
SENTRY_URL=https://sentry.example.com sentry auth login --token YOUR_TOKEN

After Login

Once authenticated, the CLI stores your instance URL — you don’t need to set SENTRY_URL on every command. All subsequent commands automatically use the correct instance:

Terminal window
sentry issue list
sentry org list

If you pass a self-hosted Sentry URL as a command argument (e.g., an issue or event URL), the CLI detects the instance automatically.

Relevant Environment Variables

VariableDescription
SENTRY_URLBase URL of your Sentry instance
SENTRY_CLIENT_IDClient ID of your public OAuth application
SENTRY_ORGDefault organization slug
SENTRY_PROJECTDefault project slug (supports org/project format)

See Configuration for the full environment variable reference.