/diff endpoint returns a field-level comparison between two consecutive state snapshots for a tracked process. Rather than fetching the entire objects map and diffing it yourself, you provide a capture_id from a previous snapshot and the daemon returns only the keys that changed. This is the most efficient way to understand what an action did, why a /watch event fired, or how a process’s state evolved over a time interval.
Endpoint
Parameters
The OS process ID of the target application. Obtain this from
GET /apps.A
capture_id (UUIDv7) from a previous GET /state response or a StateChangeNotification message from WS /watch. The diff is computed between this capture and the most recent successful capture.Response Fields
The OS process ID that was queried.
Stable semantic identifier for the application.
UUIDv7 of the most recent (current) state snapshot — the “after” side of the diff.
UUIDv7 of the earlier snapshot — the “before” side of the diff. This matches the
since query parameter you passed.Array of fields that existed in both snapshots but whose values differ. Each entry is a
{ path, before, after } object.Array of
{ path, value } objects for keys that are present in the current snapshot but were absent in the earlier one. This happens when a new application view loads and exposes state that wasn’t visible before.Array of
{ path, value } objects for keys that existed in the earlier snapshot but are absent in the current one. This happens when the user navigates away from a view or the application unloads a data structure.Examples
Example Response
Common Patterns
Verifying an action had the expected effect — CallGET /state before dispatching an action to save capture_id, run the action, then call /diff?since=<capture_id> to confirm exactly which fields changed.
Processing /watch events efficiently — When a StateChangeNotification arrives, the prev_capture_id field is already included. Pass it to /diff to get the full before/after values without re-reading the whole state.
Auditing state over time — Chain consecutive capture_id values to reconstruct a complete audit trail of field-level changes across multiple probe cycles.
Notes
- Returns
{ "changed": [], "added": [], "removed": [] }if state has not changed between the two captures. - Returns
404if thesincecapture ID is no longer in the daemon’s capture history window. The daemon retains a fixed number of recent captures per PID; if the requested capture has been evicted, re-capture a fresh baseline viaGET /state. - The
sinceparameter must correspond to a capture of the same PID. Cross-PID diff lookups return400 Bad Request.
