Analytics API
Access platform analytics, usage metrics, and generate reports. See Analytics for dashboard and concepts.
Get Analytics Overview
GET /api/analyticsGet an overview of platform analytics.
Query Parameters
| Parameter | Default | Description |
|---|---|---|
period | 30d | Time period: 7d, 30d, 90d, 1y |
knowledge_base_id | - | Filter by knowledge base |
Response
{
"summary": {
"documents_processed": 1250,
"extractions_run": 850,
"chat_queries": 3200,
"total_pages": 15000,
"total_credits_used": 25000
},
"trends": {
"documents": {
"current": 150,
"previous": 120,
"change_percent": 25
},
"extractions": {
"current": 100,
"previous": 80,
"change_percent": 25
}
},
"period": {
"start": "2024-01-01T00:00:00Z",
"end": "2024-01-31T23:59:59Z"
}
}Analytics Drilldown
GET /api/analytics/drilldownGet detailed analytics breakdown.
Query Parameters
| Parameter | Description |
|---|---|
metric | Metric to drill down: documents, extractions, chat |
dimension | Dimension: status, file_type, schema |
period | Time period |
Response
{
"metric": "documents",
"dimension": "file_type",
"data": [
{ "value": "pdf", "count": 800, "percentage": 64 },
{ "value": "image", "count": 250, "percentage": 20 },
{ "value": "spreadsheet", "count": 150, "percentage": 12 },
{ "value": "text", "count": 50, "percentage": 4 }
]
}Query Analytics
GET /api/analytics/queryRun custom analytics queries.
Query Parameters
| Parameter | Description |
|---|---|
metrics | Comma-separated metrics |
dimensions | Comma-separated dimensions |
filters | JSON filters |
period | Time period |
aggregation | Aggregation: daily, weekly, monthly |
Response
{
"data": [
{
"date": "2024-01-01",
"documents_processed": 50,
"extractions_run": 30,
"avg_processing_time_ms": 2500
},
{
"date": "2024-01-02",
"documents_processed": 45,
"extractions_run": 35,
"avg_processing_time_ms": 2300
}
],
"totals": {
"documents_processed": 1250,
"extractions_run": 850
}
}Real-time Analytics
GET /api/analytics/realtimeGet real-time processing statistics.
Response
{
"active_jobs": 5,
"queue_depth": 12,
"processing_rate": {
"documents_per_minute": 8,
"pages_per_minute": 45
},
"recent_activity": [
{
"type": "document_processed",
"document_id": "doc-uuid",
"timestamp": "2024-01-15T10:30:00Z"
}
]
}Export Analytics
GET /api/analytics/exportExport analytics data.
Query Parameters
| Parameter | Default | Options |
|---|---|---|
format | csv | csv, json, xlsx |
period | 30d | Time period |
metrics | all | Specific metrics |
Response
Returns file download with appropriate content type.
Analytics Reports
GET /api/analytics/reportsGet scheduled and generated reports.
Response
{
"reports": [
{
"id": "report-uuid",
"name": "Weekly Usage Report",
"type": "usage",
"schedule": "weekly",
"last_generated": "2024-01-14T00:00:00Z",
"next_run": "2024-01-21T00:00:00Z"
}
]
}Available Metrics
Usage Metrics
| Metric | Description |
|---|---|
documents_processed | Total documents processed |
pages_processed | Total pages processed |
extractions_run | Number of extractions |
chat_queries | Chat interactions |
credits_used | Credits consumed |
Quality Metrics
| Metric | Description |
|---|---|
avg_extraction_confidence | Average extraction confidence |
avg_chat_confidence | Average chat response confidence |
extraction_accuracy | Accuracy vs ground truth |
Performance Metrics
| Metric | Description |
|---|---|
avg_processing_time_ms | Average document processing time |
avg_extraction_time_ms | Average extraction time |
avg_chat_response_time_ms | Average chat response time |
success_rate | Processing success rate |
Cost Metrics
| Metric | Description |
|---|---|
total_credits | Total credits used |
credits_by_operation | Credits by operation type |
estimated_cost | Estimated cost |
See also: Analytics.
Last updated on