botserver/docs/api/README.md
Rodrigo Rodriguez (Pragmatismo) d1301c9cd8 Add balanced documentation structure
Documentation organized with equilibrium:
- Small (50-100 lines): Index files
- Medium (250-400 lines): Guides
- Large (450-600 lines): Complete references

Structure:
- docs/api/ - REST endpoints, WebSocket
- docs/guides/ - Getting started, deployment, templates
- docs/reference/ - BASIC language, configuration, architecture

Updated README.md to point to new docs location.
2025-12-04 12:44:18 -03:00

2 KiB

API Reference

General Bots exposes a REST API and WebSocket interface for integration with external systems.

Base URL

http://localhost:8080/api

Authentication

All API requests require authentication via Bearer token:

curl -H "Authorization: Bearer <token>" \
     http://localhost:8080/api/sessions

Endpoints Overview

Endpoint Method Description
/api/sessions GET List active sessions
/api/sessions POST Create new session
/api/sessions/:id GET Get session details
/api/sessions/:id/messages POST Send message
/api/drive/* * File storage operations
/api/tasks/* * Task management
/api/email/* * Email operations
/api/calendar/* * Calendar/CalDAV
/api/meet/* * Video meetings
/api/kb/* * Knowledge base search
/api/analytics/* * Analytics dashboard

WebSocket

Real-time communication via WebSocket:

ws://localhost:8080/ws

Connection

const ws = new WebSocket('ws://localhost:8080/ws');
ws.onmessage = (event) => {
    const data = JSON.parse(event.data);
    console.log('Received:', data);
};

Message Format

{
    "type": "message",
    "session_id": "uuid",
    "content": "Hello bot",
    "timestamp": "2024-01-01T00:00:00Z"
}

Response Format

All responses follow a consistent structure:

Success

{
    "success": true,
    "data": { ... }
}

Error

{
    "success": false,
    "error": {
        "code": "NOT_FOUND",
        "message": "Resource not found"
    }
}

Rate Limiting

API requests are rate limited per IP:

Endpoint Type Requests/Second Burst
Standard API 100 200
Auth endpoints 10 20
LLM endpoints 5 10

Detailed Documentation