Usage metrics, webhook delivery stats, and execution performance analytics

Analytics


The analytics endpoints expose aggregated platform metrics — API usage, webhook delivery health, and pipeline execution statistics. All endpoints accept a days parameter to control the lookback window.


Endpoints

Usage Analytics

GET /v1/analytics/usage

Requires scope: read. Returns aggregated usage statistics for the specified period.

Query parameters:

tenant_idstring

Filter to a specific tenant. Returns platform-wide stats when empty.

daysnumber

Lookback window in days. Default 30, min 1, max 365.

Response (200): UsageStats object.

total_casesnumber
Total cases created in the period.
completed_casesnumber
Cases that reached completed status.
review_casesnumber
Cases that ended in review status.
denied_casesnumber
Cases that ended in denied status.
failed_casesnumber
Cases that ended in failed status.
total_documentsnumber
Total documents uploaded across all cases.
documents_by_typeobject
Breakdown: { document_type: count }.
total_executionsnumber
Total pipeline executions run.
avg_case_duration_msnumber
Average time from case creation to completion.

Example request:

GET /v1/analytics/usage?tenant_id=acme-corp&days=7

Webhook Analytics

GET /v1/analytics/webhooks

Requires scope: read. Returns webhook delivery health statistics — delivery success rates, retry counts, and failure breakdown.

Query parameters:

daysnumber

Lookback window in days. Default 30, min 1, max 365.

Response (200): Webhook stats object (schema varies — raw DB aggregation).

Typical fields include:

total_sentnumber
Total webhook attempts.
deliverednumber
Successfully delivered (HTTP 2xx from target).
failednumber
Failed after all retries.
pendingnumber
Enqueued but not yet attempted.
avg_delivery_msnumber
Average delivery latency.

Execution Analytics

GET /v1/analytics/executions

Requires scope: read. Returns pipeline and agent execution performance statistics.

Query parameters:

tenant_idstring

Filter to a specific tenant.

daysnumber

Lookback window in days. Default 30, min 1, max 365.

Response (200): ExecutionStats object.

total_executionsnumber
Total executions in the period.
completednumber
Executions that completed successfully.
failednumber
Executions that failed.
runningnumber
Executions currently in progress.
avg_duration_msnumber
Average wall-clock execution time.
p95_duration_msnumber
95th percentile execution time.
executions_by_contextobject
Breakdown: { context_id: count }.

Example request:

GET /v1/analytics/executions?tenant_id=acme-corp&days=30