Skip to content

API Reference

All endpoints are under /api/v1/ and require authentication unless otherwise noted. Authentication is resolved from X-API-Key header, ?api_key query parameter, or device_key in the JSON body.

Rooms

MethodPathDescription
GET/roomsList all rooms
POST/roomsCreate a room
PUT/rooms/{id}Update a room
DELETE/rooms/{id}Delete a room

Rooms represent physical spaces in the household (kitchen, bedroom, hallway). Each sensor and rule context filter references a room.

Sensors

MethodPathDescription
GET/sensorsList sensors (filter by room_id, sensor_type, source)
POST/sensorsRegister a sensor
PUT/sensors/{id}Update a sensor
DELETE/sensors/{id}Delete a sensor

Sensor Types

TypeDescription
cameraVideo camera (reCamera or IP camera)
presencePIR/mmWave occupancy sensor (via Home Assistant)
buttonPhysical button (reTerminal)
lightIlluminance sensor (via Home Assistant)
einkE-ink display device

Rules

MethodPathDescription
GET/rulesList all rules
POST/rulesCreate a rule
GET/rules/{id}Get a rule with pipeline steps, contexts, and dependencies
PUT/rules/{id}Update a rule
DELETE/rules/{id}Delete a rule and its pipeline steps
POST/rules/{id}/executeManually trigger a rule's pipeline (returns execution ID)

Rule Fields

FieldTypeDescription
namestringRule name
descriptionstringHuman-readable description
enabledbooleanWhether the rule is active
trigger_typestringsensor_event, cron, manual, webhook, or occupancy_duration
primary_sensor_idstringSensor that triggers this rule (required for cron and occupancy_duration)
schedule_cronstringCron expression (for cron trigger type)
cool_off_minutesintegerMinimum minutes between triggers
max_daily_triggersintegerMaximum triggers per day
webhook_configobjectWebhook settings: {secret, created_at} (for webhook trigger type)
occupancy_configobjectOccupancy threshold: {min_minutes: int} (for occupancy_duration trigger type)

Pipeline Steps

MethodPathDescription
GET/rules/{id}/stepsList pipeline steps for a rule (ordered)
POST/rules/{id}/stepsAdd a step (auto-assigned to end of sequence)
PUT/rules/{id}/steps/{step_id}Update a step's type, config, label, or enabled flag
DELETE/rules/{id}/steps/{step_id}Remove a step (remaining steps re-ordered)
PUT/rules/{id}/steps/reorderBulk reorder steps: [{id, order}, ...]

Pipeline Step Fields

FieldTypeDescription
step_typestringOne of the 14 step types
labelstringDisplay label
config_jsonobjectStep-type-specific configuration
enabledbooleanWhether the step is active
orderintegerExecution order within the pipeline
next_step_on_trueintegerStep ID to jump to when condition is true
next_step_on_falseintegerStep ID to jump to when condition is false

Contexts and Dependencies

MethodPathDescription
GET/rules/{id}/contextsList context filters
POST/rules/{id}/contextsAdd a context filter
DELETE/rules/{id}/contexts/{ctx_id}Remove a context filter
GET/rules/{id}/dependenciesList rule dependencies
POST/rules/{id}/dependenciesAdd a dependency on another rule
DELETE/rules/{id}/dependencies/{dep_id}Remove a dependency

Context Filter Types

TypeDescription
roomRule only fires for events from specified rooms
time_rangeRule only fires within a time window (e.g., 08:00-22:00)
day_of_weekRule only fires on specified days
person_presenceRule requires specified persons to be present (or absent)
person_activityRule requires a recent activity (or absence thereof) for a person
room_transitionRule fires only on specific room transitions (entering/exiting) for a person
scene_trendRule fires based on object trend anomaly severity in specified rooms

Workflows

MethodPathDescription
GET/workflowsList workflow executions (filter by rule_id, status, limit)
GET/workflows/{id}Get execution detail with full pipeline data
POST/workflows/{id}/cancelCancel a running or waiting execution

Workflow Statuses

StatusDescription
runningPipeline is actively executing
waitingPaused at a wait step, will resume at resume_at
completedAll steps finished successfully
failedA step failed and pipeline halted
cancelledManually cancelled

Pipeline Metadata

MethodPathDescription
GET/pipeline/step-typesList all registered step types with metadata and config schemas
GET/pipeline/channel-typesList all registered notification channel types
GET/pipeline/filter-typesList all registered context filter types

These endpoints return metadata from the plugin registries (StepRegistry, ChannelRegistry, FilterRegistry). The frontend uses /pipeline/step-types to dynamically populate the step palette and config editor.

Webhooks

MethodPathDescription
POST/webhooks/{rule_id}Trigger a rule's pipeline via webhook
POST/webhooks/{rule_id}/generate-secretGenerate or regenerate a webhook secret for a rule

