Endpoints
POST /api/askai
Generate an answer from the configured chat completion provider. If RAG is initialized, retrieved chunks are also returned.
Request:
{ "question": "How do I deploy?" }
Response:
{
"answer": "...",
"chunks": [
{"repo":"...","path":"...","chunk_id":0,"content":"...","metadata":{}}
]
}
Notes:
- RAG is initialized lazily by the RAG endpoints. If it has not been initialized,
"chunks"will benull.
Errors:
400on invalid JSON.500with{ "error": "...", "config": {"timeout": <sec>, "retries": <n>} }.
POST /api/rag/query
Hybrid retrieval only (no generation). The server currently returns the top 5 chunks.
Request:
{ "question": "backup policy" }
Response:
{ "chunks": [ {"repo":"...","path":"...","chunk_id":0,"content":"...","metadata":{}} ] }
Errors:
400on invalid JSON500on unexpected failures4xx/5xxpropagated from embedding provider200with"chunks": nullif the RAG service is not initialized
POST /api/rag/upsert
Upsert pre-embedded documents.
Request (shape only):
{
"docs": [
{
"repo": "...",
"path": "...",
"chunk_id": 0,
"content": "...",
"embedding": [0.1, 0.2],
"metadata": {"heading": "Intro"},
"content_sha": "<sha256>"
}
]
}
Response:
{ "rows": 123 }
Errors: 503 if the vector store is unavailable.
Notes:
- If the RAG service is not initialized, the response is
200with{ "rows": 0 }.
POST /api/sync
Sync a Git repository to a local directory.
Request:
{ "repo_url": "https://github.com/org/repo.git", "local_path": "/tmp/repo" }
Response:
{ "status": "synced" }
Errors:
400on invalid JSON500when the repo sync fails
GET /api/users
Returns users from the service database.
GET /api/nodes
Returns nodes from the service database.
GET /api/admin/settings
Requires X-User-Role: admin|operator.
Response:
{ "version": 3, "matrix": {"moduleA": {"admin": true, "user": false}} }
POST /api/admin/settings
Requires X-User-Role: admin|operator.
Request:
{ "version": 3, "matrix": {"moduleA": {"admin": true}} }
Response:
{ "version": 4, "matrix": {"moduleA": {"admin": true}} }
Conflict:
409with{ "error": "admin settings version conflict", "version": <current>, "matrix": <current> }
Errors:
400on invalid JSON or unsupported role values in the matrix403when the caller is notadminoroperator503when the service database is not initialized