Documentation
API & Integration Guide
Everything you need to connect, query, and build on top of Graffold.
Quick Start
Base URL: http://localhost:8000
Auth: Bearer token via Authorization header (except health endpoints).
All request/response bodies are JSON. Streaming responses use Server-Sent Events.
Sessions
Create a session to configure your database, LLM provider, and agent type. All queries run within a session context.
{
"llm_service": "bedrock",
"database_name": "neo4j",
"agent_type": "graph_rag_agent",
"connection_details": {
"uri": "bolt://localhost:7687",
"user": "neo4j",
"password": "..."
}
} Returns a session_id for all subsequent queries. Sessions can be shared (view-only or editable) via the Org Panel.
Query
Execute natural language queries against your knowledge graph. Supports mode selection and search depth control.
{
"question": "Which suppliers have compliance gaps?",
"mode": "hybrid",
"search_depth": "balanced",
"stream": false
} Query Modes
Direct LLM answer, no graph retrieval
Entity neighborhood search
Community summary-based retrieval
Merges local + global with deduplication
Search Depth
Discovery only, no expansion
1 expansion round, Cypher fallback if < 3 targets
Up to 3 rounds, always runs Cypher fallback
Streaming (SSE)
Set "stream": true for real-time token-by-token responses.
event: retrieval_started
event: retrieval_complete
event: synthesis_started
event: token → {"text": "Several", "index": 0}
event: token → {"text": " suppliers", "index": 1}
...
event: complete → {"sources": [...], "cost": {...}} KNN Expansion
Expand query results with k-nearest neighbors to discover connected entities beyond the initial answer.
{
"expansion_level": 1,
"query_index": null
} Ingestion
Ingest documents via the API. Supports PDF upload (multipart), and any source with an API connector.
Content-Type: multipart/form-data source=pdf database=mydb files=@document.pdf
10MB per file, 50 files per batch. The pipeline handles chunking, entity extraction, consolidation, and embedding generation.
Other Endpoints
Node counts, relationship counts, degree distributions
Aggregated LLM cost data by session and operation type
Query latency, cache hit rates, multi-hop success, mode distribution
Readiness probe — checks DB + LLM connectivity (no auth required)
Python Client
import requests
BASE = "http://localhost:8000"
HEADERS = {"Authorization": "Bearer token", "Content-Type": "application/json"}
# Create session
session = requests.post(f"{BASE}/v1/sessions", headers=HEADERS, json={
"llm_service": "bedrock",
"database_name": "neo4j",
"connection_details": {"uri": "bolt://localhost:7687", "user": "neo4j", "password": "..."}
}).json()
# Query
result = requests.post(
f"{BASE}/v1/sessions/{session['session_id']}/query",
headers=HEADERS,
json={"question": "What connects entity A to entity B?", "mode": "hybrid"}
).json()
print(result["answer"])