Source Management
Complete CRUD operations for managing data sources within knowledge graphs. Provides KG-centric source management with complete artifact tracking. Track ingestion status, view statistics, update sources, and delete data with comprehensive artifact cleanup. All operations interface with SQLHandler and Qdrant for data management.
List All Knowledge Graphs with Sources
Get an overview of all KGs with source counts and artifact information.
GET /api/v1/sources/kgs
Query Parameters
| Parameter | Type | Description |
|---|---|---|
include_artifacts | boolean | Include visualization and storage file info (default: true) |
Response
List Sources for a Knowledge Graph
Get all data sources for a specific knowledge graph.
/api/v1/sources/kg/{kg_name}
Path Parameters
| Parameter | Type | Description |
|---|---|---|
kg_name | string | Knowledge graph name |
Query Parameters
| Parameter | Type | Description |
|---|---|---|
include_stats | boolean | Include per-source statistics (default: true) |
Get Source Statistics
Retrieve detailed statistics for a specific source.
GET /api/v1/sources/{source_id}/stats
Query Parameters
| Parameter | Type | Description |
|---|---|---|
include_vector_stats | boolean | Include vector database statistics (default: true) |
Response
/api/v1/sources/{kg_name}/{source_id}
Delete a source and all associated data (implements "uncheck PDF" functionality). This removes chunks, entities, relations, vector embeddings, and optionally visualizations and KG files.
Path Parameters
| Parameter | Type | Description |
|---|---|---|
kg_name | string | Knowledge graph name |
source_id | string | Source identifier |
Query Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
delete_from_vector_db | boolean | true | Delete vector embeddings from Qdrant |
delete_visualizations | boolean | true | Delete visualizations if this is the last source |
delete_kg_files | boolean | false | Delete KG export files if this is the last source |
force | boolean | false | Force deletion (bypass safety checks) |
Response
/api/v1/sources/{kg_name}/{source_id}
Update source metadata or trigger re-ingestion with content change detection.
Request Body
| Field | Type | Description |
|---|---|---|
force_reprocess | boolean | Force re-ingestion even if content unchanged (default: false) |
update_metadata | object | Additional metadata to merge with existing metadata |
Response
Check Source Management Health
Verify the source management system is operational.
GET /api/v1/sources/health
Response
Best Practices
- Regular cleanup: Periodically review and delete unused sources
- Monitor status: Track source ingestion status for data quality
- Use statistics: Enable stats to understand source content
- Batch operations: Use bulk endpoints for multiple sources
Frontend Integration
React - Source Management Component
Error Responses
Source Not Found
Deletion Failed
Best Practices
- Confirmation: Always confirm before deleting sources
- Statistics: Check statistics before deletion to understand impact
- Batch operations: Use batch processing for multiple sources
- Force flag: Use force=true only when necessary
- Health checks: Monitor system health before bulk operations
- Metadata: Keep metadata updated for better source tracking
- Re-ingestion: Use update endpoint for content changes, not delete+create