> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ancha.io/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> These docs describe the Ancha CLI, npm package @ancha-labs/cli, and the hosted workspace at app.ancha.io. Coding agents should start at https://docs.ancha.io/coding-agents. Run the CLI as `ancha` after `npm install -g @ancha-labs/cli`, or as `npx -y @ancha-labs/cli` without installing. Pass --json for machine-readable output, or set ANCHA_JSON=1. Every command ends with a `next:` line naming the next command. Exit codes: 0 pass, 1 a check failed or a comparison regressed, 2 usage, config or authentication error, 3 infrastructure error, 4 unimplemented endpoint with --strict.

# Sentry

> Test an agent against Sentry's REST API for issues, error events, triage, tags, comments, releases and deploys.

The Sentry replica implements 32 endpoints under `/api/0/`. You can search errors, inspect events, assign and resolve issues, add comments and record releases and deploys. Its key is `sentry`.

## Connect

| Variable | Value |
| - | - |
| `SENTRY_API_URL` | Base URL. Append `/api/0/` and the endpoint path. |
| `SENTRY_AUTH_TOKEN` | Fake auth token. Send `Authorization: Bearer <token>`. |

```ts TypeScript theme={null}
const sentry = (path: string) => fetch(`${process.env.SENTRY_API_URL}/api/0/${path}`, { headers: { Authorization: `Bearer ${process.env.SENTRY_AUTH_TOKEN}` } });
const [org] = await (await sentry('organizations/')).json();
const res = await sentry(`organizations/${org.slug}/issues/?query=${encodeURIComponent('is:unresolved')}&statsPeriod=24h`);
const issues = await res.json();
```

This is the request sequence `ancha connect sentry --lang ts` prints. Lists page through the `Link` response header: follow the next page when it has `rel="next"` and `results="true"`, using its `cursor`.

## Endpoints

| Method | Path | Support |
| - | - | - |
| `GET` | `/api/0/` | supported: API root: the token scopes and its user. |
| `GET` | `/api/0/organizations/` | supported: The one organization; `query` matches its name or slug. |
| `GET` | `/api/0/organizations/:org/` | supported: With its teams and projects; links point at this service. |
| `GET` | `/api/0/organizations/:org/projects/` | supported |
| `GET` | `/api/0/organizations/:org/teams/` | supported: `detailed=0` leaves out projects. |
| `GET` | `/api/0/organizations/:org/members/` | supported: `query` matches email or name; `email:`, `role:` and `team:` filters. |
| `GET` | `/api/0/projects/:org/:project/` | supported |
| `GET` | `/api/0/projects/:org/:project/keys/` | supported: DSNs point at this service; event ingestion is a gap. |
| `GET` | `/api/0/organizations/:org/releases/` | supported: Newest first; `query` matches the version; `project` and `environment` filters. Other sorts are gaps. |
| `GET` | `/api/0/projects/:org/:project/releases/` | supported |
| `POST` | `/api/0/organizations/:org/releases/` | partial: An existing version answers 208 and gains the projects. Commits and refs are gaps. |
| `GET` | `/api/0/organizations/:org/releases/:version/` | supported |
| `PUT` | `/api/0/organizations/:org/releases/:version/` | partial: `ref`, `url`, `dateReleased` and `status`; commits and refs are gaps. |
| `GET` | `/api/0/organizations/:org/releases/:version/deploys/` | supported |
| `POST` | `/api/0/organizations/:org/releases/:version/deploys/` | supported |
| `GET` | `/api/0/organizations/:org/issues/` | partial: status, assignment, level, releases, environments, times, priority, users, errors, tags and free text. Sorts `date`, `new`, `freq`, `user` and `inbox`; `trends` and `recommended` are gaps. |
| `PUT` | `/api/0/organizations/:org/issues/` | partial: By `id`, or every issue matching `query`; answers with the changes. Merge and discard are gaps. |
| `GET` | `/api/0/projects/:org/:project/issues/` | partial: As the organization list for one project; the default query is `is:unresolved`. |
| `GET` | `/api/0/organizations/:org/issues/:issue/` | supported: By ID or short ID, with activity, tags, releases and stats. |
| `PUT` | `/api/0/organizations/:org/issues/:issue/` | partial: status, resolution in a release or the next release, archive conditions, `assignedTo`, `priority`, `hasSeen`, `isBookmarked`, `isSubscribed`, `isPublic`, `inbox: false`. Merge, discard and `inCommit` are gaps. |
| `DELETE` | `/api/0/organizations/:org/issues/:issue/` | supported: 202; the issue and its events are gone. |
| `GET` | `/api/0/organizations/:org/shortids/:short/` | supported |
| `GET` | `/api/0/organizations/:org/issues/:issue/events/` | supported: Newest first; `full=true` adds entries; `query` and `environment` filter. |
| `GET` | `/api/0/organizations/:org/issues/:issue/events/:event/` | supported: `latest`, `oldest`, `recommended` (the latest) or an event ID. |
| `GET` | `/api/0/organizations/:org/issues/:issue/tags/:key/` | supported |
| `GET` | `/api/0/organizations/:org/issues/:issue/tags/:key/values/` | supported: Most common first; `sort`: `date`, `-date`, `age` or `count`. |
| `GET` | `/api/0/organizations/:org/issues/:issue/comments/` | supported: Notes, newest first. |
| `POST` | `/api/0/organizations/:org/issues/:issue/comments/` | supported: `text`; the same comment twice within an hour is refused, as on Sentry. |
| `GET` | `/api/0/projects/:org/:project/events/` | supported: Newest first; `full=true` adds entries. |
| `GET` | `/api/0/projects/:org/:project/events/:event/` | supported: Next and previous events within the project. |
| `GET` | `/api/0/organizations/:org/eventids/:event/` | supported |
| `GET` | `/api/0/organizations/:org/events/` | partial: The errors dataset: event fields and tags, `count()`, `count_unique(field)`, `last_seen()`, `first_seen()`, `min(timestamp)` and `max(timestamp)`, grouped by the plain fields; sort by a selected field; event search filters. Other datasets, functions, aggregate conditions and `OR`/`AND` are gaps. |