Webhook requests require an X-Webhook-Secret header matching the rule's configured secret (validated via HMAC constant-time comparison). The JSON request body becomes pipeline_data["trigger_input"] in the triggered pipeline.

Activities

MethodPathDescription
GET/activitiesList detected person activities (filter by person_id, activity_type, room_name)

Alerts

MethodPathDescription
GET/alertsList alerts (filter by resolved, room_name, alert_type)
GET/alerts/{id}Get a single alert
POST/alerts/{id}/actionDismiss or request assistance for an alert

Alert Actions

ActionDescription
dismissMark the alert as resolved
assistRequest assistance (escalates the alert)

Events

MethodPathDescription
GET/eventsList event logs (filter by rule_name, status, limit)

Event logs contain the full pipeline_data_json from each rule execution, providing a complete audit trail.

Persons

Member Management

MethodPathDescription
GET/personsList all household members (includes enrollment status)
POST/personsRegister a new member
GET/persons/{id}Get member details
PATCH/persons/{id}Update a member
DELETE/persons/{id}Remove a member and their data

Face Enrollment

MethodPathDescription
GET/persons/enrolledList face enrollment status from person-ID service
POST/persons/{id}/enrollUpload reference photos to enroll a face (multipart)
GET/persons/{id}/enrollmentGet enrollment details (embedding count, created date)
DELETE/persons/{id}/enrollmentRemove face enrollment data

The enrollment endpoints proxy requests to the person-identification-service. Upload 5-10 reference photos per person through the admin UI (Members & Enrollment page) or via the API.

Location Tracking

MethodPathDescription
GET/persons/locationsCurrent location of all tracked members
GET/persons/{id}/locationCurrent location of a specific member
GET/persons/{id}/historyLocation timeline (?hours=24)
GET/persons/{id}/sightingsRecent camera sightings (?limit=20)

Device Endpoints

MethodPathDescription
POST/device/recameraUpload image from reCamera (device key auth)
POST/device/reterminalreTerminal button/command endpoint

Device endpoints accept authentication via device_key in the JSON body.

Image (E-Ink Display)

Active Image

MethodPathDescription
GET/image/activeActive image for the authenticated device
GET/image/active/{sensor_id}Active image for a specific sensor (admin)

Templates

MethodPathDescription
GET/image/templatesList all templates
POST/image/templatesCreate a template (multipart upload)
PUT/image/templates/{id}Update regions or metadata
DELETE/image/templates/{id}Remove a template

Rendering

MethodPathDescription
POST/image/renderRender text onto a template for target devices
POST/image/previewPreview a render without saving (returns PNG)
POST/image/resetReset a device's display to default template

Occupancy

MethodPathDescription
GET/occupancyRoom occupancy from presence sensors

MCP Tools

MethodPathDescription
GET/mcp/toolsList available MCP tools with schemas
POST/mcp/tools/{name}Execute an MCP tool

See MCP Integration for the full tool reference.

Interactive Responses

MethodPathDescription
POST/interactive-responsesRecord user response to an interactive prompt step

Used by the frontend to record responses from interactive prompt steps. The request body includes:

json
{
  "execution_id": 123,
  "step_id": 456,
  "channel": "pwa_popup_text",
  "action": "dismiss",
  "raw_response": {}
}

Valid channels: pwa_popup_text, pwa_realtime_ai, timeout
Valid actions: escalate, dismiss

The service records the response, updates pipeline_data, cancels any pending timeout task, and triggers immediate pipeline resumption.

Home Assistant Sync

MethodPathDescription
POST/ha/sync/roomsImport rooms (areas) from Home Assistant
POST/ha/sync/sensorsImport sensors from Home Assistant areas

Other Endpoints

MethodPathDescription
GET/healthHealth check (no auth required)
WS/wsWebSocket for audio streaming and notifications
GET/admin/configInspect active configuration

Authentication

Request Authentication

Keys are resolved in priority order:

  1. X-API-Key HTTP header
  2. ?api_key query parameter
  3. device_key field in JSON request body

Roles

RoleAccess Level
adminFull access to all endpoints
caregiverRead access + alert actions
mcp_readonlyRead access + MCP tools + rule triggering

Permission Patterns

Permissions use fnmatch syntax matching against METHOD /path:

yaml
caregiver:
  - "GET /api/v1/*"
  - "POST /api/v1/alerts/*/action"

Error Responses

All errors follow a consistent format:

json
{
  "detail": "Error message describing what went wrong"
}
Status CodeMeaning
401Authentication required or invalid API key
403Permission denied for this endpoint
404Resource not found
409Conflict (e.g., duplicate resource)
422Validation error (invalid request body)
500Internal server error

Released under the AGPL-3.0 License.