IPC camera video event search API

Updated at:
Copy as MD

The event search service retrieves camera events using natural language. You describe what you are looking for in plain language, and the service parses the time range, generates an embedding, runs the search, and returns matching events. This topic describes the request parameters, response parameters, and usage examples for the API.

Overview

The API is synchronous over HTTP.

URL: POST /api/v1/operators/event-search/search

Content-Type: application/json

Request parameters

Parameter

Type

Required

Description

query

string

Yes

The natural language query. For example, "Did anyone go out on March 12?" or "Did anyone come home last Friday?"

database

string

Yes

The name of the database.

table

string

Yes

The name of the table.

time_field

string

Yes

The name of the field used for time filtering. For example, alarm_time.

result_fields

array[string]

Yes

The list of fields to return. For example, ["uid", "device_uid"].

content_field

string

Yes

The name of the field that holds the searchable content. For example, content.

embedding_field

string

Yes

The name of the field that holds the embedding vector. For example, embedding.

embedding_dim

int

No

The dimension of the embedding column. Default: 1024.

top_k

int

No

The size of the candidate set returned by the vector search. Default: 10. The number of items returned after rerank may be smaller.

where_conditions

string

No

An additional filter, expressed as a SQL WHERE clause. For example, uid='U20220509001473' AND device_uid='1c9ffcc04b644176976a117f0de55a8b'.

search_range_limit

int

No

The maximum search range, in days. Default: 7.

Sample request

curl -X POST "http://amv-xxxx.ads.aliyuncs.com:8000/api/v1/operators/event-search/search" \
  -H "Content-Type: application/json" \
  -d '{
    "query": "Did anyone go out on March 12?",
    "database": "test",
    "table": "expr_alarm_events",
    "content_field": "alarm_action",
    "embedding_field": "embedding",
    "time_field": "alarm_time",
    "result_fields": ["uid", "alarm_action", "device_uid", "alarm_id", "alarm_time", "alarm_type", "roles"],
    "top_k": 10,
    "where_conditions": "uid = '\''xxx'\'' AND device_uid = '\''xxx'\''"
  }'

Response parameters

Parameter

Type

Description

code

int

The status code. 200 indicates success.

message

string

The response message.

data

object

The response data.

data.query

string

The original query text.

data.parsed

object

The parsed query.

data.parsed.start_time

string

The start of the time range, in the format YYYY-MM-DD HH:MM:SS.

data.parsed.end_time

string

The end of the time range, in the format YYYY-MM-DD HH:MM:SS.

data.parsed.real_query

string

The actual content query, with time information removed.

data.results

array

The list of matching results, corresponding to the fields requested in result_fields.

Sample response

{
  "code": 200,
  "message": null,
  "data": {
    "query": "Did anyone go out on March 12?",
    "parsed": {
      "start_time": "2026-03-12 00:00:00",
      "end_time": "2026-03-12 23:59:59",
      "real_query": "Did anyone go out?"
    },
    "results": [
      {
        "uid": "U2022059001473",
        "device_uid": "1c9ffcc04b644176976a117f0de55a8b",
        "alarm_id": "ae0cff54a5d40d6499f92044cc79ea1c",
        "alarm_time": "2026-03-12 15:48:37",
        "alarm_type": "2",
        "roles": "Stranger"
      }
    ]
  }
}

Supported time expressions

The service understands a range of time expressions:

Type

Examples

Description

Absolute date

"March 12", "March 12, 2026"

A specific date.

Relative date

"today", "yesterday", "the day before yesterday"

Relative to the current date.

Week-based

"last Friday", "this Sunday", "last week"

A specific day of the week, or an entire week.

Time range

"the past 7 days", "this week"

A range of time.

If the query does not include time information, the service queries today's data by default.