Retrieve a list of all directories currently being watched and indexed by CosmaSense.
Request
No parameters required.
Request Example
curl http://localhost:60534/api/watched-directories
import requests
response = requests.get( 'http://localhost:60534/api/watched-directories' )
directories = response.json()[ 'data' ][ 'directories' ]
for dir in directories:
print ( f " { dir [ 'path' ] } : { dir [ 'file_count' ] } files" )
const response = await fetch ( 'http://localhost:60534/api/watched-directories' );
const data = await response . json ();
data . data . directories . forEach ( dir => {
console . log ( ` ${ dir . path } : ${ dir . file_count } files` );
});
Response
Status of the request: success or error
Total number of watched directories
Array of watched directory objects Absolute path to the watched directory
Number of files discovered in this directory
Number of files successfully indexed
Number of files that failed processing
Current status: indexing, complete, or error
ISO 8601 timestamp when directory was added
Response Example
{
"status" : "success" ,
"data" : {
"total_directories" : 2 ,
"directories" : [
{
"path" : "/Users/username/Downloads" ,
"file_count" : 127 ,
"indexed_count" : 125 ,
"failed_count" : 2 ,
"status" : "complete" ,
"added_at" : "2024-01-15T10:30:00Z"
},
{
"path" : "/Users/username/Documents" ,
"file_count" : 543 ,
"indexed_count" : 489 ,
"failed_count" : 0 ,
"status" : "indexing" ,
"added_at" : "2024-01-15T14:22:00Z"
}
]
}
}
Directory Status
Status Description indexingCurrently processing files in this directory completeAll files have been processed (some may have failed) errorCritical error occurred with this directory watchingMonitoring for file changes (post-initial-index)
Directories continue to be watched even after initial indexing is complete. The backend monitors for file changes and automatically re-indexes modified or new files.
Use this endpoint to check indexing progress before running searches. Searches only return results for files that have been fully indexed.