> ## Documentation Index
> Fetch the complete documentation index at: https://cloudinary.com/documentation/llms.txt
> Use this file to discover all available pages before exploring further.

# Visual Search


> **NOTE**:
>
> **Visual Search** is available only to Enterprise customers. For more information, contact [Customer Support](https://support.cloudinary.com/hc/en-us/requests/new) or your Cloudinary Customer Success Manager. Additional costs may apply for accounts with over 10 million images, depending on your account setup.
**Visual Search** enables you to find images based on their visual content, as opposed to their public ID or metadata, and is a powerful way to find products, places, people, and things in images that are visually similar. The search analyzes the contents of the image rather than any of its metadata information. The contents of the image in this context might refer to colors, shapes, textures, or any other information that can be derived from the image itself. 

> **TIP**: This feature is also available for Media Library searches. For details, see [Assets Visual Search](dam_visual_search).

Searching for images based on visual similarity rather than by metadata allows you to:

* Find images even if they aren't tagged or named descriptively.
* Find duplicates.
* Find images by visual characteristics that might not be included in a description.
* Gather images that are similar in appearance.
* Increase the discoverability of your images.
  
You can execute a visual search either by image or by text:

* **Visual Search by image**: Allows you to find matches to a certain image in your product environment or to a remote image via a given URL. For example, you can select an image of a young woman wearing a red shirt, and images with similar characteristics will be returned.
* **Visual Search by text**: Allows you to type in a word or phrase to find images that visually match the concept you described. For example, if you type the phrase `red shirt`, images that visually represent that concept will be displayed.

## Visual Search method 

To execute a visual search, use the `visual_search` method of the [Admin API](admin_api#visual_search_for_resources), and provide it with one of the following parameters:

* `image_url` - The URL of an image.
* `image_asset_id` - The `asset_id` of an image in your product environment.
* `text` - A textual description, e.g., “shirts”

## Visual Search examples

1. Execute a visual search for 'footwear':

    ```multi      
    |ruby
    Cloudinary::Api.visual_search(text: "footwear")

    |php_2
    $api->visualSearch("text" => "footwear");

    |python
    cloudinary.api.visual_search(text = "footwear")

    |nodejs
    cloudinary.v2.api.visual_search({text: "footwear"}).then(callback);

    |java
    cloudinary.api().visualSearch(ObjectUtils.asMap(
      "text", "footwear"
    ));

    |csharp
    var info = cloudinary.VisualSearch(new VisualSearchParams{
      Text = "footwear"
    });

    |go
    resp, err := cld.Admin.VisualSearch(ctx, admin.VisualSearchParams{
   	  Text: "footwear"
    })

    |cli
    cld admin visual_search text="footwear"

    |curl
    curl https://<API_KEY>:<API_SECRET>@api.cloudinary.com/v1_1/<cloud_name>/resources/visual_search?text="footwear"
    ```

2. Execute a visual search using the remote URL of an image 'https://www.example.com/sample.jpg':

    ```multi      
    |ruby
    Cloudinary::Api.visual_search(image_url: "https://www.example.com/sample.jpg")

    |php_2
    $api->visualSearch("ImageUrl" => "https://www.example.com/sample.jpg");

    |python
    cloudinary.api.visual_search(image_url = "https://www.example.com/sample.jpg")

    |nodejs
    cloudinary.v2.api.visual_search({image_url: "https://www.example.com/sample.jpg"}).then(callback);

    |java
    cloudinary.api().visualSearch(ObjectUtils.asMap(
      "image_url", "https://www.example.com/sample.jpg"
    ));

    |csharp
    var info = cloudinary.VisualSearch(new VisualSearchParams{
      ImageUrl = "https://www.example.com/sample.jpg"
    });

    |go
    resp, err := cld.Admin.VisualSearch(ctx, admin.VisualSearchParams{
   	  ImageUrl: "https://www.example.com/sample.jpg"
    })

    |cli
    cld admin visual_search image_url="https://www.example.com/sample.jpg"

    |curl
    curl https://<API_KEY>:<API_SECRET>@api.cloudinary.com/v1_1/<cloud_name>/resources/visual_search?image_url="https://www.example.com/sample.jpg"
    ```

## Visual Search response 

The response returns the assets in order of relevance, from most to least similar:

```json
{
  "next_cursor": "a36b8bd80426df43a107f26b0348",
  "resources": [
  {
    "asset_id": "5f9d30acd36ac3c4f48a82241a37a299",
    "public_id": "shoes",
     …
     …
  },
  {
    "asset_id": "191ad30acd36acf48a82241a137a299a",
    "public_id": "sneakers",
     …
     …
  }
  …
}
```
