API Reference¶
This page summarizes the HTTP API surfaces identified during source-code inspection of WhiteLotusAI. It is intended as an engineering orientation page, not as a complete OpenAPI contract.
Reference status: source-derived; runtime verification pending
The route inventory below does not certify that every endpoint is operational, secure, externally reachable, tested, or available in a deployed environment. Confirm the implementation, configuration, tests, and deployed routing before treating an entry as a client-facing API contract.
Detailed integration behaviour belongs in the corresponding integration pages. Request and response schemas, authentication requirements, status codes, and side effects must be verified against the relevant implementation before being documented as guaranteed behaviour.
API architecture¶
WhiteLotusAI uses a REST API gateway alongside supporting services. The gateway's API root is configurable through API_ROOT, which defaults to /api in the inspected source.
flowchart TB
Client["Client or frontend"]
Gateway["REST API gateway<br/>FastAPI"]
subgraph GatewayRoutes["Gateway route surface"]
direction TB
Auth["Authentication"]
Profile["Profile management"]
Sessions["Sessions"]
Admin["Administration"]
RAG["RAG endpoints"]
Proxy["Chat and proxy routing"]
end
subgraph Supporting["Supporting service surfaces"]
direction TB
Chat["Chat service<br/>Streaming and chat processing"]
Integrations["Integrations service<br/>Provider operations, OAuth, webhooks, MCP"]
User["User service"]
SessionService["Session service"]
RAGService["RAG service"]
end
Client --> Gateway
Gateway --> Auth
Gateway --> Profile
Gateway --> Sessions
Gateway --> Admin
Gateway --> RAG
Gateway --> Proxy
Proxy -.->|"Effective route depends on configuration"| Chat
Gateway -.->|"Configured service routing"| Integrations
Gateway -.->|"Supporting service surface; verify runtime path"| User
Gateway -.->|"Supporting service surface; verify runtime path"| SessionService
Gateway -.->|"Supporting service surface; verify runtime path"| RAGService
%% Theme-adaptive fills and text; colored outlines identify categories.
classDef client stroke:#2563eb,stroke-width:2px
classDef gateway stroke:#7c3aed,stroke-width:2.5px
classDef route stroke:#7c3aed,stroke-width:1.5px
classDef service stroke:#059669,stroke-width:2px
class Client client
class Gateway gateway
class Auth,Profile,Sessions,Admin,RAG,Proxy route
class Chat,Integrations,User,SessionService,RAGService service
%% Transparent backgrounds preserve the active documentation theme.
style GatewayRoutes fill:transparent,stroke:#7c3aed,stroke-width:1.5px
style Supporting fill:transparent,stroke:#059669,stroke-width:1.5px
The diagram is a logical orientation map, not a deployment topology or confirmation that every path is exposed. Verify the actual route mapping and service communication for the target environment.
| API surface | Responsibility identified in source | Source location |
|---|---|---|
| REST API gateway | Main application API, authentication, profiles, sessions, administration, and RAG routes | rest_api/package/app/ |
| Chat service | Chat request processing and streaming | chat/package/app/ |
| Integrations service | External integrations, OAuth callbacks, integration operations, webhooks, and MCP endpoints | integrations/package/app/ |
| User service | User-related operations, including OAuth token management | user/package/app/ |
| Session service | Supporting session functionality | session/package/app/ |
| RAG service | Supporting retrieval-augmented generation functionality | rag/package/app/ |
Configuration is not deployment evidence
The inspected gateway configuration includes internal service URL defaults such as http://chat:8001 and http://integrations:8006. These are configurable defaults; they do not establish the deployed network topology or prove that a route is reachable.
Gateway endpoint inventory¶
The paths below were identified in the gateway route definitions. Unless overridden by configuration, the gateway API prefix is /api.
Authentication¶
| Method | Path | Purpose |
|---|---|---|
POST |
/api/auth/register |
Register a user |
POST |
/api/auth/login |
Authenticate a user |
POST |
/api/auth/refresh |
Refresh authentication |
POST |
/api/auth/logout |
Log out an authenticated user |
Source: rest_api/package/app/api/auth.py
Profile management¶
| Method | Path | Purpose |
|---|---|---|
GET |
/api/profile |
Retrieve the profile |
PUT |
/api/profile |
Update the profile |
PUT |
/api/profile/password |
Update the password |
Source: rest_api/package/app/api/profile.py
The profile router declares a JWTBearer dependency. Verify the precise authentication and authorization behaviour against the implementation and tests before relying on it.
Sessions¶
| Method | Path | Purpose |
|---|---|---|
POST |
/api/session |
Create a session |
GET |
/api/session/sessions |
List sessions |
GET |
/api/session/{session_id} |
Retrieve a session |
GET |
/api/session/{session_id}/history |
Retrieve session history |
PATCH |
/api/session/{session_id} |
Update a session |
DELETE |
/api/session/{session_id} |
Delete a session |
Source: rest_api/package/app/api/session.py
Session operations may access or modify user-associated data. Verify ownership checks, input validation, and side effects at the route level.
Administration¶
| Method | Path | Purpose |
|---|---|---|
GET |
/api/admin/users |
List users |
PUT |
/api/admin/users/{user_id}/role |
Update a user's role |
DELETE |
/api/admin/users/{user_id} |
Delete a user |
Source: rest_api/package/app/api/admin.py
The administration router declares a JWTBearer dependency. That dependency alone does not establish that role-based authorization is correctly enforced for every operation.
Retrieval-augmented generation (RAG)¶
| Method | Path | Purpose |
|---|---|---|
POST |
/api/rag/ingest |
Submit content for ingestion |
POST |
/api/rag/ingest/file |
Submit a file for ingestion |
POST |
/api/rag/search |
Search indexed content |
GET |
/api/rag/documents |
List documents |
DELETE |
/api/rag/document/{doc_id} |
Delete a document |
POST |
/api/rag/document/{doc_id}/publish |
Publish a document |
Source: rest_api/package/app/api/rag.py
Ingestion, deletion, and publication are state-changing operations. Verify request validation, authorization, storage effects, and error behaviour in the implementation.
Chat and gateway proxying¶
The gateway contains a chat router and registers a catch-all proxy router after the other routers. The existence of a chat router does not prove that it directly implements every chat endpoint.
The separate chat service registers its router under /api/chat-svc, including a streaming route at /stream.
Relevant source locations:
rest_api/package/app/api/chat.pyrest_api/package/app/api/proxy.pyrest_api/package/app/main.pychat/package/app/handlers/chat_handlers.pychat/package/app/main.py
The final externally used chat URL depends on gateway proxy routing and deployment configuration. Confirm the effective route before publishing a client-facing example.
Integrations API surface¶
The integrations service registers integration and webhook routers under /api/integrations-svc. OAuth and MCP routers are registered separately.
The following endpoint families were identified in integrations/package/app/handlers/integration_handlers.py. These entries describe the inventory found in source; they are not a complete request/response specification.
| Integration or function | Identified route families |
|---|---|
| Integration status | GET /ping, GET /status, PUT /connections/{plugin_name} |
| Jira | OAuth routes; project and issue reads; issue creation |
| Slack | OAuth routes; channel and history reads; message sending |
| Microsoft Teams | OAuth routes; teams, channels, messages, members, user information, and search; message sending; token retrieval |
| Gmail | OAuth routes; message, thread, inbox, search, labels, drafts, statistics, attachments, and message mutations |
| Google Calendar | OAuth routes; event listing, creation, and deletion |
| Google Drive | OAuth routes; file listing, retrieval, search, creation, update, copy, move, and permission management |
Consult the relevant integration documentation for details. Verify exact paths, parameters, payloads, and response schemas against the handlers and provider clients. Do not infer the full external URL for a route family from this table alone.
Webhooks¶
The source contains webhook routes for Jira, Slack, and Microsoft Teams:
POST /api/integrations-svc/webhooks/jiraPOST /api/integrations-svc/webhooks/slackPOST /api/integrations-svc/webhooks/teams
Source: integrations/package/app/handlers/webhook_handlers.py
Webhook signature verification, request authenticity, replay protection, and event handling must be reviewed and tested independently.
OAuth and MCP endpoints¶
The integrations service defines OAuth- and MCP-related routes, including:
| Method | Path | Area |
|---|---|---|
GET |
/.well-known/oauth-authorization-server |
OAuth metadata |
GET |
/.well-known/oauth-protected-resource |
Protected-resource metadata |
GET |
/oauth/authorize |
Authorization flow |
POST |
/oauth/token |
Token exchange |
GET |
/oauth/google/callback |
Google OAuth callback |
POST |
/mcp |
MCP endpoint |
GET |
/mcp/health |
MCP health check |
These routes are registered separately from the /api/integrations-svc integration and webhook routers. Their actual accessibility depends on service exposure and deployment routing.
Relevant source locations:
integrations/package/app/mcp/oauth.pyintegrations/package/app/mcp/server.pyintegrations/package/app/main.py
Verify security per endpoint
Do not assume that OAuth, MCP, webhook, integration, and gateway endpoints share the same authentication model. Verify each endpoint's security requirements and exposure individually.
Authentication and authorization¶
Authentication and authorization requirements must be documented per route; they should not be inferred from the service name or HTTP method.
The inspected gateway source includes a JWTBearer dependency on the logout, profile, session, administration, and RAG routers. Registration, login, and refresh serve different authentication purposes.
Integration handlers also use user-identifying headers, internal-service credentials, OAuth state, and provider tokens in different flows. The presence of a header or token lookup is not, on its own, evidence that user identity and resource ownership are securely enforced.
For each endpoint, verify and document:
- Whether authentication is required.
- The accepted credential or token type.
- How the authenticated user is identified.
- Whether resource-level authorization is checked.
- Whether internal-service authentication is required.
- Whether provider credentials are resolved for the correct user.
- How expired, revoked, or invalid credentials are handled.
Credential handling
Never place real access tokens, refresh tokens, client secrets, API keys, or other credentials in documentation, logs, examples, or issue reports. Use clearly fictional placeholders in sample requests.
Read-only operating requirement¶
WhiteLotusAI's current documentation work treats read-only integration behaviour as a requirement that must be verified against the application.
The source inventory contains state-changing route families, including message sending, issue creation, calendar event creation and deletion, file modification, permission changes, email mutations, and document management operations. Their presence in source is an audit finding; it does not prove that every operation is exposed to every user or has been exercised successfully.
Read-only enforcement requires server-side evidence
Verification must establish that prohibited write operations are blocked server-side across all applicable entry points. Hiding a frontend action, relying on model confirmation, or omitting a tool from the user interface is not sufficient evidence of a system-wide restriction.
Read the Read-Only Integration Policy
Interactive API documentation¶
The gateway configures Swagger UI at /api/docs when DEVELOP is enabled. The inspected source disables the gateway Swagger UI URL otherwise. The chat and integrations services similarly condition their /docs routes on development configuration.
Availability depends on the running service, configuration, and network exposure. Do not assume development API documentation is available or should be exposed publicly in production.
Use a generated schema as a verification aid, not as a substitute for reviewing authentication, authorization, side effects, and observed runtime behaviour.
Errors and validation¶
The gateway registers exception handlers for HTTP exceptions, request-validation errors, custom HTTP exceptions, and unexpected exceptions. Its application configuration also declares response documentation for HTTP 404 and validation 422 responses.
This does not establish that every service returns the same error format or that all error responses are safe and consistent.
For each endpoint, record:
- Expected success status codes and response bodies.
- Validation failures and their status codes.
- Authentication and authorization failures.
- Not-found and conflict behaviour, where applicable.
- Provider API errors and timeouts.
- Whether internal exception details or sensitive values could be exposed.
Compatibility and versioning¶
The inspected source snapshot does not establish a single, consistent versioning contract for all gateway and integration routes. Do not assume every endpoint is versioned or that backward compatibility is guaranteed.
When an API change is introduced, document the affected routes, request and response changes, compatibility impact, migration requirements, and any deprecation period that is actually implemented.
Open documentation and verification findings¶
The following findings remain open until supported by source review, tests, or runtime evidence.
| ID | Finding | Evidence needed |
|---|---|---|
| API-01 | Full request and response contracts are not documented for every route. | Route handlers, validation models, generated schema, and tests |
| API-02 | Authentication and resource-level authorization have not been independently verified for every endpoint. | Dependency review, ownership checks, and authorization tests |
| API-03 | The externally reachable gateway and service route map requires deployment-level confirmation. | Proxy configuration and deployed route checks |
| API-04 | Read-only enforcement must be verified across all integration entry points. | Server-side allowlist review and negative tests for write operations |
| API-05 | Webhook authenticity and replay protection require verification. | Signature-validation code and webhook tests |
| API-06 | Error formats and sensitive-data handling require cross-service verification. | Exception handlers, provider error paths, and response tests |
| API-07 | API versioning and compatibility guarantees are not established by this inventory. | Release policy and implementation evidence |
These are documentation and audit findings, not application changes performed by this page.
Source locations¶
The primary source locations used for this overview are listed below.
Gateway¶
rest_api/package/app/main.pyrest_api/package/app/settings.pyrest_api/package/app/api/auth.pyrest_api/package/app/api/profile.pyrest_api/package/app/api/session.pyrest_api/package/app/api/admin.pyrest_api/package/app/api/rag.pyrest_api/package/app/api/chat.pyrest_api/package/app/api/proxy.py
Integrations¶
integrations/package/app/main.pyintegrations/package/app/handlers/integration_handlers.pyintegrations/package/app/handlers/webhook_handlers.pyintegrations/package/app/mcp/oauth.pyintegrations/package/app/mcp/server.py
Chat¶
chat/package/app/main.pychat/package/app/handlers/chat_handlers.py
Verification status¶
This page is a source-derived API overview. It is not a complete OpenAPI contract, a successful runtime test report, or a security certification.
Update this reference as endpoint implementations, route exposure, authentication requirements, and tests are verified. Keep unverified claims explicitly labelled until supporting evidence is available.