---
title: "getMonitoringStatsV2"
method: POST
path: "/v2/integrations/{integrationId}/monitoring/stats"
tags: ["monitoring", "integrations"]
---

# getMonitoringStatsV2

`POST /v2/integrations/{integrationId}/monitoring/stats`

Get aggregated statistics from the unified erp_monitoring_v2 table.
Returns combined metrics for all event types with optional breakdowns.

## Path parameters

- `integrationId` string, uuid, required

## Request body

- GetMonitoringStatsV2Request
  - `from_date` string, date-time — Start of the time range
  - `to_date` string, date-time — End of the time range
  - `use_case_type` 'inbound' | 'outbound' | 'file_proxy' | 'managed_call' | 'secure_proxy' — Filter stats by a single use case type
  - `use_case_types` string[] — Filter stats to this set of use case types (matches any). Takes precedence over `use_case_type` when both are present. Used by the notification producers to scope alerts/digests to the integration's `monitoredUseCases`.
  - `group_by` 'use_case_id' | 'use_case_type' | 'level' | 'code' | 'date' — Field to group the breakdown by
  - `source` 'monitoring' | 'incoming' — Data source for the stats. "monitoring" (default) aggregates processed events from erp_monitoring_v2 — this counts every event produced throughout the processing tree (fan-out children, post-actions, relation resolutions, etc.). "incoming" counts only the initial inbound events actually received (distinct event_id from erp_incoming_events); only group_by=use_case_id is supported and status/level breakdown is not available for this source (success/error/warning/skipped counts are returned as 0).

## Response `200`

Monitoring statistics retrieved successfully

- MonitoringStatsV2
  - `total_events` integer, required — Total number of events in the period
  - `success_count` integer, required — Number of successful events
  - `error_count` integer, required — Number of error events
  - `warning_count` integer, required — Number of warning events
  - `skipped_count` integer, required — Number of skipped events
  - `ack_timeout_count` integer — Number of ACK_TIMEOUT events (acknowledgement timed out)
  - `success_rate` number, float — Success rate as percentage (0-100)
  - `last_error_at` string, date-time, nullable — Timestamp of the most recent error
  - `breakdown` object[] — Statistics breakdown by requested group_by field

## Other responses

- `400` — Bad request
- `401` — Unauthorized request
- `404` — Resource not found
- `500` — Internal Server Error

---

[API](https://skmtc.net/epilot/apis/integration-toolkit-api.md) · [All operations](https://skmtc.net/epilot/apis/integration-toolkit-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/epilot/integration-toolkit-api/revisions/c24837d75096/schema)
