Documentation

INFEREN

Clear guides, reference pages, and operational notes in one place.

Ready to read

API Reference

This page documents the key APIs used by:

  • Admin UI pages under /admin/...
  • AI chat pages under /ai-chat...

It is intentionally practical: it focuses on request/response shapes, parameters, and operational semantics rather than exhaustive schema definitions.

Base URLs and Routing

UI pages vs API endpoints

  • UI pages: /admin/..., /ai-chat..., /docs...
  • API endpoints: commonly /api/... (plus some admin JSON routes under /admin/... depending on implementation)

window.API_BASE_URL

The browser-side JS typically builds API calls using:

const API_BASE_URL = window.API_BASE_URL || "";
fetch(`${API_BASE_URL}/api/...`)

Operational rule:

  • API_BASE_URL should point to the API origin you intend the browser to call.

Authentication

Authentication can vary by deployment and route group, but common patterns include:

  • Admin endpoints require an authenticated admin user.
  • Public chat endpoints may be accessible without admin auth (with optional lightweight user identity).

Login (form)

POST /api/v1/auth/login-form
Content-Type: application/x-www-form-urlencoded

Current user

GET /api/v1/auth/me
Authorization: Bearer <token>

Common Conventions

Pagination

List endpoints often use:

  • limit
  • offset

Errors

Common error patterns:

  • 401 Unauthorized: missing/invalid token
  • 403 Forbidden: insufficient role/permissions
  • 404 Not Found: unknown KB/session/document id
  • 409 Conflict: state transition not allowed
  • 422 Unprocessable Entity: validation failure
  • 500 Internal Server Error: unexpected server failure

Admin Dashboard APIs

Dashboard stats

GET /admin/dashboard/stats
GET /admin/dashboard/stats?kb_id=<kb_id>

Dashboard scores

GET /admin/dashboard/scores
GET /admin/dashboard/scores?kb_id=<kb_id>

Recent activity

GET /admin/dashboard/activities
GET /admin/dashboard/activities?kb_id=<kb_id>

Dashboard side panels

GET /admin/dashboard/panel/sessions?limit=50
GET /admin/dashboard/panel/queries?limit=50
GET /admin/dashboard/panel/users?limit=100

Knowledge Base APIs

List KBs

GET /admin/knowledge-bases

Get a KB

GET /admin/knowledge-bases/{kb_id}

Create from URL

POST /admin/knowledge-bases
Content-Type: application/json

{
  "source_url": "https://example.com",
  "name": "Example KB",
  "description": "Optional",
  "preset_id": null
}

Create from uploaded file

POST /admin/knowledge-bases/with-file
Content-Type: multipart/form-data

Status

GET /admin/knowledge-bases/{kb_id}/status

Config

GET /admin/knowledge-bases/{kb_id}/config
PATCH /admin/knowledge-bases/{kb_id}/config

Pause / Resume

POST /admin/knowledge-bases/{kb_id}/pause
POST /admin/knowledge-bases/{kb_id}/resume

Reindex (optionally rescrape)

POST /admin/knowledge-bases/{kb_id}/reindex
Content-Type: application/json

{
  "rescrape": true
}

Delete / restore

DELETE /admin/knowledge-bases/{kb_id}
POST /admin/knowledge-bases/{kb_id}/restore

Upload icon

POST /admin/knowledge-bases/{kb_id}/icon
Content-Type: multipart/form-data

Document APIs

List documents

GET /admin/knowledge-bases/{kb_id}/documents?limit=50&offset=0
GET /admin/knowledge-bases/{kb_id}/documents?search=policy

Add document URL(s)

POST /admin/knowledge-bases/{kb_id}/documents
Content-Type: application/json

Get one document

GET /admin/knowledge-bases/{kb_id}/documents/{document_id}

Delete one document

DELETE /admin/knowledge-bases/{kb_id}/documents/{document_id}

Session APIs

List sessions

GET /admin/sessions
GET /admin/sessions?user_id=<user_id>&limit=100

Get one session

GET /admin/sessions/{session_id}

Get session messages

GET /admin/sessions/{session_id}/messages

Update session

PATCH /admin/sessions/{session_id}

Delete session

DELETE /admin/sessions/{session_id}

Public Chat APIs

These power the standalone AI chat pages.

Create or reuse a lightweight public user

POST /api/v1/public/users
Content-Type: application/json

{
  "username": "guest_or_named_user"
}

List chat-ready KBs

GET /api/v1/public/knowledge-bases

Submit a chat query

POST /api/v1/public/chat/query
POST /api/v1/public/chat/query/{kb_id}
Content-Type: application/json

{
  "query": "What does this policy say?",
  "session_id": "optional-session-id",
  "kb_id": "optional-kb-id",
  "username": "optional-username"
}

Poll for the result

GET /api/v1/public/chat/result/{message_id}
GET /api/v1/public/chat/loading-status/{message_id}

Stream the answer

POST /api/v1/public/chat/stream
Content-Type: application/json

Cancel an in-flight query

POST /api/v1/public/chat/cancel/{message_id}

Load messages for an existing session

GET /api/v1/public/chat/session/{session_id}/messages

Read feedback

GET /api/v1/public/chat/feedback/{message_id}