getAlarmMessageStatistics: Daily alarm statistics and safety report
getAlarmMessageStatistics: Daily alarm statistics and safety report
What it does
Returns per-day alarm counts and optional AI risk / time-window analysis (daily safety brief) for a device channel. Reports are generated only when AI Insight or AI Insight cloud storage is active on the channel.
Request URL
POST https://openapi-[DataCenter].easy4ip.com/openapi/getAlarmMessageStatistics
Minimum permission
Administrator or sub-account token. See Permission codes.
Request parameters
| Parameter name | Parameter type | Required or not | Parameter description |
|---|---|---|---|
| token | String | Yes | Administrator or sub-account accessToken |
| deviceId | String | Yes | Device serial number |
| channelId | String | Yes | Channel ID |
| startDay | String | Yes | Start date Allowed values: yyyyMMdd. |
| endDay | String | Yes | End date; must be ≥ startDay Allowed values: yyyyMMdd. |
| productId | String | No | Thing-model product ID (optional) |
| multiView | Integer | No | Lens count on multi-sensor devices, e.g. 2 for dual-lens; omit for single-lens Default 1. Allowed values: ≥1. |
| aiStatisticsAnalysisEnable | Boolean | No | Set true to include AI time/label analysis when Insight or Insight cloud storage is active Default false. |
| msgAnalysis | Object | No | Custom AI analysis (see nested rows) |
| msgAnalysis.analysisHourInterval | Integer | No | Bucket size in hours, e.g. 2 |
| msgAnalysis.labelTime | Array | No | Top events per label; items: labelType, count, sortType (desc/asc) |
| msgAnalysis.labelTime[].labelType | String | No | Label type Allowed values: e.g. humanAlarm. |
| msgAnalysis.labelTime[].count | Integer / String | No | Max items to return |
| msgAnalysis.labelTime[].sortType | String | No | Sort order Allowed values: desc, asc. |
| riskStatement | Array | No | Risk hour windows; items: startHour, endHour (e.g. 00, 05) |
| riskStatement[].startHour | String | No | Start hour |
| riskStatement[].endHour | String | No | End hour |
Common request fields and signing: Signing conventions and Common request payload.
Sample input
{
"id": "9f05aa70-91fd-4d35-8b06-cd2ece55346b",
"system": {
"ver": "1.0",
"appId": "lcdxxxxxxxxx",
"sign": "xjhCQBoJ9hRDsCjyDcHjtDNzRZ3ZJezcawsfWeiaoxU=",
"time": 1603350704,
"nonce": "245db3c7-1689-4893-ac30-cbd7a9d8d153"
},
"params": {
"token": "<yourAccessToken>",
"deviceId": "TESTQWERXXXX",
"channelId": "0",
"startDay": "20260427",
"endDay": "20260428",
"aiStatisticsAnalysisEnable": true,
"msgAnalysis": {
"analysisHourInterval": 2,
"labelTime": [
{
"labelType": "petAlarm",
"count": 10,
"sortType": "desc"
}
]
},
"riskStatement": [
{
"startHour": "00",
"endHour": "05"
}
]
}
}
Return data fields
| Field name | Field type | Field description |
|---|---|---|
| aiStatisticsAnalysisResult | Array | Per-day AI analysis |
| aiStatisticsAnalysisResult[].analysisDay | String | Date yyyyMMdd |
| aiStatisticsAnalysisResult[].riskStatementInfo | Array | Risk window stats |
| aiStatisticsAnalysisResult[].riskStatementInfo[].startHour | String | Start hour |
| aiStatisticsAnalysisResult[].riskStatementInfo[].endHour | String | End hour |
| aiStatisticsAnalysisResult[].riskStatementInfo[].count | String / Integer | Event count |
| aiStatisticsAnalysisResult[].riskStatementInfo[].riskEventDoc | String | AI risk description |
| aiStatisticsAnalysisResult[].msgAnalysisInfo | Array | Label time distribution |
| aiStatisticsAnalysisResult[].msgAnalysisInfo[].labelType | String | e.g. humanAlarm |
| aiStatisticsAnalysisResult[].msgAnalysisInfo[].alarmDateTimeArr | String[] | Sample alarm times |
| aiStatisticsAnalysisResult[].msgAnalysisInfo[].timeDistribute | Integer[] | Counts per bucket |
| statistics | Array | Daily rollups |
| statistics[].date | String | Date yyyyMMdd |
| statistics[].totalcount | Integer | Total alarms that day |
| statistics[].bigModelStatisticsLabels | Array | AI label summary |
| statistics[].humanAlarm | Integer | Person detection count |
| statistics[].carAlarm | Integer | Vehicle detection count |
| statistics[].petAlarm | Integer | Pet detection count |
| statistics[].packageAlarm | Integer | Package detection count |
| statistics[].faceAlarm | Integer | Face detection count |
| statistics[].motionAlarm | Integer | Motion detection count |
| statistics[].other | Integer | Other events |
| statistics[].abSoundAlarm | Integer | Abnormal sound |
| statistics[].peopleFallAlarm | Integer | Fall detection |
| statistics[].suspectedPeopleFallAlarm | Integer | Suspected fall |
| statistics[].voiceHelpAlarm | Integer | Voice help |
| statistics[].stayoverAlarm | Integer | Loitering |
| statistics[].cryingAlarm | Integer | Crying |
| statistics[].callAlarm | Integer | Call events |
Sample output
{
"result": {
"msg": "Success.",
"code": "0",
"data": {
"aiStatisticsAnalysisResult": [
{
"analysisDay": "20250227",
"riskStatementInfo": [
{
"startHour": "00",
"endHour": "05",
"count": 10,
"riskEventDoc": "A person in a dark coat stood with their back to the camera"
}
],
"msgAnalysisInfo": [
{
"labelType": "humanAlarm",
"alarmDateTimeArr": [
"2025-02-27 08:15:00"
],
"timeDistribute": [
0,
0,
0,
5,
0,
2
]
}
]
}
],
"statistics": [
{
"bigModelStatisticsLabels": [],
"totalcount": 20,
"date": "20260327",
"other": 5,
"abSoundAlarm": 0,
"petAlarm": 10,
"carAlarm": 0,
"faceAlarm": 2,
"motionAlarm": 3,
"humanAlarm": 0,
"peopleFallAlarm": 0,
"suspectedPeopleFallAlarm": 0,
"packageAlarm": 0,
"voiceHelpAlarm": 0,
"stayoverAlarm": 0,
"cryingAlarm": 0,
"callAlarm": 0
}
]
}
},
"id": "9f05aa70-91fd-4d35-8b06-cd2ece55346b"
}
Error codes
See Error codes and Capability errors.
Gateway and auth (SN / TK / OP)
| Code | Meaning | Next step |
|---|---|---|
SN1001 | Signature error | Check sign per Signature |
TK1002 | Token invalid or expired | Refresh accessToken |
OP1002 | Missing required parameter | Add required fields |
OP1003 | Invalid parameter | Match this page’s parameter table |
OP1009 | Permission denied | Check token and device bind/share grants |
OP1013 | Total call limit exceeded | Reduce call rate |
OP1014 | Daily per-interface limit exceeded | See Interface call limits |
DV1007 | Device offline | Wait until the device is online |
See Error codes · OP/SN/TK for the full catalog.
Sub-accounts (SUB)
| Code | Meaning | Next step |
|---|---|---|
SUB1001–SUB1002 | Sub-account lacks API permission | Update policy via addPolicy |
SUB1005 | Sub-account token expired | Refresh subAccountToken |
SUB1006 | No device grant for sub-account | Check Resource and device serial |
SUB1008 | Sub-account not bound to app | Create and bind the sub-account first |
See Error codes · SUB.
Alarms and messages (DV20xx)
| Code | Meaning | Next step |
|---|---|---|
DV2001 | Message not found | Verify alarm id |
DV2002 | Message query failed | Check time range and permissions |
Notes
Sub-account tokens need at least Permission Alarm and Resource cam:{deviceId}:{channelId}. See Permission codes.