Issue routes under `/api/0/organizations/:org/issues/:issue` also accept `/api/0/issues/:issue`, with the same suffix. Run `ancha twins coverage sentry` for the endpoint notes.

The organization issue list defaults to `is:unresolved issue.priority:[high, medium]` over 14 days. Set `query` and `statsPeriod` explicitly when your agent needs a different set of issues. The project issue list defaults to `is:unresolved`.

## Starter data

The `sentry-starter` dataset is the organization **Acme** (`acme`). Your token belongs to **Ancha assistant**. Ben, Rachel, Greg and Victor are members, with Backend, Frontend and Data Platform teams.

| Project | Starting issues |
| - | - |
| `orders-api` | A database pool timeout that returns after the 4.12.1 rollback, a missing SKU error, an already-cancelled order error and a resolved fulfillment webhook timeout. |
| `checkout` | A tax provider timeout Greg archived, with later error events. |
| `payments` | Webhook signature verification errors that return after Greg resolved the issue. |
| `warehouse-sync` | Snowflake maintenance errors and a memory error marked resolved in `warehouse-sync@1.19.0`. |
| `web` | Reports returning 502, a dashboard chunk load error and a tooltip error marked resolved in the next release. |

The dataset has eleven issues and nine releases, with deploys, error histories, tags, stack traces and comments. `ancha sandbox configuration --tools sentry --json` prints every record.

## Checks

Sentry has no state checks. Use [trace checks](https://docs.ancha.io/concepts/checks.md#trace-patterns), for example `{ called: "PUT /api/0/organizations/*/issues/*/" }` or `{ not_called: "DELETE /api/0/organizations/*/issues/*/" }`. If your client uses the shorter issue routes, use `/api/0/issues/*/` in the pattern instead.

## Limits

* Client keys return DSNs pointing at the replica, but event ingestion is a coverage gap.
* No issue merging or discarding, release commits or alerts.
* The organization events query serves the errors dataset. Other datasets, unlisted aggregate functions, aggregate conditions and `OR`/`AND` are gaps.
* Issue sorts `trends` and `recommended` are gaps.


## Related topics

- [Tools](https://docs.ancha.io/tools/overview.md)
- [Introduction](https://docs.ancha.io/index.md)
- [Environment variables](https://docs.ancha.io/reference/environment-variables.md)
- [Changelog](https://docs.ancha.io/changelog.md)
- [ancha connect](https://docs.ancha.io/cli/connect.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.