REST API
Query sessions, events, and captures over HTTP.
REST API
The Dashcam daemon exposes a REST API on the same port as the dashboard (default: 57580). Use it to query sessions, events, captures, and system status programmatically. All responses are JSON.
Base URL:
http://localhost:57580Query Endpoints
These endpoints return data from the SQLite database. All responses use 200 OK with a JSON body.
GET /api/status
Returns the current daemon status: uptime, connection count, active sessions, and window state.
curl http://localhost:57580/api/status{
"status": "running",
"uptime_seconds": 3600,
"websocket_connections": 2,
"active_sessions": 1,
"active_agents": 3,
"window": {
"state": "ACTIVE",
"remaining_seconds": 11520,
"started_at": "2026-03-20T09:00:00Z"
},
"database_size_bytes": 13002752,
"captures_size_bytes": 245366784
}GET /api/sessions
List sessions, optionally filtered by date, status, or project.
curl "http://localhost:57580/api/sessions?date=2026-03-20&status=completed"| Parameter | Type | Description |
|---|---|---|
date | string | Filter by date (ISO 8601 date: YYYY-MM-DD) |
status | string | Filter by status: active, completed, error, abandoned |
project | string | Filter by project path (partial match) |
limit | number | Maximum results (default: 50) |
offset | number | Pagination offset (default: 0) |
{
"sessions": [
{
"id": "sess_01JQXYZ",
"window_id": "win_01JQABC",
"project_path": "/home/user/my-app",
"started_at": "2026-03-20T09:00:00Z",
"ended_at": "2026-03-20T13:23:00Z",
"duration_seconds": 15780,
"agent_type": "claude-code",
"model": "claude-sonnet-4-6",
"summary": "Built auth system with JWT tokens and user dashboard",
"thumbnail_path": "/captures/sess_01JQXYZ/1711234567890-thumb.png",
"status": "completed",
"total_events": 142,
"estimated_cost_usd": 0.47
}
],
"total": 47,
"limit": 50,
"offset": 0
}GET /api/sessions/:id
Get detailed information about a single session.
curl http://localhost:57580/api/sessions/sess_01JQXYZ{
"id": "sess_01JQXYZ",
"window_id": "win_01JQABC",
"project_path": "/home/user/my-app",
"started_at": "2026-03-20T09:00:00Z",
"ended_at": "2026-03-20T13:23:00Z",
"duration_seconds": 15780,
"agent_id": null,
"agent_type": "claude-code",
"agent_source": "claude-code",
"model": "claude-sonnet-4-6",
"summary": "Built auth system with JWT tokens and user dashboard",
"thumbnail_path": "/captures/sess_01JQXYZ/1711234567890-thumb.png",
"status": "completed",
"total_events": 142,
"total_tokens_in": 245000,
"total_tokens_out": 89000,
"estimated_cost_usd": 0.47
}GET /api/sessions/:id/events
Get events for a session, optionally filtered by time range. Events are returned in chronological order.
curl "http://localhost:57580/api/sessions/sess_01JQXYZ/events?from=2026-03-20T10:00:00Z&to=2026-03-20T11:00:00Z"| Parameter | Type | Description |
|---|---|---|
from | string | Start of time range (ISO 8601) |
to | string | End of time range (ISO 8601) |
type | string | Filter by event type (e.g., tool_use, decision) |
limit | number | Maximum results (default: 1000) |
{
"events": [
{
"id": "evt_01JQDEF",
"session_id": "sess_01JQXYZ",
"timestamp": "2026-03-20T10:15:23.456Z",
"event_type": "tool_use",
"agent_id": null,
"summary": "Write src/auth/jwt.ts",
"tool_name": "Write",
"file_path": "src/auth/jwt.ts",
"tokens_in": 1200,
"tokens_out": 450,
"duration_ms": 234
}
],
"total": 42
}GET /api/sessions/:id/captures
Get screenshots and videos for a session.
curl http://localhost:57580/api/sessions/sess_01JQXYZ/captures{
"captures": [
{
"id": "cap_01JQGHI",
"event_id": "evt_01JQDEF",
"session_id": "sess_01JQXYZ",
"timestamp": "2026-03-20T10:15:24.000Z",
"capture_type": "screenshot",
"file_path": "/captures/sess_01JQXYZ/1711234567890-full.png",
"thumbnail_path": "/captures/sess_01JQXYZ/1711234567890-thumb.png",
"file_size_bytes": 245760,
"width": 1920,
"height": 1080,
"perceptual_hash": "a4c3b2e1f0d9c8b7",
"capture_url": "http://localhost:3000"
}
]
}Screenshot and video files are served as static files at /captures/*. The file_path in the response is relative to the base URL.
GET /api/sessions/:id/decisions
Get architectural decisions extracted from a session.
curl http://localhost:57580/api/sessions/sess_01JQXYZ/decisions{
"decisions": [
{
"id": "dec_01JQJKL",
"event_id": "evt_01JQDEF",
"session_id": "sess_01JQXYZ",
"timestamp": "2026-03-20T10:30:00Z",
"category": "architecture",
"title": "Use JWT with refresh tokens instead of session cookies",
"reasoning": "The app needs to support mobile clients and a REST API. JWT tokens are stateless and work across origins without CORS cookie issues.",
"alternatives": ["session cookies", "OAuth2 with opaque tokens"],
"outcome": "Implemented JWT with 15-minute access tokens and 7-day refresh tokens",
"confidence": "high"
}
]
}GET /api/sessions/:id/git
Get git snapshots for a session, showing repository state at each captured moment.
curl http://localhost:57580/api/sessions/sess_01JQXYZ/git{
"snapshots": [
{
"id": "git_01JQMNO",
"event_id": "evt_01JQDEF",
"session_id": "sess_01JQXYZ",
"timestamp": "2026-03-20T10:45:00Z",
"commit_hash": "a1b2c3d",
"branch": "feat/auth",
"diff_summary": "+142 -17 across 5 files",
"changed_files": ["src/auth/jwt.ts", "src/auth/middleware.ts", "src/routes/login.ts", "tests/auth.test.ts", "package.json"]
}
]
}GET /api/windows
List subscription windows, optionally filtered by date range.
curl "http://localhost:57580/api/windows?from=2026-03-19&to=2026-03-20"| Parameter | Type | Description |
|---|---|---|
from | string | Start date (ISO 8601) |
to | string | End date (ISO 8601) |
{
"windows": [
{
"id": "win_01JQABC",
"started_at": "2026-03-20T09:00:00Z",
"ended_at": "2026-03-20T14:00:00Z",
"duration_seconds": 18000,
"session_count": 3,
"event_count": 347,
"total_cost_usd": 1.23,
"is_active": false
}
]
}GET /api/search
Full-text search across all sessions, events, and decisions.
curl "http://localhost:57580/api/search?q=jwt+authentication"| Parameter | Type | Description |
|---|---|---|
q | string | Search query (uses SQLite FTS5) |
limit | number | Maximum results (default: 20) |
{
"results": [
{
"event_id": "evt_01JQDEF",
"session_id": "sess_01JQXYZ",
"timestamp": "2026-03-20T10:15:23.456Z",
"event_type": "tool_use",
"summary": "Write src/auth/jwt.ts",
"snippet": "...implementing JWT authentication with refresh token rotation...",
"session_summary": "Built auth system with JWT tokens and user dashboard"
}
],
"total": 5
}GET /api/stats
Get aggregate statistics across all sessions.
curl http://localhost:57580/api/stats{
"total_sessions": 47,
"total_events": 3241,
"total_captures": 142,
"total_videos": 8,
"total_decisions": 23,
"total_cost_usd": 12.47,
"total_tokens_in": 4500000,
"total_tokens_out": 1200000,
"avg_session_duration_seconds": 8400,
"avg_events_per_session": 69
}Hook Endpoints
These endpoints receive events from Claude Code hooks. All respond with 202 Accepted immediately and process the payload asynchronously.
POST /hook/session-start
Called by the SessionStart hook when a Claude Code session begins.
curl -X POST http://localhost:57580/hook/session-start \
-H 'Content-Type: application/json' \
-d '{"session_id": "sess_01JQXYZ", "project_path": "/home/user/my-app", "model": "claude-sonnet-4-6", "timestamp": "2026-03-20T09:00:00Z"}'POST /hook/post-tool-use
Called by the PostToolUse hook after a tool execution completes.
curl -X POST http://localhost:57580/hook/post-tool-use \
-H 'Content-Type: application/json' \
-d '{"session_id": "sess_01JQXYZ", "tool_name": "Write", "output": "File written", "duration_ms": 234, "success": true, "timestamp": "2026-03-20T10:15:23Z"}'POST /hook/stop
Called by the Stop hook when a session ends.
curl -X POST http://localhost:57580/hook/stop \
-H 'Content-Type: application/json' \
-d '{"session_id": "sess_01JQXYZ", "reason": "task_completed", "summary": "Built auth system", "timestamp": "2026-03-20T13:23:00Z"}'Hook endpoints are designed for fire-and-forget use. They always return 202 Accepted, even if the payload is malformed. This ensures hooks never block Claude Code.