AI Search Engine API

Updated at:

Overview

The CleverSee AI Search and Question Answering Platform provides a search API that enables precise searches across images, documents, and audio/video content within your datasets. After building a search application on the platform, you can use the application's API to query your data. The API supports multimodal inputs, including natural language text, images, or a combination of both. This allows for quick adaptation to large-scale data search scenarios and helps you efficiently locate target content.

API

You can use this API with two types of search applications created on the CleverSee AI Search and Question Answering Platform: image search applications for text-to-image, image-to-image, and mixed text-and-image searches; and audio and video search applications for text-to-audio/video, image-to-video, and mixed text-and-image-to-video searches.

Data sources

This API supports audio and video data, which you can upload and update through the CleverSee AI Search and Question Answering Platform user interface or by using the Add/Update dataset data API.

Authentication method

Use the Alibaba Cloud SDK to call the CleverSee - AI Search Engine service. For detailed instructions, see AI Search Engine API.

Request parameters

Parameters

Parameter

Type

Required

Description

Example

appId

String

Yes

The unique ID of the application.

"2048962366415007746"

query

Object

Yes

The query object.

(See sub-parameters)

├─

texts

Array[String]

No

An array of text queries.
• The array currently supports only one text string, with a maximum length of 256 characters.

["a girl receives a small red flower"]

├─ 

imageUrl

Array[String]

No

An array of image URLs for queries.

• Currently, only one image URL is supported. The maximum image size is 10 MB. Supported formats: JPG, PNG, WEBP, and JPEG.

["https://example.com/img.jpg"]

├─ 

pageSize

Integer

Yes

The number of results to return per page.

10

├─ 

pageNo

Integer

No

The page number, starting from 1.

• Default value: 1

1

└─ 

excludeIds

Array[String]

No

A list of primary key IDs to exclude from the results.

• Use this to filter out items that have already been viewed.

[] or ["id_001", "id_002"]

user

Object

No

User information object for user-centric analytics.

(See sub-parameters)

└─ 

userId

String

No

The unique ID of the end user.

"asdfgnoevnor"

Request example

Example of a standard request

JSON format

curl -X POST 'https://aisearchengine.aliyuncs.com/api/v1/platform/app/search' \
  -H 'Content-Type: application/json' \
  -H "Date: $(LC_ALL=C date -u +'%a, %d %b %Y %H:%M:%S GMT')" \
  -H 'x-acs-apikey: ALS*****' \
  -d '{
    "appId": "your app id",
    "query": {
      "texts": ["little girl"],
      "imageUrls": ["https://your-image-url.com/image.jpg"],
      "pageSize": 10,
      "pageNo": 1
    }
  }'

Response parameters

3.1 Top-level structure

Parameter

Type

Description

Example

code

Integer

The status code. A value of 200 indicates success.

200

message

String

The response message.

"success"

requestId

String

The request ID for troubleshooting.

"566371ae...b34"

data

Object

The business data object.

(See sub-parameters)

├─ 

size

Integer

The number of results per page, matching the pageSize request parameter.

4

├─ 

page

Integer

The current page number.

1

├─ 

total

Integer

The number of results returned on the current page.

4

├─ 

traceInfo

Null

Trace information.

null

└─

extra

Object

Additional metadata.

Note The exclude_ids field specifies the list of excluded IDs, and its format is Array[String].

  • Example: ["id_1", "id_2"]

{exclude_ids: ["id_1", "id_2"]}

items

Array[Object]

A list of search result items. The detailed structure is described below.

(See section 3.2)

status

String

The business status code as a string.

"200"

errorMessage

Null

The error message. This is null on success.

null

3.2 items structure

Each object in the items array represents a search result. The specific attributes within the content field vary depending on the media type (image, video, or audio). The following is the general structure and the fields specific to video/audio:

Image search items

Parameter

Type

Description

Example

score

Float

The relevance score.

0.005369

content

Object

The content details object.

(See sub-parameters)

├─

image_url

String

The URL of the image.

• The URL includes a signature and is valid for 24 hours after it is generated.

"https://.../image_1.png?Expires=..."

├─ 

s_name

String

The original file name.

"image_1.png"

├─

pk_id

String

The primary key ID of the original resource.

"01KQ...ZX020"

└─

s_dataset_id

String

The ID of the resource's dataset.

"594"

Audio and video search items

Parameter

Type

Description

Example

score

Float

The relevance score.

0.005369

content

Object

The content details object.

(See sub-parameters)

├─ 

s_raw_cover_pic

String

The URL of the cover image for the full video.

• The URL includes a signature and is valid for 24 hours after it is generated.

• The audio/plain text result is null

"https://.../frame_0.jpg?Expires=..."

├─

s_segment_cover_pic

String

The URL of the cover image for the video segment.

• The URL includes a signature and is valid for 24 hours after it is generated.

• The audio or plain text result is null

"https://.../frame_1.jpg?Expires=..."

├─

s_raw_file_path

String

The URL of the media file.

