Donutwork Docs

Directory Monitor

High-performance filesystem monitoring and event synchronization for distributed projects.

Directory Monitor

The Directory Monitor API enables real-time synchronization and event orchestration for local filesystem changes. It is designed for deep integration with local agents to monitor project directories, capture file events, and trigger remote workflows.


Initialize Monitor (Startup)

Signal the start of a monitoring session for a specific project. This initialization step validates the project configuration and prepares the environment for ingress events.

POST
/2026-02-01/directory-monitor/{projectId}.json
Required permissiondirectory_monitor:writeApiAccessPermission::DIRECTORY_MONITOR_WRITE

Query Parameters

projectIdstringRequired
The unique identifier for the monitored project.

Request Body

JSON
{
  "ingressToken": "DM_SECURE_TOKEN_XYZ"
}
ingressTokenstring
Security token for ingress authentication (can also be sent via X-Directory-Monitor-Token header).

Responses

Monitor successfully initialized.

{
  "status": "success",
  "projectId": "proj_123"
}

Synchronize Event (Ingress)

Report a filesystem event (creation, modification, deletion) to the centralized monitor. This endpoint processes file metadata and executes any associated workflow triggers.

PUT
/2026-02-01/directory-monitor/{projectId}.json
Required permissiondirectory_monitor:writeApiAccessPermission::DIRECTORY_MONITOR_WRITE

Query Parameters

projectIdstringRequired
The project identifier.

Request Body

JSON
{
  "projectId": "proj_123",
  "filename": "src/controllers/UserController.php",
  "event": "modified",
  "filesize": 4096,
  "sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
  "uid": 1000,
  "pid": 4512
}
projectIdstringRequired
Must match the projectId in the path.
filenamestringRequired
Relative path of the affected file.
eventstringRequired
Type of event (e.g., created, modified, deleted, renamed).
filesizeintegerRequired
Size of the file in bytes.
filetypestring
MIME type or file classification.
sha256string
SHA-256 hash of the file content for integrity verification.
uidinteger
User ID of the process owner.
pidinteger
Process ID that triggered the event.
timestampUtcstring
ISO 8601 timestamp of the local event.
ingressTokenstring
Authentication token.

Responses

Event successfully ingested and indexed.

{
  "status": "success",
  "eventId": "evt_7721...",
  "projectId": "proj_123",
  "inserted": true,
  "workflowTriggered": true
}

Audit Monitor Events

Retrieve a paginated history of synchronized filesystem events for a specific project. This is used for auditing changes and verifying synchronization state.

GET
/2026-02-01/systems/directory-monitor/{projectId}/events.json
Required permissiondirectory_monitor:readApiAccessPermission::DIRECTORY_MONITOR_READ

Query Parameters

projectIdstringRequired
The project identifier.
sizeinteger
Number of events to return (max 200).
pageinteger
Pagination page number.
eventstring
Filter by event type (e.g., modified).
pathLikestring
Filter by partial file path.

Responses

Collection of project events retrieved.

{
  "status": "fetch",
  "projectId": "proj_123",
  "page": 1,
  "size": 50,
  "count": 120,
  "items": []
}

On this page