Get started
  • English
  • 简体中文
Official Site
Get started
  • English
  • 简体中文
Official Site
  • Get started
  • Concepts
  • Guides
  • Device capabilities & events
  • API reference
    • Public conventions
    • Development specification
    • accessToken: Get administrator token
    • API request example
    • Error codes
    • Interface call limits
    • Account docking
    • Device APIs
    • Device live broadcast
    • Push configuration
    • Cloud storage service
    • Resource pool quota
    • AI analysis
    • AI Insight
      • bindDeviceAiInsight: Enable AI Insight package
      • unbindDeviceAiInsight: Unbind AI Insight package
      • queryDeviceAiInsight: Query active AI Insight package
      • queryDeviceAiInsightList: List AI Insight packages on channel
      • queryAiInsightCount: Query AI Insight purchase quota
      • queryUnusedAiInsightList: List unused AI Insight packages
      • setDeviceAiInsightSwitch: Set AI Insight service switch
      • activateDeviceAiInsight: Activate queued AI Insight package
      • setDeviceAiLanguage: Set channel AI language
      • addAiInsightFeature: Add face library member
      • updateAiInsightFeature: Update face library member
      • addAiInsightFaceImages: Append face registration images
      • deleteAiInsightFaceImages: Delete face registration images
      • listAiInsightFeature: List registered face members
      • deleteAiInsightFeature: Delete face members
      • listAiInsightUnknownFace: List unknown face clusters
      • deleteAiInsightUnknownFace: Delete unknown face images
      • queryCondensedRecordBitmap: Query AI Insight highlight calendar mask
      • getCondensedRecords: Query AI Insight highlight clips
      • searchAiAlarmMessageByPage: Search alarm messages by keyword
      • getAlarmMessageStatistics: Daily alarm statistics and safety report
      • reportAiMsgFeedback: Submit AI smart-alarm accuracy feedback
    • Legacy APIs (deprecated)
  • SDK and tools
  • Solutions
  • Platform and support
On this page
What it does
Request URL
Minimum permission
Request parameters
Sample input
Return data fields
Sample output
Error codes
Notes
Related

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 nameParameter typeRequired or notParameter description
tokenStringYesAdministrator or sub-account accessToken
deviceIdStringYesDevice serial number
channelIdsArrayYesChannel IDs as integers or numeric strings, e.g. [0], [0,1] Allowed values: Non-empty JSON array.
productIdStringNoThing-model product ID; required for sub-device messages
nextIndexIdStringNoPagination cursor. Omit on first page; required when fetching the next page
beginTimeStringConditionalRequired on first page; optional on later pages (server reuses first-page filters) Allowed values: yyyy-MM-dd HH:mm:ss.
endTimeStringConditionalRequired on first page; must be ≥ beginTime; optional on later pages Allowed values: yyyy-MM-dd HH:mm:ss.
searchContentStringConditionalSearch phrase, e.g. “man in black jacket”. Required on first page; optional on later pages Allowed values: 1–50 characters.
pageSizeString / IntegerNoPage size Default 32. Allowed values: 1–32.
sortTypeString / IntegerNo0 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 nameField typeField description
nextIndexIdLong / StringCursor for the next page; omit on the first request; pass back on later pages. May be empty when no more results
alarmsArrayMatched alarm list
alarms[].alarmIdStringMessage ID
alarms[].channelNameStringChannel name
alarms[].timeLongAlarm Unix timestamp (seconds)
alarms[].localDateStringDevice-local time yyyy-MM-dd HH:mm:ss
alarms[].alarmTypeStringAlarm message type id (e.g. videoMotion, alarmLocal; same meaning as request msgType in getAlarmMessageById)
alarms[].thumbUrlStringThumbnail URL
alarms[].deviceIdStringDevice serial number
alarms[].picurlArrayString[]Alarm image URLs
alarms[].channelIdStringChannel ID
alarms[].tokenStringMessage token (cloud playback, etc.)
alarms[].productIdStringThing-model product ID (may be omitted for non–thing-model devices)
alarms[].refIdStringThing-model event refId (IoT; may be omitted)
alarms[].labelTypeStringAlarm category tags such as humanAlarm, faceAlarm, carAlarm, abSoundAlarm, motionAlarm, petAlarm, other; comma-separated if multiple
alarms[].utcTimeLongPlatform receive time (seconds)
alarms[].encryptSecretStringImage decryption secret (IoT; omitted when not applicable)
alarms[].aiCopyWritingStringAI scene description (~10–20 chars)
alarms[].securityRiskLevelIntegerAI risk level 1–10
alarms[].aiTagString[]AI tags (person, vehicle, pet, package, etc.)
alarms[].hitFeatureObjsArrayFeature hit list. Present only when there is a hit; omitted otherwise. Each item has only hitType and featureId
alarms[].hitFeatureObjs[].hitTypeStringHit type, e.g. face, figure
alarms[].hitFeatureObjs[].featureIdStringFeature ID
alarms[].resemblanceDoubleKeyword similarity 0–1
alarms[].messageObjectRaw device payload (IoT; omitted when absent)
alarms[].feedbackArrayDetection / accuracy feedback list (omitted when empty)
alarms[].feedback[].typeStringDetection type: 1 human; 2 face; 3 LLM
alarms[].feedback[].resultStringAccuracy: 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)

CodeMeaningNext step
SN1001Signature errorCheck sign per Signature
TK1002Token invalid or expiredRefresh accessToken
OP1002Missing required parameterAdd required fields
OP1003Invalid parameterMatch this page’s parameter table
OP1009Permission deniedCheck token and device bind/share grants
OP1013Total call limit exceededReduce call rate
OP1014Daily per-interface limit exceededSee Interface call limits
DV1007Device offlineWait until the device is online

See Error codes · OP/SN/TK for the full catalog.

Sub-accounts (SUB)

CodeMeaningNext step
SUB1001–SUB1002Sub-account lacks API permissionUpdate policy via addPolicy
SUB1005Sub-account token expiredRefresh subAccountToken
SUB1006No device grant for sub-accountCheck Resource and device serial
SUB1008Sub-account not bound to appCreate and bind the sub-account first

See Error codes · SUB.

Alarms and messages (DV20xx)

CodeMeaningNext step
DV2001Message not foundVerify alarm id
DV2002Message query failedCheck time range and permissions

See Error codes · catalog.

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.

Related

  • AI Insight APIs
  • getAlarmMessageStatistics: Daily alarm statistics and safety report
  • reportAiMsgFeedback: Submit AI smart-alarm accuracy feedback
  • Development guide
getCondensedRecords: Query AI Insight highlight clips
getAlarmMessageStatistics: Daily alarm statistics and safety report