Reference
API Reference
Aktilot's backend is a FastAPI application. Interactive OpenAPI docs are always available locally at http://localhost:8000/docs.
Base URL
/api
Content type
application/json*
Auth
None (admin routes)
*except file upload, which is multipart/form-data. There is no authentication layer on the admin routes in this open-source build — put them behind your own auth/proxy before exposing the API publicly. The Public group below is the one exception: it's designed to be exposed directly, scoped per-visitor by cookie, and rate-limited.
Projects
4 endpointsA project is a knowledge base: a collection of uploaded files and the agents that query them.
Request body
| name | string | Required. |
| description | string | null | Optional. |
Response
201 Created{ "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "name": "Support Docs", "description": "Internal support knowledge base", "created_at": "2026-07-17T10:15:00Z"}Response
200 OK[{ "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "name": "Support Docs", "description": "Internal support knowledge base", "created_at": "2026-07-17T10:15:00Z"}]Path parameters
| project_id | UUID |
Response
200 OK{ "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "name": "Support Docs", "description": "Internal support knowledge base", "created_at": "2026-07-17T10:15:00Z"}Errors
- 404"Project not found"
Path parameters
| project_id | UUID |
Response
204 No ContentNo response body.
Errors
- 404"Project not found"
Files
3 endpointsUploading a file only writes the record and enqueues ingestion — chunking and embedding happen asynchronously in a Temporal workflow. Poll GET /files or check chunk_status to see when a file is ready to be queried.
Path parameters
| project_id | UUID |
Request body
multipart/form-data, field name "file". Allowed extensions: .pdf, .txt, .doc, .docx.
Response
201 CreatedReturned immediately with chunk_status = "pending" — a Temporal DocumentWorkflow is started in the background and moves it through "chunking" → "chunked" (or "error").
{ "id": "9c858901-8a57-4791-81fe-4c455b099bc9", "project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "filename": "handbook.pdf", "size": 482913, "chunk_status": "pending", "chunk_count": 0, "uploaded_at": "2026-07-17T10:16:42Z"}Errors
- 400Missing filename, or extension not in the allowed list
- 404"Project not found"
Path parameters
| project_id | UUID |
Response
200 OK[ { "id": "9c858901-8a57-4791-81fe-4c455b099bc9", "project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "filename": "handbook.pdf", "size": 482913, "chunk_status": "chunked", "chunk_count": 42, "uploaded_at": "2026-07-17T10:16:42Z" }]Errors
- 404"Project not found"
Path parameters
| project_id | UUID | |
| file_id | UUID |
Response
204 No ContentNo response body.
Errors
- 404"File not found"
Agents
5 endpointsAn agent is a configured chat persona scoped to one project: a system prompt plus a top_k that controls how many chunks are retrieved per question.
Path parameters
| project_id | UUID |
Request body
| name | string | Required. |
| description | string | null | Optional. |
| system_prompt | string | Optional, defaults to "". |
| top_k | int | Optional, defaults to 2. |
Response
201 Created{ "id": "5e9d5a1b-8b8b-4f2d-9a9e-6b2c3f9a7d10", "project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "name": "Support Bot", "description": "Answers questions from the support handbook", "system_prompt": "You are a helpful support assistant.", "top_k": 4, "created_at": "2026-07-17T10:20:00Z", "share_slug": null, "share_daily_message_cap": null}Errors
- 404"Project not found"
Path parameters
| project_id | UUID |
Response
200 OK[{ "id": "5e9d5a1b-8b8b-4f2d-9a9e-6b2c3f9a7d10", "project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "name": "Support Bot", "description": "Answers questions from the support handbook", "system_prompt": "You are a helpful support assistant.", "top_k": 4, "created_at": "2026-07-17T10:20:00Z", "share_slug": null, "share_daily_message_cap": null}]Errors
- 404"Project not found"
Path parameters
| agent_id | UUID |
Response
200 OK{ "id": "5e9d5a1b-8b8b-4f2d-9a9e-6b2c3f9a7d10", "project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "name": "Support Bot", "description": "Answers questions from the support handbook", "system_prompt": "You are a helpful support assistant.", "top_k": 4, "created_at": "2026-07-17T10:20:00Z", "share_slug": null, "share_daily_message_cap": null}Errors
- 404"Agent not found"
Path parameters
| agent_id | UUID |
Request body
All fields optional — only the ones supplied are changed.
| name | string | null | |
| description | string | null | |
| system_prompt | string | null | |
| top_k | int | null |
Response
200 OK{ "id": "5e9d5a1b-8b8b-4f2d-9a9e-6b2c3f9a7d10", "project_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6", "name": "Support Bot", "description": "Answers questions from the support handbook", "system_prompt": "You are a helpful support assistant.", "top_k": 4, "created_at": "2026-07-17T10:20:00Z", "share_slug": null, "share_daily_message_cap": null}Errors
- 404"Agent not found"
Path parameters
| agent_id | UUID |
Response
204 No ContentNo response body.
Errors
- 404"Agent not found"
Chat
2 endpointsChatting runs the durable RAG pipeline synchronously: the request blocks (up to a 2-minute execution timeout) while a Temporal ChatWorkflow retrieves chunks, calls the LLM, and persists the exchange, then returns the full result.
Path parameters
| agent_id | UUID |
Request body
| question | string | Required. |
| session_id | UUID | Required — create one first via POST /api/agents/{agent_id}/sessions. |
Response
200 OK{ "answer": "Full-time employees accrue 15 PTO days per year.", "tool_steps": [ { "name": "retrieve_chunks", "start_time": "2026-07-17T10:22:01.120Z", "end_time": "2026-07-17T10:22:01.340Z", "duration_ms": 220.4, "input_summary": "query='PTO policy', top_k=4", "output_summary": "3 chunks retrieved" } ], "retrieved_chunks": [ { "chunk_id": "c1a2b3c4-d5e6-4f80-9a1b-2c3d4e5f6789", "filename": "handbook.pdf", "chunk_index": 12, "content": "Full-time employees accrue 15 PTO days per year, accrued monthly...", "score": 0.87, "vec_score": 0.81, "bm25_score": 4.2, "kw_hits": 2, "keywords_matched": ["PTO", "policy"] } ], "keywords": ["PTO", "policy"]}Errors
- 404"Agent not found", or the session does not belong to this agent (or belongs to a public visitor)
- 401Invalid OpenAI API key
- 429OpenAI rate limit exceeded
- 500Chat pipeline failed
Path parameters
| agent_id | UUID |
Response
200 OK[ { "id": "1b2c3d4e-5f60-4182-93a4-b5c6d7e8f901", "agent_id": "5e9d5a1b-8b8b-4f2d-9a9e-6b2c3f9a7d10", "role": "user", "content": "How many PTO days do I get?", "created_at": "2026-07-17T10:22:00Z" }, { "id": "2c3d4e5f-6071-4293-a4b5-c6d7e8f90123", "agent_id": "5e9d5a1b-8b8b-4f2d-9a9e-6b2c3f9a7d10", "role": "assistant", "content": "Full-time employees accrue 15 PTO days per year.", "created_at": "2026-07-17T10:22:01Z" }]Errors
- 404"Agent not found"
Chat Sessions
3 endpointsSessions group messages into a conversation thread. A session must exist before you can POST a chat message.
Path parameters
| agent_id | UUID |
Response
201 Created{ "id": "7a1b2c3d-4e5f-4071-8293-a4b5c6d7e8f9", "agent_id": "5e9d5a1b-8b8b-4f2d-9a9e-6b2c3f9a7d10", "title": null, "created_at": "2026-07-17T10:21:50Z", "updated_at": "2026-07-17T10:21:50Z"}Errors
- 404"Agent not found"
Path parameters
| agent_id | UUID |
Response
200 OK[ { "id": "7a1b2c3d-4e5f-4071-8293-a4b5c6d7e8f9", "agent_id": "5e9d5a1b-8b8b-4f2d-9a9e-6b2c3f9a7d10", "title": null, "created_at": "2026-07-17T10:21:50Z", "updated_at": "2026-07-17T10:21:50Z" }]Errors
- 404"Agent not found"
Path parameters
| session_id | UUID |
Response
200 OK[ { "id": "1b2c3d4e-5f60-4182-93a4-b5c6d7e8f901", "agent_id": "5e9d5a1b-8b8b-4f2d-9a9e-6b2c3f9a7d10", "role": "user", "content": "How many PTO days do I get?", "created_at": "2026-07-17T10:22:00Z" }, { "id": "2c3d4e5f-6071-4293-a4b5-c6d7e8f90123", "agent_id": "5e9d5a1b-8b8b-4f2d-9a9e-6b2c3f9a7d10", "role": "assistant", "content": "Full-time employees accrue 15 PTO days per year.", "created_at": "2026-07-17T10:22:01Z" }]Errors
- 404"Chat session not found"
System
1 endpointResponse
200 OK{ "status": "ok"}