searchAiAlarmMessageByPage: Search alarm messages by keyword
searchAiAlarmMessageByPage: Search alarm messages by keyword
What it does
Semantic search over historical AI smart alarms on one or more channels using a natural-language keyword. The channel must have an active AI Insight or AI Insight cloud storage package.
Request URL
POST https://openapi-[DataCenter].easy4ip.com/openapi/searchAiAlarmMessageByPage
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 |
| channelIds | Array | Yes | Channel IDs as integers or numeric strings, e.g. [0], [0,1] Allowed values: Non-empty JSON array. |
| productId | String | No | Thing-model product ID; required for sub-device messages |
| nextIndexId | String | No | Pagination cursor. Omit on first page; required when fetching the next page |
| beginTime | String | Conditional | Required on first page; optional on later pages (server reuses first-page filters) Allowed values: yyyy-MM-dd HH:mm:ss. |
| endTime | String | Conditional | Required on first page; must be ≥ beginTime; optional on later pages Allowed values: yyyy-MM-dd HH:mm:ss. |
| searchContent | String | Conditional | Search phrase, e.g. “man in black jacket”. Required on first page; optional on later pages Allowed values: 1–50 characters. |
| pageSize | String / Integer | No | Page size Default 32. Allowed values: 1–32. |
| sortType | String / Integer | No | 0 similarity desc; 1 time asc; 2 time desc |
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",
"channelIds": [
0
],
"beginTime": "2020-10-22 00:00:00",
"endTime": "2020-10-22 23:59:59",
"searchContent": "man in black jacket",
"pageSize": "10",
"sortType": "0"
}
}
Return data fields
| Field name | Field type | Field description |
|---|---|---|
| nextIndexId | Long / String | Cursor for the next page; omit on the first request; pass back on later pages. May be empty when no more results |
| alarms | Array | Matched alarm list |
| alarms[].alarmId | String | Message ID |
| alarms[].channelName | String | Channel name |
| alarms[].time | Long | Alarm Unix timestamp (seconds) |
| alarms[].localDate | String | Device-local time yyyy-MM-dd HH:mm:ss |
| alarms[].alarmType | String | Alarm message type id (e.g. videoMotion, alarmLocal; same meaning as request msgType in getAlarmMessageById) |
| alarms[].thumbUrl | String | Thumbnail URL |
| alarms[].deviceId | String | Device serial number |
| alarms[].picurlArray | String[] | Alarm image URLs |
| alarms[].channelId | String | Channel ID |
| alarms[].token | String | Message token (cloud playback, etc.) |
| alarms[].productId | String | Thing-model product ID (may be omitted for non–thing-model devices) |
| alarms[].refId | String | Thing-model event refId (IoT; may be omitted) |
| alarms[].labelType | String | Alarm category tags such as humanAlarm, faceAlarm, carAlarm, abSoundAlarm, motionAlarm, petAlarm, other; comma-separated if multiple |
| alarms[].utcTime | Long | Platform receive time (seconds) |
| alarms[].encryptSecret | String | Image decryption secret (IoT; omitted when not applicable) |
| alarms[].aiCopyWriting | String | AI scene description (~10–20 chars) |
| alarms[].securityRiskLevel | Integer | AI risk level 1–10 |
| alarms[].aiTag | String[] | AI tags (person, vehicle, pet, package, etc.) |
| alarms[].hitFeatureObjs | Array | Feature hit list. Present only when there is a hit; omitted otherwise. Each item has only hitType and featureId |
| alarms[].hitFeatureObjs[].hitType | String | Hit type, e.g. face, figure |
| alarms[].hitFeatureObjs[].featureId | String | Feature ID |
| alarms[].resemblance | Double | Keyword similarity 0–1 |
| alarms[].message | Object | Raw device payload (IoT; omitted when absent) |
| alarms[].feedback | Array | Detection / accuracy feedback list (omitted when empty) |
| alarms[].feedback[].type | String | Detection type: 1 human; 2 face; 3 LLM |
| alarms[].feedback[].result | String | Accuracy: 0 inaccurate; 1 accurate |
Sample output
{
"result": {
"msg": "Success.",
"code": "0",
"data": {
"alarms": [
{
"alarmId": "1726360834259136",
"channelName": "TP1S-1842",
"localDate": "2020-10-22 15:14:02",
"alarmType": "videoMotion",
"thumbUrl": "https://openapi.example.com/placeholder/alarm-image.jpg",
"deviceId": "TESTQWERXXXX",
"picurlArray": [
"https://openapi.example.com/placeholder/alarm-image.jpg"
],
"channelId": "0",
"token": "07540ab39e82488490b232977c333c9e",
"time": 1603353242,
"aiCopyWriting": "A man in black rode past the store",
"securityRiskLevel": 1,
"aiTag": [
"person",
"vehicle"
],
"hitFeatureObjs": [
{ "hitType": "face", "featureId": "772812679109971968" }
],
"resemblance": 0.1783357752858043,
"feedback": [
{
"type": "3",
"result": "1"
}
]
}
],
"nextIndexId": 1726360340019392
}
},
"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} for each channel ID in channelIds. See Permission codes.
This API may also return OP1026 (too many concurrent requests for the same device), DV1107 (invalid or expired pagination cursor; restart from the first page), or ST1018 (AI Insight or AI Insight cloud storage is not enabled). See Error codes and Capability errors.
