GET /api/analytics/vector-graph
Fetches all Qdrant vector points belonging to a user (up to 100), validates them against Appwrite Storage to filter out orphaned vectors, reduces their 768-dimension embeddings to 2D coordinates using UMAP, and returns graph nodes and edges ready for a force-directed visualisation. Sequential chunks from the same document are connected as edges so that document clusters are visible in the rendered graph.UMAP requires at least 2 points to produce a projection. If the user has no
indexed documents the endpoint returns empty
nodes and links arrays
without an error.Query parameters
Appwrite user ID. Only vectors with a matching
userId payload field are
included.Set to
"true" to delete Qdrant vectors whose documentId no longer exists
in Appwrite Storage before building the graph. Useful for removing orphaned
vectors after files are deleted outside of /api/documents/delete.Response
One node per valid vector point. Coordinates are normalised to the range
[-200, 200] on both axes.Edges connecting consecutive chunks within the same document. Chunks are
sorted by
chunkIndex before edges are created.Number of unique document file names represented in the graph.
Total number of nodes (valid vector points).
Number of Qdrant vectors whose
documentId was not found in Appwrite
Storage. Non-zero only when orphaned vectors exist.true if cleanup=true was requested and orphaned vectors were deleted.Summary of each document’s chunk count, useful for building a legend.
Empty state
When the user has no indexed documents, or all vectors are orphaned andcleanup is not set, the endpoint returns:
Errors
| Status | Condition |
|---|---|
400 | userId query parameter is missing |
500 | QDRANT_CLUSTER_URL or QDRANT_API_KEY environment variables are not set |
500 | Appwrite Storage file listing failed |
500 | UMAP projection failed |