Skip to content

API reference

Base URL for the manual lab: http://localhost:8000. Protected endpoints require Authorization: Bearer <key>. JSON requests also need Content-Type: application/json.

The running service exposes /docs, /redoc, and /openapi.json. Use that schema to verify a deployed revision; this page describes the committed backend used for this documentation change.

POST /api/v1/query accepts:

FieldDefault / constraintMeaning
queryRequired; 1–20,000 charactersPrompt text
context_limit5; range 1–20Knowledge documents requested
include_sourcestrueInclude retrieved content in response
conversation_idnullContinue an existing thread when memory is enabled
user_idnullNon-secret identifier; does not enforce isolation
modelnullRequested model when routing is enabled
prompt_id, playbook_idnullRepository file paths used for metadata extraction
task_typenullRouting hint

For example, use prompts/security/security-review.md or playbooks/security-review.md as metadata paths. They are routing signals, not an automatic instruction-file execution mechanism.

The response includes response, sources, model, timestamp, tokens_used, conversation_id, and routing_info. See the first-query example.

Method and pathRequestPurpose
GET /healthNone; publicKnowledge-store count and API reachability
POST /api/v1/queryJSON object aboveRetrieve and generate
POST /api/v1/ingestJSON array of {id, content}Add knowledge documents
GET /api/v1/modelsNoneList Ollama models
POST /api/v1/pull-modelURL model_nameDownload a model; changes disk state
GET /api/v1/router/healthNoneRouter component summary
GET /api/v1/router/statisticsNoneProcess-local routing counts
POST /api/v1/router/testURL query, optional prompt_id, playbook_idPreview scoring
POST /api/v1/router/refresh-modelsNoneRefresh availability cache
POST /api/v1/conversationsJSON user_id, optional retention_days (1–365, default 7)Create thread
GET /api/v1/conversations/{id}Path IDThread metadata
GET /api/v1/conversations/{id}/messagesPath ID; URL limit default 10Stored messages
GET /api/v1/users/{user_id}/conversationsPath user; URL limit default 20List threads
DELETE /api/v1/conversations/{id}Path IDDelete thread and attempt vector cleanup
POST /api/v1/conversations/cleanupNoneDelete expired SQLite threads

Query uses 10 requests/minute and ingest uses 20, sharing a single per-token history in the current process. Models and pull-model do not implement the limits previously documented for them. Limits are not coordinated across workers. Conversation list limits are not bounded with Pydantic constraints.

The health endpoints do not prove generation works. Conversation endpoints do not authorize ownership. Cleanup’s reported message count is an approximation and omits vector expiry. Read memory behavior before using these endpoints.

StatusTypical cause
403Missing/invalid bearer authentication in the pinned stack
404A requested conversation is missing where checked
422Missing parameters, wrong request location, or invalid JSON fields
429Query/ingest in-memory request threshold
500Generation/storage failure; some paths expose exception text
501Requested conversation/router feature is disabled

Next: Configuration or troubleshooting.