Reports API 🟡 BETA

The Reports API provides endpoints for generating, managing, and exporting various types of reports from bot data and analytics.

Status: Roadmap

This API is on the development roadmap. The endpoints documented below represent the planned interface design.

Base URL

http://localhost:9000/api/v1/reports

Authentication

Uses the standard botserver authentication mechanism with appropriate role-based permissions.

Endpoints

Report Generation

MethodEndpointDescription
POST/api/v1/reports/generateGenerate a new report
GET/api/v1/reports/{report_id}/statusGet report generation status
GET/api/v1/reports/{report_id}Get report metadata

Report Management

MethodEndpointDescription
GET/api/v1/reportsList all reports
GET/api/v1/reports/{report_id}/downloadDownload report file
DELETE/api/v1/reports/{report_id}Delete a report

Report Scheduling

MethodEndpointDescription
POST/api/v1/reports/scheduleCreate scheduled report
GET/api/v1/reports/scheduleList scheduled reports
PUT/api/v1/reports/schedule/{schedule_id}Update schedule
DELETE/api/v1/reports/schedule/{schedule_id}Delete schedule

Report Templates

MethodEndpointDescription
GET/api/v1/reports/templatesList available templates
POST/api/v1/reports/templatesCreate custom template
GET/api/v1/reports/templates/{template_id}Get template details

Report Types

TypeDescription
usageBot usage and activity metrics
conversationsConversation analysis and statistics
performanceSystem performance metrics
complianceCompliance and audit reports
customCustom report with user-defined metrics

Export Formats

FormatExtensionDescription
PDF.pdfFormatted document with charts
CSV.csvRaw data export
Excel.xlsxSpreadsheet with multiple sheets
JSON.jsonMachine-readable format
HTML.htmlWeb-viewable format

Request Examples

Generate Usage Report

report_config = NEW OBJECT
report_config.type = "usage"
report_config.start_date = "2025-01-01"
report_config.end_date = "2025-01-31"
report_config.format = "pdf"
report_config.include_charts = true

result = POST "/api/v1/reports/generate", report_config
TALK "Report ID: " + result.report_id

Check Report Status

status = GET "/api/v1/reports/rpt-123/status"

IF status.state = "completed" THEN
    TALK "Report ready for download"
    url = GET "/api/v1/reports/rpt-123/download"
ELSE
    TALK "Report generation: " + status.progress + "%"
END IF

Schedule Weekly Report

schedule = NEW OBJECT
schedule.type = "conversations"
schedule.format = "pdf"
schedule.cron = "0 8 * * 1"
schedule.recipients = ["manager@company.com"]
schedule.timezone = "America/New_York"

result = POST "/api/v1/reports/schedule", schedule
TALK "Scheduled report: " + result.schedule_id

List Available Templates

templates = GET "/api/v1/reports/templates"
FOR EACH template IN templates
    TALK template.name + " - " + template.description
NEXT

Generate Custom Report

report = NEW OBJECT
report.type = "custom"
report.title = "Monthly Executive Summary"
report.sections = NEW ARRAY
report.sections.ADD({"type": "usage_summary"})
report.sections.ADD({"type": "top_conversations"})
report.sections.ADD({"type": "satisfaction_scores"})
report.format = "pdf"

result = POST "/api/v1/reports/generate", report

Response Codes

CodeDescription
200Success
201Report created
202Report generation started
400Bad Request (invalid parameters)
401Unauthorized
403Forbidden
404Report not found
500Internal Server Error

Query Parameters

Filtering

ParameterTypeDescription
typeStringFilter by report type
statusStringFilter by status (pending, completed, failed)
created_afterDateTimeReports created after date
created_beforeDateTimeReports created before date

Pagination

ParameterTypeDescription
limitIntegerNumber of results (default: 20, max: 100)
offsetIntegerPagination offset
sortStringSort field (created_at, name, type)
orderStringSort order (asc, desc)

Required Permissions

OperationRequired Role
Generate reportreport_creator or admin
View reportsreport_viewer or higher
Download reportsreport_viewer or higher
Delete reportsreport_admin or admin
Manage schedulesreport_admin or admin
Manage templatesreport_admin or admin