The command-line interface for Sentry. Built for developers and AI agents.
Documentation |
Getting Started |
Commands
Installation
Install Script (Recommended)
curl https://cli.sentry.dev/install -fsS | bash
Homebrew
brew install getsentry/tools/sentry
Package Managers
npm install -g sentry
pnpm add -g sentry
bun add -g sentry
Run Without Installing
npx sentry@latest
Quick Start
sentry auth login
sentry issue list
sentry issue explain PROJ-ABC
sentry issue plan PROJ-ABC
Features
- DSN Auto-Detection - Automatically detects your project from
.env files or source code. No flags needed.
- Seer AI Integration - Get root cause analysis and fix plans directly in your terminal.
- Monorepo Support - Works with multiple projects, generates short aliases for easy navigation.
- JSON Output - All commands support
--json for scripting and pipelines.
- Open in Browser - Use
-w flag to open any resource in your browser.
Commands
Run sentry --help to see all available commands, or browse the command reference.
Configuration
Credentials are stored in ~/.sentry/ with restricted permissions (mode 600).
Library Usage
Use Sentry CLI programmatically in Node.js (≥22) or Bun without spawning a subprocess:
import createSentrySDK from "sentry";
const sdk = createSentrySDK({ token: "sntrys_..." });
const orgs = await sdk.org.list();
const issues = await sdk.issue.list({ orgProject: "acme/frontend", limit: 5 });
const issue = await sdk.issue.view({ issue: "ACME-123" });
await sdk.dashboard.widget.add({ display: "line", query: "count" }, "my-org/my-dashboard");
const version = await sdk.run("--version");
const text = await sdk.run("issue", "list", "-l", "5");
Options (all optional):
token — Auth token. Falls back to SENTRY_AUTH_TOKEN / SENTRY_TOKEN env vars.
url — Sentry instance URL for self-hosted (e.g., "sentry.example.com").
org — Default organization slug (avoids passing it on every call).
project — Default project slug.
text — Return human-readable string instead of parsed JSON (affects run() only).
cwd — Working directory for DSN auto-detection. Defaults to process.cwd().
signal — AbortSignal to cancel streaming commands (--follow, --refresh).
Streaming commands return AsyncIterable — use for await...of and break to stop.
Errors are thrown as SentryError with .exitCode and .stderr.
Development
Prerequisites
Setup
git clone https://github.com/getsentry/cli.git
cd cli
bun install
Running Locally
bun run dev --help
bun run --env-file=.env.local src/bin.ts --help
Scripts
bun run build
bun run typecheck
bun run lint
bun run lint:fix
bun test
See DEVELOPMENT.md for detailed setup and CONTRIBUTING.md for contribution guidelines.
License
FSL-1.1-Apache-2.0