Constructor Search API
AI-optimized keyword and natural-language search results for products and other index sections, returned by search query with filtering, faceting, sorting, pagination and variations mapping.
AI-optimized keyword and natural-language search results for products and other index sections, returned by search query with filtering, faceting, sorting, pagination and variations mapping.
openapi: 3.1.0
info:
contact:
email: support@constructor.io
title: Search
version: '0.1'
servers:
- url: https://ac.cnstrc.com
security: []
tags:
- name: Search results
- name: Natural language search results
paths:
/v1/search/{search_query}:
get:
tags:
- Search results
operationId: v1-search-get-search-results
summary: Retrieve by query
description: Retrieve AI optimized search results for products (or optionally other sections) by search query.
parameters:
- name: search_query
in: path
required: true
schema:
type: string
format: path
examples:
- red shoes
- lipstick
- name: key
in: query
schema:
description: The key of the index to use.
examples:
- key_K2pX7vBnU0bgA5xp
maxLength: 100
minLength: 1
title: Key
type: string
required: true
- name: section
in: query
schema:
description: The section of the index to use. Defaults to `Products`.
examples:
- Products
- Search Suggestions
title: Section
maxLength: 100
minLength: 1
type: string
required: false
- name: filters
in: query
schema:
description: Any number of filtering criteria (accessible to end users) used to narrow the result set, such as `color=blue` or `group_id=sandals` or `price=100-200`. Facets and Item Groups and Collections can be used as filters. If `filter_value` has the form `<min>-<max>`, it is interpreted as a range. Filters with the same key are ORed together and filters with different keys are ANDed together by default. Only results that match the filters are returned. Boolean values are serialized with the first letter capitalized (e.g., `True` / `False`) as a convention.
examples:
- color:
- red
- blue
price:
- 100-200
allOf:
- $ref: '#/components/schemas/Filters'
title: Filters
required: false
style: deepObject
explode: true
- name: filter_match_types
in: query
schema:
description: 'An object specifying whether results must match `all`, `any` or `none` of a given filter when multiple options of the same facet (e.g: color: yellow & blue) are selected.'
examples:
- color: any
size: all
title: Filter Match Types
additionalProperties:
$ref: '#/components/schemas/FilterMatchType'
type: object
required: false
style: deepObject
explode: true
- name: pre_filter_expression
in: query
schema:
description: A JSON-encoded [filter expression](/reference/shared-filter-expressions) containing any number of filters (inaccessible to end users) used to narrow the result set. Applied before user-selected `filters`. Only items that match this expression are considered in facet counts. Only results that match the filters are returned. [Read more](/reference/shared-pre-filter-expressions).
examples:
- '{"and":[{"name":"brand","value":"Nike"}]}'
allOf:
- $ref: '#/components/schemas/DictOrJsonStringWithDict'
title: Pre Filter Expression
required: false
- name: num_results_per_page
in: query
schema:
default: 20
description: The number of results per page to return.
examples:
- 20
- 24
title: Num Results Per Page
maximum: 200
minimum: 1
type: integer
required: false
- name: page
in: query
schema:
description: The page of results to return.
examples:
- 1
title: Page
minimum: 1
type: integer
required: false
- name: offset
in: query
schema:
description: The number of results to skip from the beginning. Cannot be used together with `page`.
examples:
- 0
title: Offset
minimum: 0
type: integer
required: false
- name: sort_by
in: query
schema:
default: relevance
description: The method to sort results by. The default value `relevance` sorts by Constructor's attractiveness & personalization algorithms and is reserved. Alternative sort criteria can be configured using the [Sort options API](/reference/v1-sort-options-create-or-replace-sort-options).
examples:
- relevance
title: Sort By
type: string
required: false
- name: sort_order
in: query
schema:
default: descending
description: The order by which results should be sorted. Only valid in conjunction with `sort_by`.
examples:
- descending
allOf:
- $ref: '#/components/schemas/SortOrderType'
required: false
- name: now
in: query
schema:
description: A date time representing the current moment in time when applying filtering by product age. Used to emulate "past/future" requests. Requires authentication.
examples:
- '2024-01-15T10:30:00Z'
title: Now
format: date-time
type: string
required: false
- name: variations_map
in: query
schema:
description: 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)
examples:
- '{"group_by":[{"name":"color","field":"data.color"}],"values":{"price":{"aggregation":"min","field":"data.price"}},"dtype":"array"}'
format: json
title: Variations Map
type: string
allOf:
- $ref: '#/components/schemas/VariationsMap'
required: false
- name: fmt_options
in: query
schema:
description: An object containing options to format different aspect of the response.
allOf:
- $ref: '#/components/schemas/FmtOptions'
title: Fmt Options
required: false
style: deepObject
explode: true
- name: qs
in: query
schema:
description: A JSON-encoded query string. Any query parameters listed for this endpoint can be serialized into a JSON string and parsed thru the `qs` param.
format: json
title: Qs
type: string
required: false
- name: origin_referrer
in: query
schema:
description: The url or app location where the request originated.
examples:
- https://example.com/search
title: Origin Referrer
type: string
required: false
- name: c
in: query
schema:
description: The ID of the client and version that the request is coming from, such as `cio-js-2.90`.
examples:
- cio-js-client-2.35.2
title: C
maxLength: 100
minLength: 1
type: string
required: false
- name: us
in: query
schema:
description: 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.
title: us
items:
minLength: 1
type: string
examples:
- vip-member
- us-east-region
type: array
required: false
- name: ui
in: query
schema:
description: 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.
examples:
- customer-user-id-456
title: Ui
type: string
required: false
- name: s
in: query
schema:
description: An integer representing the users session number (starting with `1`), incremented after a 30 minute period of inactivity.
examples:
- 1
title: S
type: integer
required: false
- name: i
in: query
schema:
description: A globally unique identifier for the user browser (or mobile application instance) making the request.
examples:
- user-device-id-123
title: I
type: string
required: false
- name: lang
in: query
schema:
description: 'A specification of the user query language. When provided, this parameter enables language-specific processing such as stemming to improve relevance and recall. '
examples:
- en
title: Lang
enum:
- ar
- ca
- cs
- da
- de
- el
- en
- es
- et
- eu
- fi
- fr
- ga
- he
- hi
- hu
- hy
- id
- it
- lt
- lv
- ne
- nl
- 'no'
- pl
- pt
- ro
- ru
- sk
- sr
- sv
- ta
- tr
- yi
type: string
required: false
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/SearchGetResponse'
'400':
description: Validation Error
security: []
/v1/search/natural_language/{query}:
get:
tags:
- Natural language search results
operationId: v1-search-get-natural-language-search-results
summary: Retrieve by query
description: Retrieve AI optimized search results for products (or optionally other sections) using a spoken search query. The spoken query should first be converted to text on the client side. The API then further "de-naturalizes" the query by filtering out excess words and identifies any specified filters.
parameters:
- name: query
in: path
required: true
schema:
type: string
format: path
examples:
- red shoes
- lipstick
- name: key
in: query
schema:
description: The key of the index to use.
examples:
- key_K2pX7vBnU0bgA5xp
maxLength: 100
minLength: 1
title: Key
type: string
required: true
- name: section
in: query
schema:
description: The section of the index to use. Defaults to `Products`.
examples:
- Products
- Search Suggestions
title: Section
maxLength: 100
minLength: 1
type: string
required: false
- name: filters
in: query
schema:
description: Any number of filtering criteria (accessible to end users) used to narrow the result set, such as `color=blue` or `group_id=sandals` or `price=100-200`. Facets and Item Groups and Collections can be used as filters. If `filter_value` has the form `<min>-<max>`, it is interpreted as a range. Filters with the same key are ORed together and filters with different keys are ANDed together by default. Only results that match the filters are returned. Boolean values are serialized with the first letter capitalized (e.g., `True` / `False`) as a convention.
examples:
- color:
- red
- blue
price:
- 100-200
allOf:
- $ref: '#/components/schemas/Filters'
title: Filters
required: false
style: deepObject
explode: true
- name: filter_match_types
in: query
schema:
description: 'An object specifying whether results must match `all`, `any` or `none` of a given filter when multiple options of the same facet (e.g: color: yellow & blue) are selected.'
examples:
- color: any
size: all
title: Filter Match Types
additionalProperties:
$ref: '#/components/schemas/FilterMatchType'
type: object
required: false
style: deepObject
explode: true
- name: pre_filter_expression
in: query
schema:
description: A JSON-encoded [filter expression](/reference/shared-filter-expressions) containing any number of filters (inaccessible to end users) used to narrow the result set. Applied before user-selected `filters`. Only items that match this expression are considered in facet counts. Only results that match the filters are returned. [Read more](/reference/shared-pre-filter-expressions).
examples:
- '{"and":[{"name":"brand","value":"Nike"}]}'
allOf:
- $ref: '#/components/schemas/DictOrJsonStringWithDict'
title: Pre Filter Expression
required: false
- name: num_results_per_page
in: query
schema:
default: 20
description: The number of results per page to return.
examples:
- 20
- 24
title: Num Results Per Page
maximum: 200
minimum: 1
type: integer
required: false
- name: page
in: query
schema:
description: The page of results to return.
examples:
- 1
title: Page
minimum: 1
type: integer
required: false
- name: offset
in: query
schema:
description: The number of results to skip from the beginning. Cannot be used together with `page`.
examples:
- 0
title: Offset
minimum: 0
type: integer
required: false
- name: sort_by
in: query
schema:
default: relevance
description: The method to sort results by. The default value `relevance` sorts by Constructor's attractiveness & personalization algorithms and is reserved. Alternative sort criteria can be configured using the [Sort options API](/reference/v1-sort-options-create-or-replace-sort-options).
examples:
- relevance
title: Sort By
type: string
required: false
- name: sort_order
in: query
schema:
default: descending
description: The order by which results should be sorted. Only valid in conjunction with `sort_by`.
examples:
- descending
allOf:
- $ref: '#/components/schemas/SortOrderType'
required: false
- name: now
in: query
schema:
description: A date time representing the current moment in time when applying filtering by product age. Used to emulate "past/future" requests. Requires authentication.
examples:
- '2024-01-15T10:30:00Z'
title: Now
format: date-time
type: string
required: false
- name: variations_map
in: query
schema:
description: 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)
examples:
- '{"group_by":[{"name":"color","field":"data.color"}],"values":{"price":{"aggregation":"min","field":"data.price"}},"dtype":"array"}'
format: json
title: Variations Map
type: string
allOf:
- $ref: '#/components/schemas/VariationsMap'
required: false
- name: fmt_options
in: query
schema:
description: An object containing options to format different aspect of the response.
allOf:
- $ref: '#/components/schemas/FmtOptions'
title: Fmt Options
required: false
style: deepObject
explode: true
- name: qs
in: query
schema:
description: A JSON-encoded query string. Any query parameters listed for this endpoint can be serialized into a JSON string and parsed thru the `qs` param.
format: json
title: Qs
type: string
required: false
- name: origin_referrer
in: query
schema:
description: The url or app location where the request originated.
examples:
- https://example.com/search
title: Origin Referrer
type: string
required: false
- name: c
in: query
schema:
description: The ID of the client and version that the request is coming from, such as `cio-js-2.90`.
examples:
- cio-js-client-2.35.2
title: C
maxLength: 100
minLength: 1
type: string
required: false
- name: us
in: query
schema:
description: 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.
title: us
items:
minLength: 1
type: string
examples:
- vip-member
- us-east-region
type: array
required: false
- name: ui
in: query
schema:
description: 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.
examples:
- customer-user-id-456
title: Ui
type: string
required: false
- name: s
in: query
schema:
description: An integer representing the users session number (starting with `1`), incremented after a 30 minute period of inactivity.
examples:
- 1
title: S
type: integer
required: false
- name: i
in: query
schema:
description: A globally unique identifier for the user browser (or mobile application instance) making the request.
examples:
- user-device-id-123
title: I
type: string
required: false
- name: lang
in: query
schema:
description: 'A specification of the user query language. When provided, this parameter enables language-specific processing such as stemming to improve relevance and recall. '
examples:
- en
title: Lang
enum:
- ar
- ca
- cs
- da
- de
- el
- en
- es
- et
- eu
- fi
- fr
- ga
- he
- hi
- hu
- hy
- id
- it
- lt
- lv
- ne
- nl
- 'no'
- pl
- pt
- ro
- ru
- sk
- sr
- sv
- ta
- tr
- yi
type: string
required: false
responses:
'200':
description: OK
content:
application/json:
schema:
$ref: '#/components/schemas/SearchGetResponse'
'400':
description: Validation Error
security: []
components:
schemas:
DictOrJsonStringWithDict:
anyOf:
- title: object
type: object
- format: json
title: Encoded JSON string
type: string
title: DictOrJsonStringWithDict
FacetOptionSortOrder:
enum:
- relevance
- value
- num_matches
title: FacetOptionSortOrder
type: string
FilterMatchType:
enum:
- any
- all
- none
title: FilterMatchType
type: string
Filters:
propertyNames:
minLength: 1
title: Filters
type: object
FmtOptions:
additionalProperties: false
properties:
fields:
description: A list of specific item fields to return in the response. Allows the request to control which fields are returned.
title: Fields
items:
maxLength: 300
minLength: 1
type: string
examples:
- image_url
- price
- brand
maxItems: 20
type: array
show_hidden_fields:
default: false
description: A flag to return all `hidden` fields in the response.
examples:
- false
- true
title: Show Hidden Fields
type: boolean
hidden_fields:
description: A list of specific hidden fields to return in the response. Unlike `show_hidden_fields` this parameter allows the request to control which `hidden` fields are returned. Used to return item fields for a particular store or user segment.
title: Hidden Fields
items:
maxLength: 300
minLength: 1
type: string
examples:
- inventory_count
- store_availability
maxItems: 30
type: array
variations_return_type:
description: A flag to return `default`, `all`, or `matched` variations.
examples:
- default
allOf:
- $ref: '#/components/schemas/VariationsReturnType'
groups_max_depth:
default: 1
description: The maximum depth of the group hierarchy in the response.
examples:
- 1
- 3
title: Groups Max Depth
type: integer
groups_start:
default: current
description: A flag to specify the start of the group hierarchy returned in the response. `current` returns groups starting from the currently selected one. `top` returns groups starting from the root category in the hierarchy. `group_id:{id}`, returns the whole tree starting from group with the provided ID.
examples:
- current
- top
- group_id:jeans
title: Groups Start
type: string
groups_sort_by:
description: A string indicating the option to sort results by. Sorting options are created from item fields and facets in the product catalog.
examples:
- relevance
allOf:
- $ref: '#/components/schemas/FacetOptionSortOrder'
groups_sort_order:
description: A flag to sort either `ascending` or `descending`.
examples:
- descending
allOf:
- $ref: '#/components/schemas/SortOrderType'
show_hidden_facets:
default: false
description: A flag to return all facets configured as `hidden` in `response.facets`.
examples:
- false
- true
title: Show Hidden Facets
type: boolean
hidden_facets:
description: A list of specific hidden facets to return in the response. Unlike `show_hidden_facets` this parameter allows the request to control which hidden facets are returned. Used to return facets for a particular store or user segment.
title: Hidden Facets
items:
maxLength: 100
minLength: 1
type: string
examples:
- store_id
- region
maxItems: 50
type: array
show_hidden_facet_options:
description: A flag to return all `hidden` facets options in the response.
examples:
- true
- false
title: Show Hidden Facet Options
type: boolean
show_protected_facets:
default: false
description: A flag to return all `protected` facets in the response. Requires authentication.
examples:
- false
- true
title: Show Protected Facets
type: boolean
facet_options:
description: A list of specific facet options per facet to return in the response. This parameter accepts up to 5 facets and works only with facets of type `multiple`. Invalid facet options will be ignored. Used to return facet options for a particular facet like store or user segment.
examples:
- brand:
- nike
- adidas
color:
- red
- blue
title: Facet Options
additionalProperties:
items:
maxLength: 100
minLength: 1
type: string
maxItems: 15
type: array
type: object
facet_groups_limit:
description: The maximum limit of the facet groups returned in the response.
examples:
- 10
title: Facet Groups Limit
minimum: 0
type: integer
show_hidden_sort_options:
description: A flag to return all sort options configured as `hidden` in `response.sort_options`.
examples:
- true
- false
title: Show Hidden Sort Options
type: boolean
hidden_sort_options:
description: A list of `sort_by` fields whose hidden sort options should be included in the response. Unlike `show_hidden_sort_options` this parameter allows you to specify exactly which hidden sort options are returned.
title: Hidden Sort Options
items:
maxLength: 100
minLength: 1
type: string
examples:
- price
- rating
maxItems: 25
type: array
title: FmtOptions
type: object
SearchandizedItem:
anyOf:
- type: integer
- maxItems: 2
minItems: 2
type: array
- maxItems: 7
minItems: 7
type: array
title: SearchandizedItem
SearchandizedItems:
additionalProperties:
additionalProperties:
$ref: '#/components/schemas/SearchandizedItem'
type: object
title: SearchandizedItems
type: object
SortOrderType:
enum:
- ascending
- descending
title: SortOrderType
type: string
VariationsMap:
properties:
filter_by:
description: A filtering expression that should be used to filter variations before doing any aggregations
allOf:
- $ref: '#/components/schemas/VariationsMapFilterBy'
title: Filter By
group_by:
description: An array of fields that should be used to group variations. Variations which share the value of all fields specified here will all fall under one group
title: Group By
items:
$ref: '#/components/schemas/VariationsMapGrouping'
maxItems: 5
type: array
values:
description: A set of aggregations that should be applied to each variation group. The object keys specify the name of the field under which each aggregated value will be returned in the response
title: Values
type: object
additionalProperties:
discriminator:
mapping:
all: '#/components/schemas/VariationsMapSimpleAggregation'
count: '#/components/schemas/VariationsMapCountAggregation'
distinct: '#/components/schemas/VariationsMapSimpleAggregation'
field_count: '#/components/schemas/VariationsMapSimpleAggregation'
first: '#/components/schemas/VariationsMapSimpleAggregation'
max: '#/components/schemas/VariationsMapSimpleAggregation'
min: '#/components/schemas/VariationsMapSimpleAggregation'
value_count: '#/components/schemas/VariationsMapValueCountAggregation'
propertyName: aggregation
oneOf:
- $ref: '#/components/schemas/VariationsMapSimpleAggregation'
- $ref: '#/components/schemas/VariationsMapCountAggregation'
- $ref: '#/components/schemas/VariationsMapValueCountAggregation'
dtype:
description: The expected data type of the variations_map objects in the response
enum:
- array
- object
title: Dtype
type: string
required:
- values
- dtype
title: VariationsMap
type: object
VariationsMapAnd:
additionalProperties: false
properties:
and_:
items:
type: array
title: And
type: array
required:
- and_
title: VariationsMapAnd
type: object
VariationsMapCountAggregation:
properties:
aggregation:
title: Aggregation
type: string
enum:
- count
required:
- aggregation
title: VariationsMapCountAggregation
type: object
VariationsMapFilterBy:
discriminator:
mapping:
and: '#/components/schemas/VariationsMapAnd'
not: '#/components/schemas/VariationsMapNot'
or: '#/components/schemas/VariationsMapOr'
range: '#/components/schemas/VariationsMapRange'
single: '#/components/schemas/VariationsMapSingleFilter'
propertyName: type
oneOf:
- $ref: '#/components/schemas/VariationsMapRange'
- $ref: '#/components/schemas/VariationsMapSingleFilter'
- $ref: '#/components/schemas/VariationsMapOr'
- $ref: '#/components/schemas/VariationsMapAnd'
- $ref: '#/components/schemas/VariationsMapNot'
title: VariationsMapFilterBy
VariationsMapGrouping:
properties:
name:
pattern: ^\w+([ ]?[\w]+)*$
title: Name
type: string
field:
minLength: 1
title: Field
type: string
required:
- name
- field
title: VariationsMapGrouping
type: object
VariationsMapNot:
additionalProperties: false
properties:
not_:
type: object
title: Not
required:
- not_
title: VariationsMapNot
type: object
VariationsMapOr:
additionalProperties: false
properties:
or_:
items:
type: array
title: Or
type: array
required:
- or_
title: VariationsMapOr
type: object
VariationsMapRange:
additionalProperties: false
properties:
field:
description: Path to a metadata field (dot-separated)
minLength: 1
title: Field
type: string
range:
description: This filter matches items where the specified field is within the specified range (min and max). The values are inclusive. Use "inf" for an unbounded upper limit or "-inf" for an unbounded lower limit.
items:
anyOf:
- enum:
- inf
- -inf
type: string
- type: integer
- type: number
maxItems: 2
minItems: 2
title: Range
type: array
required:
- field
- range
title: VariationsMapRange
type: object
VariationsMapSimpleAggregation:
properties:
aggregation:
enum:
- first
- all
- distinct
- min
- max
- field_count
title: Aggregation
type: string
field:
minLength: 1
title: Field
type: string
required:
- aggregation
- field
title: VariationsMapSimpleAggregation
type: object
VariationsMapSingleFilter:
additionalProperties: false
properties:
field:
description: Path to a metadata field (dot-separated)
minLength: 1
title: Field
type: string
value:
anyOf:
- type: boolean
- typ
# --- truncated at 32 KB (58 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/constructorio/refs/heads/main/openapi/constructorio-search-openapi.yml