Sources API¶
Manage search sources via API. All endpoints require authentication.
Endpoints¶
GET /api/sources- List all sourcesPOST /api/sources- Create sourceGET /api/sources/{id}- Get source detailsPUT /api/sources/{id}- Update sourceDELETE /api/sources/{id}- Delete sourcePOST /api/sources/{id}/reindex- Trigger reindexPOST /api/sources/{id}/clear-stale- Remove stale failed-file entries
Source Fields¶
When creating or updating a source, you can set:
name- Display name for the sourceroot_path- Directory path to index (container path in Docker)include_patterns- Array of glob patterns for files to includeexclude_patterns- Array of glob patterns for files to excludescan_schedule- Cron schedule for automatic indexing (optional)
The scan_schedule field accepts presets (@hourly, @daily, @weekly) or standard cron expressions (e.g., 0 */6 * * * for every 6 hours). Set to null or omit for manual-only indexing.
Response objects also include created_at, updated_at, last_scan_at, and next_scan_at timestamps.
Example create body:
{
"name": "Documents",
"root_path": "/data/documents",
"include_patterns": ["**/*.pdf", "**/*.md"],
"exclude_patterns": ["**/.git/**", "**/node_modules/**"],
"scan_schedule": "@daily"
}
The CLI and web UI accept comma-separated pattern text. The API takes arrays.
Reindex¶
POST /api/sources/{id}/reindex triggers an immediate reindex. Add ?full=true for a full reindex instead of incremental.
Returns 409 Conflict if the source is already being indexed (either by a manual trigger or a scheduled run).
Clear stale failed files¶
POST /api/sources/{id}/clear-stale removes failed entries for files that no longer exist on disk. This is useful after moving or deleting files that were already listed as failures.
curl -X POST http://localhost:8000/api/sources/documents/clear-stale \
-H "Authorization: Bearer $TOKEN"
Response:
See API Overview for examples.
Or visit the interactive docs: http://localhost:8000/docs