Skip to content

The Watch API provides programmatic access to file system watchers with real-time event delivery via Server-Sent Events (SSE) and WebSocket streams. Use these endpoints to create watchers that monitor files and directories, retrieve historical events, subscribe to live event streams, and manage watcher lifecycle.

Returns service health information including process ID, uptime, IP, file descriptor count, and memory usage.

This endpoint takes no parameters.

Terminal window
curl https://api.example.com/api/v1/watch/health

Creates a new file system watcher with the specified paths and configuration.

NameTypeRequiredDescription
pathsarrayYesAbsolute or relative filesystem paths to watch.
coalesce_msinteger | nullNoCoalescing window in milliseconds.
excludearray | nullNoOptional exclude glob patterns. Excludes take precedence over includes.
history_sizeinteger | nullNoReplay history capacity for this watcher.
ignore_dirsarray | nullNoDirectory names or subdirectory paths to skip entirely. Pass empty array to disable the default ignore list.
includearray | nullNoOptional include glob patterns. If present, path must match one include.
kindsarray | nullNoOptional event kind filter. Allowed values: created, modified, removed, renamed, metadata, overflow, other.
recursiveboolean | nullNoRecursive mode. Defaults to server config value.
skip_hiddenboolean | nullNoWhen true, hidden directories are never watched or scanned into. Defaults to the server’s --default-skip-hidden.
Terminal window
curl -X POST https://api.example.com/watchers \
-H "Content-Type: application/json" \
-d '{
"paths": ["/srv/data/uploads", "/srv/data/exports"],
"recursive": true,
"kinds": ["created", "modified", "removed", "renamed"],
"coalesce_ms": 100,
"history_size": 5000,
"ignore_dirs": ["node_modules", ".git", "target"],
"include": ["**/*.csv", "**/*.json"],
"exclude": ["**/tmp/**"],
"skip_hidden": true
}'

Lists all file system watchers with pagination.

NameInTypeRequiredDescription
pagequeryintegerNoPage number (1-based).
limitqueryintegerNoItems per page (1-200).
Terminal window
curl "https://api.example.com/watchers?page=1&limit=50"

Retrieves details for a specific watcher.

NameInTypeRequiredDescription
idpathstringYesWatcher id
Terminal window
curl https://api.example.com/watchers/9b2e7a10-1f4d-4b8a-9c1e-2a0f8c3b4d5e

Deletes a watcher and releases its resources.

NameInTypeRequiredDescription
idpathstringYesWatcher id
Terminal window
curl -X DELETE https://api.example.com/watchers/9b2e7a10-1f4d-4b8a-9c1e-2a0f8c3b4d5e

Retrieves paginated historical events for a watcher. Supports replay semantics via since_id or since_timestamp cursors.

NameInTypeRequiredDescription
idpathstringYesWatcher id
since_idqueryintegerNoReplay events strictly after this event id.
since_timestampquerystringNoReplay events strictly after this timestamp. Accepted formats: RFC3339 (e.g. 2026-02-11T15:30:00Z), Unix seconds (e.g. 1739287800), Unix milliseconds (e.g. 1739287800123).
pagequeryintegerNoPage number (1-based).
limitqueryintegerNoItems per page (1-200).
Terminal window
curl "https://api.example.com/watchers/9b2e7a10-1f4d-4b8a-9c1e-2a0f8c3b4d5e/events?since_id=1000&limit=100"

Establishes a Server-Sent Events stream that delivers watcher events in real time. Supports replay from a cursor to recover missed events.

NameInTypeRequiredDescription
idpathstringYesWatcher id
since_idqueryintegerNoReplay events strictly after this event id.
since_timestampquerystringNoReplay events strictly after this timestamp. Accepted formats: RFC3339 (e.g. 2026-02-11T15:30:00Z), Unix seconds (e.g. 1739287800), Unix milliseconds (e.g. 1739287800123).
Terminal window
curl -N "https://api.example.com/watchers/9b2e7a10-1f4d-4b8a-9c1e-2a0f8c3b4d5e/events/sse?since_id=1000"

Upgrades the connection to a WebSocket and streams file events as text frames. Supports replay from a cursor.

NameInTypeRequiredDescription
idpathstringYesWatcher id
since_idqueryintegerNoReplay events strictly after this event id.
since_timestampquerystringNoReplay events strictly after this timestamp. Accepted formats: RFC3339 (e.g. 2026-02-11T15:30:00Z), Unix seconds (e.g. 1739287800), Unix milliseconds (e.g. 1739287800123).
Terminal window
curl -i -N -H "Connection: Upgrade" -H "Upgrade: websocket" \
"https://api.example.com/watchers/9b2e7a10-1f4d-4b8a-9c1e-2a0f8c3b4d5e/events/ws?since_id=1000"