Skip to main content
The state machine exposes a REST API for subscription management, event state, track/zone queries, and replay sessions. Base URL: 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.
Returns the full track state object (position, velocity, zones, etc.).

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.
Request body: Headers: 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:

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.