Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions apps/cli-docs/src/fragments/commands/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,33 @@ bodies; streaming responses such as SSE are excluded.

When querying the Events API (`/events/` endpoint), valid dataset values are: `spans`, `logs`, `errors`, `tracemetrics`, `profile_functions`, and `uptime_results`.

## Pagination

Each invocation fetches one server page. Repeat the same GET endpoint and filters
with `--cursor next` (`-c next`) to continue, `--cursor prev` to revisit a page,
or `--cursor first` to start again. The shared history expires after five minutes
and is scoped to the request and authenticated identity. Keep the same query
parameters and headers when navigating. The endpoint remains required.

Raw server cursors and custom cursors from the CLI's shared paginator are also
accepted. Custom cursors preserve the page size and skip rows already returned,
including when navigating back to a bookmarked page. A cursor's encoded page
size takes precedence over `per_page`. Mid-page bookmarks support array bodies
and responses with a `data` array, such as the Events API; envelope metadata is
preserved. Other response bodies remain unchanged for ordinary cursors.

With `--json`, `pagination.nextCursor` is the CLI continuation and can retain a
custom bookmark; pass it back through `--cursor` to resume exactly.
`pagination.prevCursor` comes from the server, while `pagination.hasPrev`
indicates a previously visited page in local history. `--fields` filters only
the body and preserves this metadata.
The pagination object is omitted when no continuation or local previous page is
available. Its absence does not prove a complete or unsampled dataset.

`--cursor` replaces cursor parameters from the endpoint and request fields. It is
only supported for GET requests. `--dry-run` previews the resolved request;
dry-runs and failed requests do not advance the saved history.

## Binary responses

Endpoints that return binary data — image attachments, minidumps, debug files — are streamed to stdout as raw bytes, so you can redirect them straight to a file.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Make an authenticated API request

**Flags:**
- `-X, --method <value> - The HTTP method for the request - (default: "GET")`
- `-c, --cursor <value> - Navigate pages: "next", "prev", "first" (or raw cursor string)`
- `-d, --data <value> - Inline JSON body for the request (like curl -d)`
- `-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`
Expand All @@ -38,6 +39,15 @@ Make an authenticated API request
# List organizations
sentry api organizations/

# Read a page and its pagination metadata
sentry api organizations/ -f per_page=2 --json

# Continue the same query using shared pagination
sentry api organizations/ -f per_page=2 --cursor next --json

# Return to the previously visited page
sentry api organizations/ -f per_page=2 --cursor prev --json

# Get a specific issue
sentry api issues/123456789/

Expand Down
Loading
Loading