---
search:
  tags:
    - files
    - GET
seo:
  description: >-
    Streams one FileEvent JSON object per line (NDJSON) as files and… Reference
    for the GET /v1/sandboxes/{sandbox}/files/watch endpoint in the pols.so API.
sidebar:
  label: Stream the changes to files under a path
  badge: GET
title: Stream the changes to files under a path
type: openapi-operation
---
Streams one `FileEvent` JSON object per line (NDJSON) as files and
directories under `path` (a directory, or a single file) are
created, modified or deleted, until the connection is closed.
The first event, `ready`, says the watch is in place: changes from
then on are reported. The watch uses inotify in the guest, as the
user, so directories it may not read are not watched.

Limits: at most 8,192 watched directories, and at most one
`modified` event per file and second (a later write in that second
is reported when the file is closed or the second is over). Changes
that cannot be reported are not dropped silently: an `overflow`
event says so (too many directories, the guest's inotify limit, or
changes faster than the stream is read). A renamed file is a
`deleted` and a `created` event; a moved directory is one
`deleted` event for itself, while the entries of a deleted
directory are reported deleted before the directory itself. The stream ends with an `error`
event if `path` itself is deleted or moved, or the sandbox stops.
While a watch is open the sandbox counts as in use, so it does not
go to standby. A watch lasts at most 24 hours.

`GET /v1/sandboxes/{sandbox}/files/watch`
