<!-- source: https://secondlayer.tools/docs/api-reference#get-deployment-health -->

## Get a subgraph's hourly health

`GET /api/subgraphs/{name}/health` (self-hosted instances only)

Hourly buckets from the snapshot the subgraph records every minute: blocks behind the chain tip, rows written, handler errors and events handled. Snapshots are kept 7 days. Oldest hour first; an hour with no snapshots has `lagBlocks: null` and zero counts.

### Path parameters

| Name | Type | Description |
| --- | --- | --- |
| `name` | string, required | Subgraph name, as deployed. Lowercase letters, digits and hyphens. |

### Query parameters

| Name | Type | Description |
| --- | --- | --- |
| `hours` | integer | Hours to return, 1 to 168. Default 24. |

### Returns

One `SubgraphHealth` object.

### Responses

- `200` Hourly health
- `400` `hours` is not an integer from 1 to 168 (`VALIDATION_ERROR`)
- `401` This bind requires the instance token, and it was missing or wrong
- `404` No subgraph by this name on this instance (`SUBGRAPH_NOT_FOUND`)

### Example

```bash
curl http://127.0.0.1:3800/api/subgraphs/{name}/health \
  -H "Authorization: Bearer $INSTANCE_TOKEN"
```

```json
{
  "hours": [
    {
      "hour": "2026-10-16T13:00:00.000Z",
      "lagBlocks": 0,
      "rowsWritten": 1840,
      "errors": 0,
      "eventsHandled": 2213
    }
  ],
  "errors24h": 0
}
```
