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

# Check the health of pgw

> Use the /healthz and /readyz endpoints on the admin listener for liveness and readiness checks.

A supervisor needs to know when to restart pgw, and a monitor needs to know when to alert. `/healthz` tells the supervisor whether the process runs, and `/readyz` tells the monitor whether pgw can take calls right now. Both answer over plain HTTP without an API key. Both endpoints are on the admin listener, `127.0.0.1:8080` by default.

| Endpoint | Use it for | Returns |
| - | - | - |
| `GET /healthz` | Liveness | `200 ok` while the process runs. |
| `GET /readyz` | Readiness | `200 ready` when pgw has started and every readiness check passes. Otherwise `503`. |

## Check pgw from its host

```bash theme={null}
curl -i http://127.0.0.1:8080/healthz
curl -i http://127.0.0.1:8080/readyz
```

A healthy gateway answers both with `200`.

```text theme={null}
HTTP/1.1 200 OK
Content-Type: text/plain; charset=utf-8
Date: Sun, 15 Nov 2026 23:52:40 GMT
Content-Length: 3

ok

HTTP/1.1 200 OK
Content-Type: text/plain; charset=utf-8
Date: Sun, 15 Nov 2026 23:52:40 GMT
Content-Length: 6

ready
```

## How /readyz decides

While pgw starts or stops, `/readyz` answers `503` with the body `not ready`. Once pgw has started, each request runs the following checks in parallel.

| Check | Passes when |
| - | - |
| `sip` | pgw can open a TCP connection to the app listener, `app_listen`. |
| `store` | The database answers. |
| `cert` | The app listener's certificate hasn't expired. |

A check that takes longer than 1 second fails with `timed out`. When a check fails, `/readyz` answers `503` with the name and error of each failed check, one per line.

```text theme={null}
HTTP/1.1 503 Service Unavailable
Content-Type: text/plain; charset=utf-8
Date: Sun, 15 Nov 2026 23:59:28 GMT
Content-Length: 50

cert: certificate expired at 2026-11-01T00:00:00Z
```

## Next steps

> [card] [Set up alerts](https://docs.pgw.sipmicro.services/alerts.md)
>
> Alert before the certificate expires. The `cert` check fails only afterward.

> [card] [Scrape the metrics](https://docs.pgw.sipmicro.services/metrics.md)
>
> Collect the counters and gauges that show why a check fails.


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