Add a directory to the watch list. The backend will start indexing all files within it and monitor for changes.
Request
Absolute path to the directory to watch and indexExample: /Users/username/Downloads
Request Example
curl -X POST http://localhost:60534/api/watch/ \
-H "Content-Type: application/json" \
-d '{
"directory_path": "/Users/username/Downloads"
}'
import requests
response = requests.post(
'http://localhost:60534/api/watch/',
json={'directory_path': '/Users/username/Downloads'}
)
print(response.json())
Response
Whether the watch was started successfully
Human-readable status message
Number of files indexed (0 on initial request since indexing is async)
Response Example
{
"success": true,
"message": "Started watching directory: /Users/username/Downloads",
"files_indexed": 0
}
{
"success": false,
"message": "Directory '/Users/username/Downloads' is already being watched",
"files_indexed": 0
}
Behavior
When you watch a directory:
- Duplicate Check: Verifies this directory (or a parent) isn’t already watched
- Database Entry: Adds directory to
watched_directories table
- File Watcher: Starts monitoring filesystem for changes via watchdog
- Initial Scan: Recursively processes all files through the 4-stage pipeline
- Queue Integration: Subsequent file changes are routed through the indexing queue with debounce
The indexing process runs asynchronously. Use the /api/updates endpoint to monitor progress in real-time.