<!-- source: https://secondlayer.tools/docs/api-reference#list-insights -->

## List insights

`GET /api/insights` (self-hosted instances only)

Ranked findings about this instance's webhooks and subgraphs: losing events first, then about to fail, then costing money, then recently recovered. Dismissed and expected insights are left out.

### Query parameters

| Name | Type | Description |
| --- | --- | --- |
| `resource` | string | Only one resource, as `<kind>:<id>`, such as `webhook:<id>` or `subgraph:<name>`. |

### Responses

- `200` Insights in rank order
- `400` `resource` is not `<kind>:<id>` (`VALIDATION_ERROR`)
- `401` This bind requires the instance token, and it was missing or wrong

### Example

```bash
curl http://127.0.0.1:3800/api/insights \
  -H "Authorization: Bearer $INSTANCE_TOKEN"
```

```json
{
  "data": [
    {
      "id": "9b0f6f1e-3c1a-4f55-8d64-0c2f7a5e1b30",
      "rule": "receiver_down",
      "severity": "losing",
      "impact": 214,
      "resource": {
        "kind": "webhook",
        "id": "3f1c2a9e-8b7d-4c21-9a55-6e0d4b2f7c18",
        "name": "sbtc-moves"
      },
      "line": "sbtc-moves has failed 12 deliveries in a row",
      "meta": "since 16:06 UTC",
      "lead": "Your receiver is down, not us.",
      "body": "hooks.example.dev returns HTTP 502 on every delivery since 16:06 UTC. 214 deliveries queued to retry.",
      "evidence": [
        {
          "kind": "shapes",
          "title": "What the receiver sent back",
          "shapes": [
            {
              "code": "502",
              "body": "Bad Gateway",
              "count": 12,
              "isNew": true
            }
          ]
        }
      ],
      "handoff": {
        "prompt": "My Secondlayer webhook \"sbtc-moves\" has been failing since 16:06 UTC. The receiver hooks.example.dev returns HTTP 502 on every delivery. Check the service behind hooks.example.dev. Then run sl webhooks doctor sbtc-moves.",
        "commands": [
          "sl webhooks doctor sbtc-moves"
        ]
      },
      "how": {
        "detector": "the newest 5 or more delivery attempts are 5xx or got no response",
        "facts": [
          [
            "consecutive failures",
            "12"
          ]
        ]
      },
      "createdAt": "2026-10-15T16:07:00.000Z",
      "resolvedAt": null
    }
  ]
}
```
