# Issues

```
GET /api/v1/sources/{id}/issues
```

Lists a source's exception-grouped issues (see how these are formed in the
[Alerts](https://tailcove.dev/docs/alerts) docs' exception grouping notes). Requires the
`issues:read` ability.

## Query parameters

| Parameter | Type    | Default      | Notes                                                                          |
| --------- | ------- | ------------ | ------------------------------------------------------------------------------ |
| `status`  | string  | all statuses | One of `open`, `resolved`, `ignored`.                                          |
| `limit`   | integer | 50           | Max `500`.                                                                     |
| `cursor`  | string  | none         | Opaque token from a previous response's `meta.next_cursor`, for the next page. |

## Example

```bash
curl -G https://tailcove.dev/api/v1/sources/src_01jbx5q8k7m3n2p4r6s8t0v1w3/issues \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  --data-urlencode "status=open"
```

```json
{
    "data": [
        {
            "id": "iss_01jbx5qa3v7n9p2r4s6t8v0w1x",
            "sourceId": "src_01jbx5q8k7m3n2p4r6s8t0v1w3",
            "title": "PaymentGatewayTimeoutException: Payment gateway timeout",
            "firstSeen": "2026-06-28T11:02:00.000000Z",
            "lastSeen": "2026-07-03T18:41:02.000000Z",
            "occurrencesCount": 214,
            "status": "open"
        }
    ],
    "meta": {
        "next_cursor": null,
        "prev_cursor": null
    }
}
```

Pass `meta.next_cursor` back as `cursor` to fetch the next page, the same
way as the [Logs](https://tailcove.dev/docs/api/logs) endpoint.

To find the lines of code that raised a source's open issues, use
[Code hotspots](https://tailcove.dev/docs/api/code-hotspots).

## One issue

`GET /api/v1/sources/{source_id}/issues/{issue_id}` needs `issues:read`. With `logs:read` as well, it also carries the
latest occurrence's message, the stack trace of the latest occurrence that has one, and the 20 most recent occurrences;
without it those come back empty. Keys are snake_case.

```json
{
    "data": {
        "id": "iss_01jbx5qa3v7n9p2r4s6t8v0w1x",
        "source_id": "src_01jbx5q8k7m3n2p4r6s8t0v1w3",
        "title": "CardDeclined: insufficient funds",
        "status": "open",
        "occurrences_count": 214,
        "first_seen": "2026-11-20T08:14:00.000Z",
        "last_seen": "2026-11-30T11:00:00.000Z",
        "url": "https://tailcove.dev/sources/src_01jbx5q8k7m3n2p4r6s8t0v1w3/issues/iss_01jbx5qa3v7n9p2r4s6t8v0w1x",
        "culprit": {
            "file": "/var/www/html/app/Jobs/ChargeCard.php",
            "line": 42
        },
        "can_write": false,
        "latest": {
            "ts": "2026-11-30 11:00:00.000",
            "level": "error",
            "message": "Card declined for order 1001",
            "host": "web-1"
        },
        "stack": [
            {
                "function": "App\\Payments\\Gateway->charge",
                "path": "app/Jobs/ChargeCard.php",
                "file": "/var/www/html/app/Jobs/ChargeCard.php",
                "line": 42,
                "column": null,
                "in_app": true
            }
        ],
        "recent": [
            {
                "ts": "2026-11-30 11:00:00.000",
                "level": "error",
                "message": "Card declined for order 1001",
                "host": "web-1"
            }
        ]
    }
}
```

A frame's `path` is the repository path when the [code link](https://tailcove.dev/docs/code-links) rules placed it, else `null`.
`can_write` says whether this token may change the issue.

## Resolve, reopen or ignore

These need `issues:write` and a role that changes data (a Viewer's token gets `403`). Each answers `200` with the issue
in the shape above, without `latest`, `stack` and `recent`, and is recorded on the issue's timeline as you.

- `POST /api/v1/sources/{source_id}/issues/{issue_id}/resolve`: a later occurrence reopens it as a regression.
- `POST /api/v1/sources/{source_id}/issues/{issue_id}/reopen`
- `POST /api/v1/sources/{source_id}/issues/{issue_id}/ignore` with `{"mode": "forever"}` (the default),
  `{"mode": "day"}`, or `{"mode": "events", "events": 100}` to ignore it until it happens 100 more times.

```bash
curl -X POST https://tailcove.dev/api/v1/sources/src_01jbx5q8k7m3n2p4r6s8t0v1w3/issues/iss_01jbx5qa3v7n9p2r4s6t8v0w1x/ignore \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"mode": "events", "events": 100}'
```

## Live updates

Instead of asking every few minutes, a client can keep a WebSocket open and refetch when a source's issues change. This
is what the VS Code extension does.

1. `GET /api/v1/realtime` (`issues:read`) says where to connect: `{"data": {"enabled": true, "key": "…", "host":
"ws.tailcove.dev", "port": 443, "scheme": "https"}}`. When `enabled` is `false`, keep polling.
2. Connect with the Pusher protocol, version 7: `wss://{host}:{port}/app/{key}?protocol=7`. The first message,
   `pusher:connection_established`, carries your `socket_id`.
3. `GET /api/v1/realtime/auth?socket_id={socket_id}&channel_name=private-source.{source_id}.issues` answers
   `{"auth": "…"}`. Send it with `pusher:subscribe` for that channel.
4. The channel sends `issues.changed` with `{"source_id": "src_…", "at": "…"}` when an issue of the source is opened,
   happens again (at most once every 10 seconds), or is resolved, reopened or ignored. It carries nothing else: fetch
   what you need with your token.
