Skip to main content
Watch a directory and receive create, write, remove, rename, and chmod events as they happen.

Parameters

Events

Each SSE frame carries one JSON object. The first event is always start. It confirms the watch is armed; only changes that occur after start are guaranteed to be observed. Arm the watch before triggering the work you want to observe.

What you receive

  • Writes are coalesced. A burst of writes to the same file within a short window is reported as a single write, so a large file copy does not produce thousands of events.
  • Renames are paired. A move within the watched tree is reported once as rename with both path and new_path, not as a separate remove and create.
  • The stream stays open. Iterate for as long as you want notifications. Stopping the iteration releases the watch.
  • Recursive watches cover new subdirectories. Directories created after the watch starts are included.

Endpoint

POST /v1/agents/runtime/{runtime_id}/files/watch