home / skills / getsentry / cli / sentry-cli

This skill helps you interact with Sentry from the command line by guiding authentication, orgs, projects, issues, events, and API calls.

npx playbooks add skill getsentry/cli --skill sentry-cli

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
7.1 KB
---
name: sentry-cli
description: Guide for using the Sentry CLI to interact with Sentry from the command line. Use when the user asks about viewing issues, events, projects, organizations, making API calls, or authenticating with Sentry via CLI.
---

# Sentry CLI Usage Guide

Help users interact with Sentry from the command line using the `sentry` CLI.

## Prerequisites

The CLI must be installed and authenticated before use.

### Installation

```bash
curl https://cli.sentry.dev/install -fsS | bash

# Or install via npm/pnpm/bun
npm install -g sentry
```

### Authentication

```bash
sentry auth login
sentry auth login --token YOUR_SENTRY_API_TOKEN
sentry auth status
sentry auth logout
```

## Available Commands

### Auth

Authenticate with Sentry

#### `sentry auth login`

Authenticate with Sentry

**Flags:**
- `--token <value> - Authenticate using an API token instead of OAuth`
- `--timeout <value> - Timeout for OAuth flow in seconds (default: 900) - (default: "900")`

**Examples:**

```bash
# OAuth device flow (recommended)
sentry auth login

# Using an API token
sentry auth login --token YOUR_TOKEN
```

#### `sentry auth logout`

Log out of Sentry

**Examples:**

```bash
sentry auth logout
```

#### `sentry auth refresh`

Refresh your authentication token

**Flags:**
- `--json - Output result as JSON`
- `--force - Force refresh even if token is still valid`

**Examples:**

```bash
sentry auth refresh
```

#### `sentry auth status`

View authentication status

**Flags:**
- `--showToken - Show the stored token (masked by default)`

**Examples:**

```bash
sentry auth status
```

### Org

Work with Sentry organizations

#### `sentry org list`

List organizations

**Flags:**
- `--limit <value> - Maximum number of organizations to list - (default: "30")`
- `--json - Output JSON`

**Examples:**

```bash
sentry org list

sentry org list --json
```

#### `sentry org view <arg0>`

View details of an organization

**Flags:**
- `--json - Output as JSON`
- `-w, --web - Open in browser`

**Examples:**

```bash
sentry org view <org-slug>

sentry org view my-org

sentry org view my-org -w
```

### Project

Work with Sentry projects

#### `sentry project list`

List projects

**Flags:**
- `--org <value> - Organization slug`
- `--limit <value> - Maximum number of projects to list - (default: "30")`
- `--json - Output JSON`
- `--platform <value> - Filter by platform (e.g., javascript, python)`

**Examples:**

```bash
# List all projects
sentry project list

# List projects in a specific organization
sentry project list <org-slug>

# Filter by platform
sentry project list --platform javascript
```

#### `sentry project view <arg0>`

View details of a project

**Flags:**
- `--org <value> - Organization slug`
- `--json - Output as JSON`
- `-w, --web - Open in browser`

**Examples:**

```bash
sentry project view <project-slug>

sentry project view frontend --org my-org

sentry project view frontend -w
```

### Issue

Manage Sentry issues

#### `sentry issue list`

List issues in a project

**Flags:**
- `--org <value> - Organization slug`
- `--project <value> - Project slug`
- `--query <value> - Search query (Sentry search syntax)`
- `--limit <value> - Maximum number of issues to return - (default: "10")`
- `--sort <value> - Sort by: date, new, freq, user - (default: "date")`
- `--json - Output as JSON`

**Examples:**

```bash
sentry issue list --org <org-slug> --project <project-slug>

sentry issue list --org my-org --project frontend

sentry issue list --org my-org --project frontend --query "TypeError"
```

#### `sentry issue explain <arg0>`

Analyze an issue's root cause using Seer AI

**Flags:**
- `--org <value> - Organization slug (required for short IDs if not auto-detected)`
- `--project <value> - Project slug (required for short suffixes if not auto-detected)`
- `--json - Output as JSON`
- `--force - Force new analysis even if one exists`

#### `sentry issue plan <arg0>`

Generate a solution plan using Seer AI

**Flags:**
- `--org <value> - Organization slug (required for short IDs if not auto-detected)`
- `--project <value> - Project slug (required for short suffixes if not auto-detected)`
- `--cause <value> - Root cause ID to plan (required if multiple causes exist)`
- `--json - Output as JSON`

#### `sentry issue view <arg0>`

View details of a specific issue

**Flags:**
- `--org <value> - Organization slug (required for short IDs if not auto-detected)`
- `--project <value> - Project slug (required for short suffixes if not auto-detected)`
- `--json - Output as JSON`
- `-w, --web - Open in browser`
- `--spans <value> - Show span tree with N levels of nesting depth`

