# Detailed health check

`GET /api/health/detailed`

Detailed diagnostics with database, cache, memory, and disk checks. In production, send X-Health-Diagnostics-Token matching HEALTH_DIAGNOSTICS_TOKEN; omitted or invalid tokens intentionally receive 404. Authorization is not required outside production.

Authorization: send the `X-Health-Diagnostics-Token` header. Production detailed-health token. Configure the server with HEALTH_DIAGNOSTICS_TOKEN.

**Returns**

- `status` (enum) One of: `healthy`, `unhealthy`.
- `timestamp` (timestamp)
- `checks` (object)
  - `database` (object)
    - `status` (string): "healthy" when the check passes
    - `message` (string)
  - `cache` (object)
    - `status` (string): "healthy" when the check passes
    - `message` (string)
  - `memory` (object)
    - `status` (string): "healthy" when the check passes
    - `message` (string)
  - `disk` (object)
    - `status` (string): "healthy" when the check passes
    - `message` (string)
  - `uptime` (number): Seconds the process has been running

**Errors**

- `404`: Not found when NODE_ENV is production and X-Health-Diagnostics-Token is missing or invalid
- `500`: The health check itself failed
- `503`: One or more checks unhealthy

**Example request**

```bash
curl "https://tm-api.devinpearson.me/api/health/detailed"
```

**Example response**

```json
{
  "status": "healthy",
  "timestamp": "2026-11-19T04:30:00.000Z",
  "checks": {
    "database": {
      "status": "string",
      "message": "string"
    },
    "cache": {
      "status": "string",
      "message": "string"
    },
    "memory": {
      "status": "string",
      "message": "string"
    },
    "disk": {
      "status": "string",
      "message": "string"
    },
    "uptime": 0
  }
}
```
