younifyd
Menu

Retrieve by image

Retrieve by image

POST/v2/image_search

Use it in a workflow

  1. Add a step and choose the Constructor connector.
  2. Pick the Retrieve by image action (under Image Search).
  3. Fill in the fields below, then reference the result from later steps as {{retrieveByImage.response.data}}.

Request

Query parameters

sectionstring

The section of the index to use.

Default "Products"

search_crop_typestring

How to crop detected segments for visual search. Only relevant when `use_segmentation` is `true`.

One ofbboxsegmentDefault "bbox"

variations_mapstring (json)

A JSON string containing a instructions on how to map item variation data in the response (typically used for swatches). More details, including the exact schema for this value can be found [here](/reference/shared-variations-mapping)

fmt_optionsany

An object containing options to format different aspect of the response.

cstring

The ID of the client and version that the request is coming from, such as `cio-js-2.90`.

usarray<string>

A customer defined context (such as `vip-club-member`) used to evaluate redirect or refined tag rules. Pass multiple segments by passing multiple `us` arguments.

use_segmentationboolean

Whether to detect and individually search multiple objects in the image. When `true`, the image is split into detected objects and each is searched separately; results are merged.

Default false

uistring

A customer generated anonymized identifier for a user on a customer website. It should only be sent for logged in customers and helps Constructor to tie multiple client and session IDs together to form a behavioral data profile across devices.

return_segmentsboolean

Whether to include per-segment metadata in the response. Only applicable when `use_segmentation` is `true`.

Default false

sinteger

An integer representing the users session number (starting with `1`), incremented after a 30 minute period of inactivity.

istring

A globally unique identifier for the user browser (or mobile application instance) making the request.

Response

Returns 200 with an object. Read it in later steps with {{retrieveByImage.response.data.<field>}}.

requestobject

The request arguments how they were interpreted by the API. This field is of arbitrary type, ie it doesn't have a guaranteed schema, and data from it shouldn't be used programmatically, it is for debugging purposes only.

result_idstring

A unique identifier for this search request, used for analytics and behavioral tracking.

responseany
segmentation_usedboolean

Whether segmentation was actually used to produce results. `false` when `use_segmentation` was not requested or when segmentation failed and the system fell back to whole-image search.

whole_image_search_fallbackboolean

Whether the service fell back to whole-image search after segmentation was requested but failed to produce usable results. Always `false` when `use_segmentation` was not requested.

segmentsarray<object>

Per-segment search results. Present when `use_segmentation` is `true` and `return_segments` is `true`.

idintegerrequired

Zero-based index of this segment in the detection list.

x1integerrequired

Left x coordinate of the bounding box.

y1integerrequired

Top y coordinate of the bounding box.

x2integerrequired

Right x coordinate of the bounding box.

y2integerrequired

Bottom y coordinate of the bounding box.

class_idintegerrequired

Numeric class identifier from the segmentation model.

class_namestringrequired

Human-readable class name (e.g. 'top', 'pants').

confidencenumber (float)required

Detection confidence score in the range [0.0, 1.0], where 1.0 is maximum confidence.

centroid_xintegerrequired

X coordinate of the segment interior point.

centroid_yintegerrequired

Y coordinate of the segment interior point.

neighboursarray<object>required3 fields

Nearest-neighbour search results for this segment.

json
{
  "request": {},
  "response": null,
  "segmentation_used": false,
  "whole_image_search_fallback": false,
  "result_id": "string",
  "segments": [
    {
      "id": 0,
      "x1": 0,
      "y1": 0,
      "x2": 0,
      "y2": 0,
      "class_id": 0,
      "class_name": "string",
      "confidence": 0,
      "centroid_x": 0,
      "centroid_y": 0,
      "neighbours": [
        {
          "id": "string",
          "distance": 0,
          "data": {}
        }
      ]
    }
  ]
}

Need more? See the Constructor guide for connection setup and behaviour shared by every action.