Monitoring API
Monitor AI token usage, detect anomalies, track model drift, analyze sentiment, and manage scheduled reports. Includes both team-scoped endpoints and admin-level rate-limit monitoring.
Team Monitoring Endpoints
These endpoints are available to team members and provide visibility into AI usage and alert management.
Get Monitoring Config
/api/monitoring/teams/:teamId/configGet the monitoring configuration for a team
{
"anomalyDetectionEnabled": true,
"driftAlertEnabled": true,
"sentimentTrackingEnabled": false,
"alertThresholds": {
"tokenUsageSpike": 2.0,
"errorRateThreshold": 0.15,
"latencyThreshold": 5000
},
"notificationChannels": ["email", "slack"]
}Update Monitoring Config
/api/monitoring/teams/:teamId/configUpdate the monitoring configuration
Accepts the same fields as the GET response. Only provided fields are updated.
Get Token Usage
/api/monitoring/teams/:teamId/token-usageGet aggregated token usage for a team
| Parameter | Type | Required | Description |
|---|---|---|---|
from | ISO 8601 | No | Start date (default: 30 days ago) |
to | ISO 8601 | No | End date (default: now) |
{
"totalInputTokens": 1250000,
"totalOutputTokens": 890000,
"totalCost": 12.45,
"period": {
"from": "2026-01-17T00:00:00.000Z",
"to": "2026-02-17T00:00:00.000Z"
}
}Get Daily Usage
/api/monitoring/teams/:teamId/token-usage/dailyGet daily token usage breakdown
{
"days": [
{
"date": "2026-02-17",
"inputTokens": 45000,
"outputTokens": 32000,
"cost": 0.42,
"executionCount": 128
}
]
}Get Usage by Model
/api/monitoring/teams/:teamId/token-usage/by-modelGet token usage broken down by AI model
{
"models": [
{
"model": "gpt-4o",
"inputTokens": 800000,
"outputTokens": 600000,
"cost": 8.40,
"executionCount": 320
},
{
"model": "claude-sonnet-4-20250514",
"inputTokens": 450000,
"outputTokens": 290000,
"cost": 4.05,
"executionCount": 180
}
]
}Bulk Acknowledge Alerts
/api/monitoring/teams/:teamId/alerts/bulk-acknowledgeAcknowledge multiple anomaly, drift, or sentiment alerts at once
| Field | Type | Required | Description |
|---|---|---|---|
alertIds | UUID[] | Yes | Array of alert IDs to acknowledge |
type | string | Yes | Alert type: ANOMALY, DRIFT, or SENTIMENT |
{
"alertIds": ["uuid-1", "uuid-2", "uuid-3"],
"type": "ANOMALY"
}{
"acknowledged": 3,
"message": "Alerts acknowledged successfully"
}Export Monitoring Data
/api/monitoring/teams/:teamId/exportExport monitoring data as CSV or JSON
| Parameter | Type | Required | Description |
|---|---|---|---|
format | string | No | Export format: csv or json (default: json) |
from | ISO 8601 | No | Start date |
to | ISO 8601 | No | End date |
Scheduled Reports
/api/monitoring/teams/:teamId/scheduled-reportsList all scheduled monitoring reports
/api/monitoring/teams/:teamId/scheduled-reportsCreate a new scheduled report
/api/monitoring/teams/:teamId/scheduled-reports/:idUpdate a scheduled report
/api/monitoring/teams/:teamId/scheduled-reports/:idDelete a scheduled report
| Field | Type | Required | Description |
|---|---|---|---|
name | string | Yes | Report name |
schedule | string | Yes | Cron expression (5-field Unix format) |
recipients | string[] | Yes | Email addresses to send the report to |
metrics | string[] | Yes | Metrics to include (token_usage, anomalies, drift, sentiment) |
{
"name": "Weekly AI Usage Report",
"schedule": "0 9 * * 1",
"recipients": ["team@example.com"],
"metrics": ["token_usage", "anomalies"]
}Error Codes
| Status | Meaning |
|---|---|
400 | Invalid query parameters or date range |
403 | Insufficient permissions (team or admin access required) |
404 | Team or report not found |