**Examples:**

```bash
# By issue ID
sentry issue view <issue-id>

# By short ID
sentry issue view <short-id>

sentry issue view FRONT-ABC

sentry issue view FRONT-ABC -w
```

### Event

View Sentry events

#### `sentry event view <arg0>`

View details of a specific event

**Flags:**
- `--org <value> - Organization slug`
- `--project <value> - Project slug`
- `--json - Output as JSON`
- `-w, --web - Open in browser`
- `--spans <value> - Show span tree from the event's trace`

**Examples:**

```bash
sentry event view <event-id>

sentry event view abc123def456

sentry event view abc123def456 -w
```

### Api

Make an authenticated API request

#### `sentry api <endpoint>`

Make an authenticated API request

**Flags:**
- `-X, --method <value> - The HTTP method for the request - (default: "GET")`
- `-F, --field <value>... - Add a typed parameter (key=value, key[sub]=value, key[]=value)`
- `-f, --raw-field <value>... - Add a string parameter without JSON parsing`
- `-H, --header <value>... - Add a HTTP request header in key:value format`
- `--input <value> - The file to use as body for the HTTP request (use "-" to read from standard input)`
- `-i, --include - Include HTTP response status line and headers in the output`
- `--silent - Do not print the response body`
- `--verbose - Include full HTTP request and response in the output`

**Examples:**

```bash
sentry api <endpoint> [options]

# List organizations
sentry api /organizations/

# Get a specific organization
sentry api /organizations/my-org/

# Get project details
sentry api /projects/my-org/my-project/

# Create a new project
sentry api /teams/my-org/my-team/projects/ \
  --method POST \
  --field name="New Project" \
  --field platform=javascript

# Update an issue status
sentry api /issues/123456789/ \
  --method PUT \
  --field status=resolved

# Assign an issue
sentry api /issues/123456789/ \
  --method PUT \
  --field assignedTo="[email protected]"

# Delete a project
sentry api /projects/my-org/my-project/ \
  --method DELETE

sentry api /organizations/ \
  --header "X-Custom-Header:value"

sentry api /organizations/ --include

# Get all issues (automatically follows pagination)
sentry api /projects/my-org/my-project/issues/ --paginate
```

## Output Formats

### JSON Output

Most list and view commands support `--json` flag for JSON output, making it easy to integrate with other tools:

```bash
sentry org list --json | jq '.[] | .slug'
```

### Opening in Browser

View commands support `-w` or `--web` flag to open the resource in your browser:

```bash
sentry issue view PROJ-123 -w
```

Overview

This skill guides you to use the Sentry CLI to interact with Sentry from the command line. It covers installation, authentication, listing and viewing organizations, projects, issues, and events, plus making authenticated API calls. The goal is to help you perform common Sentry tasks quickly and integrate CLI output with scripts and tooling.

How this skill works

The skill explains how to install and authenticate the sentry CLI, then demonstrates commands for orgs, projects, issues, events, and raw API requests. It highlights flags like --json for machine-readable output, -w/--web to open resources in a browser, and options for pagination and request customization. Examples show typical workflows and how to pipe JSON output into tooling like jq.

When to use it

  • When you need to script or automate Sentry queries and updates from CI/CD or local scripts
  • When you want to inspect issues, events, projects, or organizations without using the web UI
  • When you must make authenticated API requests quickly from a terminal
  • When integrating Sentry data with other CLI tools or pipelines
  • When you need to open a Sentry resource directly in a browser from the terminal

Best practices

  • Authenticate before running commands and use --json for automation-friendly output
  • Prefer OAuth device flow for interactive login and API tokens for CI or automation
  • Scope commands with --org and --project to avoid accidentally modifying the wrong resource
  • Use --limit and --paginate to manage large result sets and avoid rate limiting surprises
  • When using sentry api, set headers and method explicitly and test changes on non-production resources first

Example use cases

  • List all projects for an organization and filter by platform: sentry project list --org my-org --platform javascript
  • Search and inspect recent issues from the terminal: sentry issue list --org my-org --project frontend --query "TypeError" --json | jq .
  • Open a specific issue or event in the browser: sentry issue view PROJ-123 -w or sentry event view abc123def456 -w
  • Make an authenticated API change, e.g., resolve an issue: sentry api /issues/123456789/ --method PUT --field status=resolved
  • Automate CI steps to create projects or fetch org details using sentry api with --field and --include flags

FAQ

How do I authenticate non-interactively for CI?

Create a scoped Sentry API token and run sentry auth login --token YOUR_TOKEN or store the token in CI secrets.

How can I get machine-readable output?

Add the --json flag to list and view commands to receive JSON you can pipe into jq or other tools.

Can I modify resources via the CLI?

Yes — use sentry api with --method, --field, and headers to create, update, or delete resources. Test on non-production resources first.