$ npm install sentry
The command-line interface for Sentry. Built for developers and AI agents.
Documentation | Getting Started | Commands
curl https://cli.sentry.dev/install -fsS | bash
irm https://cli.sentry.dev/install.ps1 | iex
brew install getsentry/tools/sentry
npm install -g sentry
pnpm add -g sentry
yarn global add sentry
bun add -g sentry
The npm/pnpm/yarn packages require Node.js 20+. On Node.js 22.15+ the CLI uses the built-in
node:sqlite; on Node.js 20–22.14 it transparently falls back to a bundled WASM SQLite driver.
Homebrew and package manager installs don't add agent skills (package managers also skip shell completions). Run sentry cli setup once afterwards; see the installation guide.
npx sentry@latest
pnpm dlx sentry --help
yarn dlx sentry --help
bunx sentry --help
# Authenticate with Sentry
sentry auth
# List issues (auto-detects project from your codebase)
sentry issue list
# Get AI-powered root cause analysis
sentry issue explain PROJ-ABC
# Generate a fix plan
sentry issue plan PROJ-ABC
.env files or source code. No flags needed.--json for scripting and pipelines.-w flag to open any resource in your browser.Run sentry --help to see all available commands, or browse the command reference.
Credentials are stored in $XDG_CONFIG_HOME/sentry/ (defaulting to ~/.config/sentry/) with restricted permissions (mode 600). A pre-existing legacy ~/.sentry/ directory is still honored, and the location can be overridden with SENTRY_CONFIG_DIR.
Use Sentry CLI programmatically in Node.js (≥20.0) without spawning a subprocess:
import createSentrySDK from "sentry";
const sdk = createSentrySDK({ token: "sntrys_..." });
// Typed methods for every CLI command
const orgs = await sdk.org.list();
const issues = await sdk.issue.list({ orgProject: "acme/frontend", limit: 5 });
const issue = await sdk.issue.view({}, "ACME-123");
// Nested commands
await sdk.dashboard.widget.add(
{ display: "line", query: ["count"] },
"acme/", "my-dashboard", "Errors over time"
);
// Escape hatch for any CLI command
const version = await sdk.run("--version");
const text = await sdk.run("issue", "list", "-n", "5");
Options (all optional):
token — Auth token. Falls back to the stored login from sentry auth login, then 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().headers — Extra HTTP headers for self-hosted instances behind a reverse proxy (same as SENTRY_CUSTOM_HEADERS). Ignored for sentry.io.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.
git clone https://github.com/getsentry/toolkit.git
cd toolkit
pnpm install
cd packages/cli
# Run CLI in development mode (generates missing build-time files on first run)
pnpm run cli --help
# Loads packages/cli/.env.local automatically when present (see DEVELOPMENT.md)
pnpm run cli auth status
pnpm run build # Build for current platform
pnpm run typecheck # Type checking
pnpm run lint # Check for issues
pnpm run lint:fix # Auto-fix issues
pnpm run test:unit # Run unit tests
pnpm run test:e2e # Run end-to-end tests
pnpm run generate:docs # Regenerate command docs and skills
See DEVELOPMENT.md for detailed setup and CONTRIBUTING.md for contribution guidelines.
© 2010 - cnpmjs.org x YWFE | Home | YWFE