All Products
Search
Document Center

Image Search:Image query

Last Updated:Jan 21, 2026

This topic describes how to query images in Image Search.

Background information

Image Search lets you query images using APIs, SDK (recommended), or the console (for trial purposes).

Console method

  1. Log on to the Image Search console.

  2. Select the target service type and instance.

  3. Click Image Search.

    Parameter

    Corresponding API parameter

    Description

    Required

    Search type

    Type

    Two search types are available:

    • SearchByPic: Searches for similar images based on a specified image. This is the default value.

    • SearchByName: Searches for similar images based on a previously added image.

    Yes

    Upload image

    PicContent

    The image content, Base64-encoded. The image must meet the following requirements:

    • The image size cannot exceed 4 MB.

    • The image must be in PNG, JPG, JPEG, BMP, GIF, WEBP, TIFF, or PPM format.

    • The transfer latency is less than 5 seconds.

    • For product image search and generic image search, the image height and width must be between 100 pixels and 4096 pixels, inclusive.

    • The image cannot contain rotation information.

    Yes

    Subject identification

    Crop

    Specifies whether to detect the subject in the uploaded image during the search.

    • If set to true: The system performs subject identification, which includes automatic system identification and custom subject identification. For details, see the Subject identification method parameter.

    • false: Does not detect the subject. The entire image is used for the search.

    Yes

    Subject identification method

    N/A

    The method for subject identification:

    • System automatic identification: The system automatically detects the subject and uses it for the search. The subject identification result is available in the response.

    • Custom subject region: You can specify a custom region for subject identification. The format is x1,x2,y1,y2, where x1,y1 are the coordinates of the upper-left point and x2,y2 are the coordinates of the lower-right point. If you select this option, you can drag a box to select the subject region in the image. If you do not specify a custom region, the entire image is used for the search.

    Yes

    Image category

    CategoryId

    The image category, which is the CategoryId. You can specify a category for the image during the search. For more information, see Category reference.

    Note
    • For product search, if you set a category, the specified category is used. If you do not set a category, the system predicts one. The predicted category is available in the response.

    • For generic searches, the system sets the category to 88888888, regardless of whether you specify one.

    No

    Number of results

    Num

    The maximum number of similar results to return. The value must be in the range of 1 to 100. The default value is 10.

    No

    Start position of results

    Start

    The start position of the similar results to return. The value must be in the range of 0 to 499. The default value is 0.

    Yes

    Filter condition

    Filter

    You can set a filter condition to return only image results that meet the condition. For example, you can return only image results where ownerId is 1000, or where the company name is "alibaba".

    Note
    • The `int_attr` field supports the operators >, >=, <, <=, =, in, and not in.

    • The `str_attr` field supports the operators =, !=, in, and not in.

    • You can use AND and OR to connect multiple conditions.

    • Example: `int_attr=1000 AND str_attr="value1"`.

    No

    Similarity score filter

    ScoreThreshold

    After you specify a similarity score threshold, the system returns only information about images with a similarity score greater than or equal to the threshold. The threshold must be in the range of 0.00 to 1.00, with up to two decimal places supported. The default value is 0.00.

    No

  4. View the returned results.

    The following table describes the parameters in the response.

    Parameter

    Type

    Example

    Description

    Success

    Boolean

    true

    Indicates whether the request was successful.

    RequestId

    String

    36C43E96-8F68-44AA-B1AF-B1F7AB94A6C1

    The request ID.

    Code

    Integer

    0

    The error code:

    • 0 indicates success.

    • A non-zero value indicates failure.

    Message

    String

    success

    The error message.

    Head

    -

    -

    Information about the search results.

    └DocsReturn

    Integer

    10

    The number of results returned.

    └DocsFound

    Integer

    10000

    The number of results hit in the instance.

    └SearchTime

    Integer

    95

    The time taken for the search, in milliseconds.

    PicInfo

    -

    -

    Information such as the category prediction and subject identification results.

    └CategoryId

    Integer

    88888888

    The category prediction result. If a category was specified in the request, the specified category is returned.

    └Region

    String

    280,486,232,351

    The subject identification result. This is the subject region of the image, in the format x1,x2,y1,y2, where x1 and y1 are the coordinates of the upper-left point, and x2 and y2 are the coordinates of the lower-right point. If a subject region was specified in the request, the specified region is returned.

    └AllCategories

    -

    -

    Information about all categories supported by the system.

    └└Name

    String

    Tops

    The category name.

    └└Id

    Integer

    0

    The category ID.

    └MultiRegion

    -

    -

    The set of subject identification results.

    Note

    You must upgrade to version V3.1.1 to use this feature.

    └└Region

    String

    280,486,232,351

    The subject identification result. This is the subject region of the image, in the format x1,x2,y1,y2, where x1 and y1 are the coordinates of the upper-left point, and x2 and y2 are the coordinates of the lower-right point. If a subject region was specified in the request, the specified region is returned.

    Auctions

    -

    -

    Descriptive information for all returned products.

    └CustomContent

    String

    Demo Custom Content

    The custom content.

    └PicName

    String

    DemoPic

    The image name.

    └CategoryId

    Integer

    0

    The image category.

    └ProductId

    String

    test

    The product ID.

    └SortExprValues

    String

    7.33136443711219e+24;0

    The system scoring information.

    Note

    This field is deprecated. Use Score instead.

    └Score

    Float

    1

    The similarity score of the image. The value is in the range of 0 to 1.

    Note

    You must upgrade to version V3.1.1 to use this feature.

    └IntAttr

    Integer

    0

    The integer attribute.

    └IntAttr2

    Integer

    0

    The integer attribute.

    └IntAttr3

    Integer

    0

    The integer attribute.

    └IntAttr4

    Integer

    0

    The integer attribute.

    └StrAttr

    String

    demoStrAttr

    The string attribute.

    └StrAttr2

    String

    demoStrAttr

    The string attribute.

    └StrAttr3

    String

    demoStrAttr

    The string attribute.

    └StrAttr4

    String

    demoStrAttr

    The string attribute.

API method

You can directly access the service through HTTP or HTTPS. You must use the signing mechanism to authenticate your requests and format the request body as required. The maximum number of queries per second (QPS) is determined by your purchased resource plan. For more information, see Search for an image by name or Search for an image by picture.

SDK method (recommended)

Image Search provides SDKs for multiple programming languages. You do not need to manage complex configurations, such as signature authentication or request body assembly. The maximum number of queries per second (QPS) is determined by your purchased resource plan. For more information, see SDK reference.