2. API Reference
MAC exposes a RESTful API via FastAPI. All endpoints are prefixed with /api/
in the browser (Nginx strips the prefix before proxying to FastAPI).
Base URL: http://<server-ip>/api/
Authentication: Include the Authorization: Bearer <token> header on all
protected endpoints.
2.1. Authentication Endpoints
Method |
Endpoint |
Description |
|---|---|---|
|
|
Verify registration number + DOB for first-time sign-up |
|
|
Login with roll number/email + password |
|
|
Refresh an expired access token |
|
|
Create a new user account |
|
|
Get current user profile |
|
|
Update current user profile |
|
|
Change current user’s password |
|
|
Logout (blacklist token) |
2.1.1. Admin User Endpoints
Method |
Endpoint |
Description |
|---|---|---|
|
|
List all users (admin only) |
|
|
Create a new user (admin only) |
|
|
Update a user (admin only) |
|
|
Change user role (admin only) |
|
|
Toggle user active status (admin only) |
2.1.2. Registry Endpoints
Method |
Endpoint |
Description |
|---|---|---|
|
|
List all registry entries |
|
|
Add a single registry entry |
|
|
Bulk-add registry entries (JSON) |
|
|
Upload registry CSV file |
|
|
Delete a registry entry |
2.2. AI Query Endpoints
Method |
Endpoint |
Description |
|---|---|---|
|
|
Send a chat message (streaming or non-streaming) |
|
|
Text completion |
|
|
Generate text embeddings |
|
|
Rerank search results |
|
|
Speech-to-text transcription |
|
|
Text-to-speech synthesis |
|
|
List available AI models |
2.3. RAG Endpoints
Method |
Endpoint |
Description |
|---|---|---|
|
|
List RAG collections |
|
|
Create a new collection |
|
|
Upload document to collection |
|
|
Search within a collection |
2.4. Notebook Endpoints
Method |
Endpoint |
Description |
|---|---|---|
|
|
List user’s notebooks |
|
|
Create a new notebook |
|
|
Get notebook with cells |
|
|
Update notebook |
|
|
Delete a notebook |
|
|
WebSocket for code execution |
2.4.1. WebSocket Protocol (Notebooks)
// Client → Server
{ "type": "execute", "cell_id": "uuid", "code": "...", "language": "python" }
{ "type": "interrupt", "kernel_id": "..." }
{ "type": "ping" }
// Server → Client
{ "type": "status", "cell_id": "...", "execution_state": "busy|idle" }
{ "type": "stream", "cell_id": "...", "name": "stdout|stderr", "text": "..." }
{ "type": "error", "cell_id": "...", "ename": "...", "evalue": "...", "traceback": [] }
{ "type": "pong" }
2.5. Additional Endpoints
Router |
Prefix |
Description |
|---|---|---|
|
|
Model discovery, health checks, usage stats |
|
|
Web search via SearXNG |
|
|
Forum posts and answers |
|
|
File sharing upload/download |
|
|
Feature flag management |
|
|
Content safety rules |
|
|
System hardware metrics |
|
|
Network info and speed test |
|
|
Branches and sections |
|
|
Worker node management |
|
|
Cluster overview |
|
|
API key management |
|
|
Scoped API key management |
|
|
Usage logs and analytics |
|
|
User notifications |
|
|
System configuration |
|
|
First-boot setup |
2.6. Interactive API Documentation
MAC includes built-in interactive API documentation:
Swagger UI:
http://<server-ip>/docsReDoc:
http://<server-ip>/redoc
These are served directly by FastAPI and provide a complete, interactive reference for all API endpoints with request/response schemas.