http://n8n-state-machine:8080 (default)
Health
GET /health
Check if the service is running.Subscriptions
POST /api/subscriptions/
Register or update a webhook subscription.GET /api/subscriptions
List all active subscriptions.GET /api/subscriptions/
Get a specific subscription.DELETE /api/subscriptions/
Remove a subscription. The state machine stops delivering signals for this subscription.Subscriptions are managed automatically by the trigger nodes. You typically don’t need to call these endpoints directly.
Events (Event Orchestrator)
POST /api/events/
Check or create event state for a scope. Used by the Event Orchestrator node.PATCH /api/events/
Update event state (e.g., store the global event ID after creation).Track State
GET /api/tracks/
Query the current state of a track.GET /api/tracks/closest-frame
Find the detection frame closest to a given timestamp.POST /api/tracks/snapshot
Compute position, velocity, and zone membership for one or more tracks at specific historical timestamps. The endpoint analyzes raw detections within a configurable time window around each requested timestamp.| Field | Type | Required | Description |
|---|---|---|---|
tracks | Array | Yes | One or more track queries |
tracks[].track_id | String | Yes | Track UUID to query |
tracks[].timestamp | String | Yes | ISO 8601 timestamp to compute the snapshot at |
window_seconds | Number | No | Seconds before and after the timestamp to include (default: 10) |
x-token-id, x-token-value, and x-graphql-url are required when the track’s detections are not already cached in Redis (DB 3). The endpoint will fall back to the Worlds GraphQL API to fetch detections.
Response body:
| Field | Type | Description |
|---|---|---|
snapshots | Object | Map of track ID to snapshot (null if the track could not be resolved) |
snapshots[].track_id | String | Track UUID |
snapshots[].tag | String | Object type tag (e.g., Person, Vehicle) |
snapshots[].timestamp | String | The requested timestamp |
snapshots[].window_seconds | Number | The window used for computation |
snapshots[].detections_in_window | Number | Number of raw detections found in the window |
snapshots[].position | Object | Interpolated position at the timestamp |
snapshots[].position.method | String | real, linear, forward_extrapolation, or backward_extrapolation |
snapshots[].position.offset_ms | Number | Milliseconds between the requested timestamp and the nearest real detection |
snapshots[].position.pix | Object | Pixel coordinates (x, y) |
snapshots[].position.geo | Object | Geographic coordinates (lon, lat), if available |
snapshots[].position.polygon | Array | Interpolated bounding box as a 4-point polygon |
snapshots[].motion | Object | Velocity and direction computed from detections in the window |
snapshots[].motion.pix | Object | Pixel-space motion (avg_velocity, max_velocity, direction, sample_count) |
snapshots[].motion.geo | Object | Geographic motion (same fields), if available |
snapshots[].zones | Object | Zone membership at the timestamp |
snapshots[].zones.active_at_timestamp | Object | Map of zone ID to zone data for zones the track intersected at the timestamp |
Zone State
GET /api/zones/
Query the current state of a zone (active tracks, occupancy count).Replay
POST /api/replay/
Start a replay session for testing.GET /api/replay/
Get replay session status.DELETE /api/replay/
Stop and clean up a replay session.Replay sessions are managed automatically by the Replay Trigger node. These endpoints are documented for debugging purposes.

