AFASAsk API Reference

Complete API documentation for integrating AFASAsk's AI-powered data analysis into your applications

API Version: v1.0 | Backend: FastAPI

Base URL: http://localhost:8000 (development) or your deployed instance

Core Endpoints

Chat & Messaging

POST /send_message/{conversation_id}

Send a message and trigger pipeline processing

{
  "content": "What is the average donation amount in 2024?",
  "chatconfig_id": "default-config",
  "lastEventId": -1
}
POST /stop_pipeline/{conversation_id}

Stop a running pipeline

GET /active-pipelines-count

Get current active pipeline count (max 5 concurrent)

Application Pages

GET /
Main application page
GET /chat/{chatconfig_id}/{conversation_id}
Chat interface
GET /account
User account page
GET /settings
User settings page

Data Management

GET /viewtable/{table_name}

View table data with Tabulator.js interface

POST /save_object

Save object data with validation

POST /delete_row/{table_name}

Delete table row

PowerBI Integration

GET /powerbi
PowerBI main page
GET /powerbi/login
PowerBI OAuth login
GET /powerbi/status
Connection status
POST /activate_dashboard
Activate dashboard

Real-time WebSocket API

WebSocket Events

AFASAsk uses WebSocket for real-time communication during pipeline execution:

pipeline-complete-{conversation_id}

{
  "event": "pipeline-complete-{conversation_id}",
  "data": "complete"
}

browser-notification-{conversation_id}

{
  "event": "browser-notification-{conversation_id}",
  "data": "Your request is being processed!"
}

active-pipelines-update

{
  "event": "active-pipelines-update",
  "data": 3
}

Pipeline Queue System

Configuration

MAX_CONCURRENT_PIPELINES: 5
MAX_QUEUE_SIZE: 5
Status Messages:
  • • Normal: Processed immediately
  • • Queued: "Je vraag staat in de wachtrij"
  • • Rejected: "Systeem is momenteel druk bezet"

Chat Modes

analysis: Data-Analyst Mode (default)
default-agent: Agent-based approach
chat: Simple conversational interface
rag-chat: Retrieval-augmented generation
code-question: Code-related queries

Response Formats

Standard Response

{
  "status": "success|error",
  "data": {},
  "message": "Response message",
  "conversation_id": "uuid-string"
}

Agent Step Response

{
  "id": "step-uuid",
  "agent_id": "analysis-agent",
  "title": "Data Analysis",
  "reasoning": "Analysis logic...",
  "code": "SQL query...",
  "output_logs": "Results..."
}

Database Synchronization

Sync Endpoints

POST /start_manual_sync
Start manual database sync
POST /stop_sync
Stop database sync
POST /toggle_auto_sync
Toggle automatic sync
GET /sync_logs
Get synchronization logs

Error Handling

401 - Unauthorized

Authentication required - use one of the supported auth methods

429 - Too Many Requests

Pipeline queue is full (5 concurrent max)

403 - Forbidden

Insufficient permissions for requested resource

500 - Server Error

Internal server error, check logs or retry