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

# Health

> Check server and database availability

**Self-hosted only.** Not available on Cloud.

Two probes. `GET /health` is a public liveness check, `GET /health/database` needs an API key and reports on the SQLite file.

```bash theme={null}
curl https://media.example.com/health
```

## Server health

```
GET /health
```

**Auth:** Public (rate limited)

Quick liveness check, use this for load balancer health probes or uptime monitoring.

```json theme={null}
{
  "status": "ok",
  "timestamp": "2024-03-15T10:30:00.000Z",
  "service": "openinary-api"
}
```

**Status codes:** `200` healthy

## Database health

```
GET /health/database
```

```bash theme={null}
curl https://media.example.com/health/database \
  -H "Authorization: Bearer <api_key>"
```

**Auth:** API Key required

Detailed diagnostic, checks the SQLite database connection, file permissions, and table record counts.

```json theme={null}
{
  "status": "ok",
  "timestamp": "2024-03-15T10:30:00.000Z",
  "database": {
    "connected": true,
    "path": "/app/data/openinary.db",
    "size": "2.4 MB",
    "permissions": "644",
    "tables": {
      "user": 1,
      "session": 3,
      "account": 1,
      "verification": 0,
      "apiKey": 2
    }
  }
}
```

| Field | Type | Description |
| - | - | - |
| `database.connected` | `boolean` | Whether the database connection is active |
| `database.path` | `string` | Absolute path to the database file |
| `database.size` | `string` | Database file size |
| `database.permissions` | `string` | Octal file permissions, three digits with no leading zero (for example `600` or `644`) |
| `database.tables` | `object` | Record counts per table. Useful for verifying migrations applied correctly |
| `database.warning` | `string` | Present only when the database file is larger than 1 GB. Permission problems are reported in `security_warning` instead |
| `database.security_warning` | `string` | Present when the database file's permissions are less restrictive than `600` |
| `database.file_error` | `string` | Present if the database file's permissions or size couldn't be read |
| `database.table_error` | `string` | Present if table record counts couldn't be retrieved |

**Status codes:** `200` healthy · `503` database connection failed


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