Skip to main content
POST
/
filesystem.Filesystem
/
WatchDir
WatchDir
curl --request POST \
  --url https://sandbox.{domain}/filesystem.Filesystem/WatchDir \
  --header 'Authorization: Basic <encoded-value>' \
  --header 'Connect-Protocol-Version: <connect-protocol-version>' \
  --header 'Content-Type: application/connect+json' \
  --header 'E2b-Sandbox-Id: <e2b-sandbox-id>' \
  --header 'E2b-Sandbox-Port: <e2b-sandbox-port>' \
  --header 'X-Access-Token: <api-key>' \
  --data '
{
  "path": "<string>",
  "recursive": true,
  "includeEntry": true,
  "allowNetworkMounts": true
}
'
{
  "filesystem": {
    "name": "<string>",
    "entry": {
      "name": "<string>",
      "path": "<string>",
      "size": 123,
      "mode": 123,
      "permissions": "<string>",
      "owner": "<string>",
      "group": "<string>",
      "modifiedTime": "2023-11-07T05:31:56Z",
      "symlinkTarget": "<string>",
      "metadata": {}
    }
  }
}

Authorizations

X-Access-Token
string
header
required

Sandbox access token (envdAccessToken) for authenticating requests to a running sandbox. Returned by: POST /sandboxes (on create), POST /sandboxes/{sandboxID}/connect (on connect), POST /sandboxes/{sandboxID}/resume (on resume), and GET /sandboxes/{sandboxID} (for running or paused sandboxes).

Authorization
string
header
required

Optional system user for the operation. Sets file ownership and resolves relative paths. Pass the desired username with no password. Defaults to the sandbox's default user when omitted.

Headers

Connect-Protocol-Version
number
required

Define the version of the Connect protocol

Connect-Timeout-Ms
number

Define the timeout, in ms

E2b-Sandbox-Id
string
required

Identifier of the target sandbox. Routes the request to that sandbox's envd over the shared sandbox host.

E2b-Sandbox-Port
integer
default:49983
required

Port envd listens on inside the sandbox (default 49983).

Body

application/connect+json
path
string
recursive
boolean
includeEntry
boolean

If true, each FilesystemEvent includes the EntryInfo of the affected entry, when available.

allowNetworkMounts
boolean

If true, allows watching paths on network filesystem mounts (NFS, CIFS, SMB, FUSE). Events on network mounts may be unreliable or not delivered at all.

Response

Stream of WatchDirResponse events

filesystem
filesystem · object
required