REST API¶
The FastAPI backend exposes a REST API for all document ingestion, search, and AI query operations.
Base URL: http://localhost:8000/api/
Interactive API Documentation¶
Both UIs are served by the running backend and let you try every endpoint directly in the browser.
| UI | URL | Notes |
|---|---|---|
| Swagger UI | http://localhost:8000/docs | Try endpoints, inspect schemas, submit requests |
| ReDoc | http://localhost:8000/redoc | Cleaner read-only reference view |
Endpoints¶
System¶
| Endpoint | Method | Description |
|---|---|---|
/api/health |
GET | Health check — verify backend is running |
/api/status |
GET | System status and configuration (databases, LLM, feature flags) |
/api/info |
GET | System information and package versions |
/api/python-info |
GET | Python environment diagnostics |
/api/ui-defaults |
GET | Where the UIs' Deep, Graph and RDF checkboxes start, and which graph columns to show (v0.9.0+) |
Ingestion¶
| Endpoint | Method | Description |
|---|---|---|
/api/ingest |
POST | Ingest documents from a configured data source (filesystem, s3, web, cmis, alfresco, ...) |
/api/upload |
POST | Upload files directly for processing |
/api/ingest-text |
POST | Ingest raw text content |
/api/test-sample |
POST | Test the system with built-in sample content |
/api/cleanup-uploads |
POST | Remove temporarily uploaded files |
All three text ingestion endpoints (/api/ingest, /api/ingest-text, /api/test-sample) accept enabled_graph and enabled_rdf booleans: which graphs to build, the property graph (PG_GRAPH_DB) and the RDF graph (RDF_GRAPH_DB), each on its own. One not given follows the server's DEFAULT_ENABLED_GRAPH / DEFAULT_ENABLED_RDF (both true unless set). The older skip_graph boolean still works: it skips KG extraction and all graph writes — vector and full-text stores are still updated. GET /api/ui-defaults returns those defaults, plus recursive (DEFAULT_RECURSIVE, where the UIs' Deep checkbox starts) and show_graph / show_rdf (whether a graph store is configured with ENABLE_KNOWLEDGE_GRAPH on). See the auto-sync API reference for ingest status, removal and per-row runs.
Async Processing¶
| Endpoint | Method | Description |
|---|---|---|
/api/processing-status/{id} |
GET | Poll status of an async ingestion operation |
/api/processing-events/{id} |
GET | Server-Sent Events stream for real-time progress |
/api/cancel-processing/{id} |
POST | Cancel an ongoing processing operation |
Search & Query¶
| Endpoint | Method | Description |
|---|---|---|
/api/search |
POST | Hybrid search — returns ranked document excerpts from all configured stores |
/api/query |
POST | AI-powered Q&A — generates an answer from the document corpus |
Both take optional source_auth (the asker's sign-ins, per source: alfresco, nuxeo, cmis,
microsoft, box, google, azure, s3) to return only documents that user may read, and
sources (a list of {source, url?}) to limit the question to chosen sources.
Sign-In¶
| Endpoint | Method | Description |
|---|---|---|
/api/auth/requirements |
GET | Which sign-ins the stored documents need, one provider per server |
/api/sources/available |
GET | The sources with documents in the stores (for sources) |
/api/auth/{alfresco,nuxeo,cmis,s3}/login |
POST | Username / password (S3: IAM access key) sign-in; returns a ticket, token or session |
/api/auth/{alfresco,nuxeo,cmis,s3}/me |
GET | Check a stored sign-in |
/api/auth/{provider}/popup, /callback, /result, /me |
GET | Popup sign-in for microsoft, box, google, azure |
/api/auth/{provider}/handoff, /handoff/result |
POST | Browser hand-off sign-in (used by the MCP server's start_sign_in / finish_sign_in) |
See the Sign-In and Permission-Aware Search guide.
Graph¶
| Endpoint | Method | Description |
|---|---|---|
/api/graph |
GET | Graph database status and node/relationship counts. Returns live counts where supported (Neo4j full counts via Cypher; other LC-backed stores via lc_graph.query() when the store exposes a count query; remaining stores return status and dashboard URL) |
/api/graph/query |
POST | Execute a native graph query against the configured store |
POST /api/graph/query routes to the appropriate query language automatically based on the configured graph backend:
| Store | Language |
|---|---|
| Neo4j, Memgraph, FalkorDB, ArcadeDB, Ladybug, Apache AGE | Cypher |
| ArangoDB | AQL |
| SurrealDB | SurrealQL |
| Azure Cosmos DB for Gremlin | Gremlin |
| TigerGraph | GSQL |
| Neptune / Neptune Analytics | openCypher |
| Google Spanner | GQL |
RDF-only (PG_GRAPH_DB=none) |
SPARQL fallback |
Request body:
{
"query": "MATCH (p:Person)-[:WORKS_FOR]->(c:Company) RETURN p.name, c.name LIMIT 10",
"language": "cypher",
"params": {}
}
The language field is optional — the backend infers it from the configured store when omitted.
RDF / Ontology¶
These endpoints are active when RDF_GRAPH_DB is set to fuseki, graphdb, oxigraph, or neptune_rdf.
| Endpoint | Method | Description |
|---|---|---|
/api/rdf/query/sparql |
POST | Execute a SPARQL SELECT query against the configured RDF store |
/api/rdf/ontology/info |
GET | Return loaded ontology entity and relation type lists |
/api/rdf/ontology/upload |
POST | Upload a new ontology file at runtime |
/api/rdf/rdf-store/list |
GET | List all registered RDF stores |
/api/rdf/rdf-store/connect |
POST | Register an additional RDF store at runtime |
/api/rdf/rdf-store/{name} |
DELETE | Deregister an RDF store |
/api/rdf/export/rdf |
POST | Export knowledge graph as RDF (501 stub — not yet implemented; use direct HTTP export to the store instead) |
Example Requests¶
Health Check¶
Ingest from Filesystem (folder)¶
curl -X POST http://localhost:8000/api/ingest \
-H "Content-Type: application/json" \
-d '{
"data_source": "filesystem",
"config": {"path": "/path/to/docs"},
"skip_graph": false
}'
Upload a File¶
Ingest Text Directly¶
curl -X POST http://localhost:8000/api/ingest-text \
-H "Content-Type: application/json" \
-d '{"content": "Acme Corp was founded in 2010 by John Smith.", "source_name": "company-info"}'
Hybrid Search¶
curl -X POST http://localhost:8000/api/search \
-H "Content-Type: application/json" \
-d '{"query": "knowledge graph extraction", "top_k": 5}'
AI Q&A Query¶
curl -X POST http://localhost:8000/api/query \
-H "Content-Type: application/json" \
-d '{"query": "What are the main topics in the documents?", "top_k": 10}'
Poll Processing Status¶
# Get the task ID from an async ingest response, then poll:
curl http://localhost:8000/api/processing-status/{task_id}
# Or stream real-time events:
curl -N http://localhost:8000/api/processing-events/{task_id}
Native Graph Query (Cypher — Neo4j)¶
curl -X POST http://localhost:8000/api/graph/query \
-H "Content-Type: application/json" \
-d '{"query": "MATCH (p:Person)-[:WORKS_FOR]->(c:Company) RETURN p.name, c.name LIMIT 10"}'
Native Graph Query (AQL — ArangoDB)¶
curl -X POST http://localhost:8000/api/graph/query \
-H "Content-Type: application/json" \
-d '{"query": "FOR v IN Person FILTER LOWER(v.name) CONTAINS \"acme\" RETURN v.name", "language": "aql"}'
SPARQL Query (RDF store)¶
curl -X POST http://localhost:8000/api/rdf/query/sparql \
-H "Content-Type: application/json" \
-d '{"query": "SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 10"}'
Async Ingestion Flow¶
Long-running ingestion operations (large files, many documents) return a task_id immediately:
POST /api/ingest → { "task_id": "abc123", "status": "processing" }
GET /api/processing-status/abc123 → { "status": "running", "progress": 42 }
GET /api/processing-events/abc123 → SSE stream with real-time progress updates
POST /api/cancel-processing/abc123 → cancel if needed
CocoIndex endpoints¶
When PIPELINE_BACKEND=cocoindex, additional endpoints (/api/cocoindex/status,
/api/cocoindex/sync-now, /api/cocoindex/config) are available. See
CocoIndex Developer Guide — Running and driving it.
See Also¶
- Architecture — detailed API workflow and data flow diagrams
- MCP Server — higher-level tools built on top of these endpoints
- RDF Store User Guide — RDF/SPARQL endpoint details
- CocoIndex Developer Guide — CocoIndex CLI vs FastAPI, custom pipelines