Sessions API
File: app/api/analytics/sessions/route.ts
GET /api/analytics/sessions
Returns recent PostHog session recordings.
Parameters
| Parameter | Required | Description |
|---|---|---|
password | Yes | Must match ANALYTICS_PASSWORD env var |
Response
{
"sessions": [
{
"id": "session-uuid",
"startTime": "2026-02-20T10:30:00Z",
"duration": 123,
"clicks": 5,
"keypresses": 10,
"activeSeconds": 60,
"replayUrl": "https://eu.posthog.com/project/130497/replay/session-uuid"
}
]
}Returns the 20 most recent recordings, sorted by start time (newest first).
Error codes
| Status | Condition |
|---|---|
| 401 | Invalid or missing password |
| 500 | PostHog not configured |