• The URL includes a signature and is valid for 24 hours after it is generated.

• Supported formats include MP4, MP3, and JPG.

"https://.../video.mp4?Expires=..."

├─ 

s_name

String

The original file name.

"video_001.mp4"

├─

pk_id

String

The primary key ID of the original resource.

"01KQ...ZX020"

├─

s_dataset_id

String

The ID of the resource's dataset.

"594"

├─ 

s_segment_start_millisecond

Integer

The start time of the segment in milliseconds.

• This value can be 0 for results that are not video or audio segments.

10000

├─ 

s_segment_end_millisecond

Integer

The end time of the segment in milliseconds.

• This value can be 0 for results that are not video or audio segments.

20000

├─ 

s_raw_length

Integer

The duration of the file in milliseconds.

146046

├─ 

s_video_type

String

Video type tag.

• An AI-derived category tag for the video. The value is one of the following:

Classroom Recording, Micro-course/MOOC, Science Explainer, Skill Tutorial, News Broadcast, Interview/Speech, Documentary, Live Report, Promotional/Advertisement, Press Conference, Product Demonstration, Vlog/Daily Life, Film/Variety Show, Gameplay, Short Drama/Comedy, Food/Travel, Music/Dance, Sports Event, Gala/Performance, Other

Classroom Recording

├─

s_video_topic

String

Video topic tag.

• An AI-derived tag for the video's core topic. The value is not from a predefined list.

Single-player gameplay

├─ 

s_global_summary

String

Global summary tag.

• An AI-derived, video-level summary of the core content. The value is not from a predefined list.

This video provides an in-depth review of the latest smartphone from Brand XX, highlighting its night photography and gaming thermal performance.

└─  

s_global_keywords

String

Global keywords tag.

• Two to four keywords that summarize the video content. These are AI-derived tags, and the values are not from a predefined list.

Smartphone Review, Performance Test

Response examples

Successful image search response

JSON format

  {
    "code": 200,
    "message": "success",
    "data": {
      "size": 1,
      "page": 1,
      "total": 1,
      "traceInfo": null,
      "extra": {
        "exclude_ids": ["3f95b343xxxxxxxxxxxx"]
      },
      "items": [
        {
          "id": "3f95b343xxxxxxxxxxxx",
          "score": 0.8029279573006508,
          "content": {
            "s_name": "sample_image.png",
            "image_url": "https://.../image.png?Expires=...",
            "pk_id": "3f95b343xxxxxxxxxxxx",
            "s_dataset_id": "594"
          },
          "algorithm": {},
          "traceInfo": null
        }
      ],
      "status": "200",
      "errorMessage": null
    },
    "requestId": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  }

Successful video search response

JSON format

{
  "code": 200,
  "data": {
    "total": 1,
    "size": 1,
    "traceInfo": null,
    "extra": {
      "exclude_ids": ["01XXXXXXXXXXXXXXX"]
    },
    "errorMessage": null,
    "page": 1,
    "items": [{
      "score": 0.577594,
      "traceInfo": null,
      "id": "01XXXXXXXXXXXXXXX",
      "content": {
        "s_raw_file_path": "https://.../video.mp4?Expires=...",
        "s_raw_length": 1036122,
        "pk_id": "01XXXXXXXXXXXXXXX",
        "s_global_summary": "The first half of the video focuses on the conflicts and collaborations between characters, showing complex relationships and emotional changes through multiple plot points, including chases, dialogues, and investigations. The second half shifts to a stage performance, showcasing a singer's live performance and audience interaction at a large event. The overall content combines narrative storytelling with musical performance elements.",
        "s_raw_cover_pic": "https://.../frame_1.jpg?Expires=...",
        "s_name": "demo_video.mp4",
        "s_dataset_id": "833",
        "s_global_keywords": "Plot interaction, Character relationships, Investigation and chase, Musical performance, Stage singing",
        "s_video_topic": "Plot content and musical performance",
        "s_video_type": "Film/Variety Show"
      },
      "algorithm": {}
    }],
    "status": "200"
  },
  "requestId": "xxxxxxxxxxxxxxxxxxxxxxxx",
  "message": "success"
}

Error codes

HTTP status code

Error code

Error message

Description

500

SYSTEM_ERROR

system inner error

An internal system error occurred.

403

APP_FORBIDDEN

no permission to access this app

You do not have permission to access this application.

400

INVALID_PARAM

invalid parameter

One or more parameters are invalid.

404

APP_NOT_FOUND

app not found

The specified application was not found.

407

APP_ACCESS_UNAVAILABLE

app access privilege escalation

The request was denied due to a potential privilege escalation.

405

INPUT_TOO_LONG

input text exceeds maximum length

The input text exceeds the maximum allowed length.

406

IMAGE_LIMIT_EXCEEDED

image count exceeds maximum limit

The number of images exceeds the maximum limit.

Multimedia resources in search results

To get the URLs for media resources in a dataset, see Get presigned URLs for multimedia resources (images, videos) in search results API.