)`. When a visitor signs
in and the `user_id` and `anonymous_id` are both present, the `anonymous_id` will be linked to the `user_id`
along with the past interactions associated with it.
maxLength: 1024
type: string
example: 86D51273AD8BF84217E1567B6CBE7152D7034404
timestamp:
title: Timestamp
description: >
The ISO-8601 timestamp specifying when the interaction occurred. If
the interaction just happened, leave it out and we
will default to the server's time. If you're importing data from the
past, make sure you provide a
timestamp. It is recommended to include milliseconds in the
timestamp to provide a higher time resolution.
Example:
```
{"timestamp": "2018-11-07T00:25:00.073876Z"}
```
type: string
format: date-time
miso_id:
title: Miso Id
description: >
Miso-generated unique Id for each recommendation or search result.
Maintaining this Id for
subsequent page views is important to Miso's performance, as we use
`miso_id` to track and fine-tune the
performance of personalization and search results. When a user
clicks on a recommendation or search result,
you should pass the associated `miso_id` to the next page view, and
associate the `miso_id` with the
interactions that take place on the page (e.g.
`product_detail_page_view`, `add_to_cart`,
`add_to_collection`, `like`, etc.). In this way, Miso will learn
which recommendations work and which didn't.
Example:
```
{"misoId": "123e4567-e89b-12d3-a456-426614174000"}
```
type: string
format: uuid
example: 123e4567-e89b-12d3-a456-426614174000
context:
$ref: '#/components/schemas/WebBasedContext'
x-konfig-properties:
context:
title: Context
description: >
Dictionary of extra information that provides useful context about
an interaction. We use context
information to make recommendations tailored not only for each user,
but also for their current browsing context.
For example, a user browsing on a desktop may have different
browsing behavior than a user browsing on mobile
phone. As another example, a user who gets to the site via a certain
campaign you run on Facebook may have very
different interests than a user who visits your site directly.
Context information is also useful for personalization for entirely
new visitors, as we can immediately
personalize their experiences based on their context alone (e.g. the
referrer or the campaign they clicked through).
Example:
```
{"context": {
"campaign":
{
"name": "spring_sale",
"source": "Google",
"medium": "cpc",
"term": "running+shoes",
"content": "textlink"
},
"truncated_ip": "1.1.1.0",
"locale": "en-US",
"region": "US East",
"page":
{
"url": "https://example.com/miso-tshirt-123ABC",
"referrer": "https://example.com/",
"title": "My Product Page"
},
"user_agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0)"
},
"custom_context": {
"other_context_var_1": "value_1",
"other_context_var_2": "value_2"
}
}
```
RecResponse:
title: RecResponse
required:
- data
type: object
properties:
message:
title: Message
type: string
default: success
data:
$ref: '#/components/schemas/BaseResponseBody'
Record:
title: Record
required:
- product_id
type: object
properties:
product_id:
title: Product Id
description: |2-
The unique identifier for the product.
maxLength: 512
type: string
example: 123ABC-S-Black
RecordWithAnswer:
title: RecordWithAnswer
required:
- product_id
- answer
type: object
properties:
product_id:
title: Product Id
description: >-
The unique identifier of the product whose content contains the
answer.
maxLength: 512
type: string
answer:
$ref: '#/components/schemas/Answer'
answer_block:
$ref: '#/components/schemas/AnswerBlock'
x-konfig-properties:
answer:
title: Answer
description: >-
The answer paragraph (i.e. a `` node) whose text content can
answer users' question.
answer_block:
title: Answer Block
description: |2-
In addition to the answer paragraph, we also return the **answer block**.
Answer block is the ancestor node of the answer paragraph that cover not only the answer, but also the relevant
context. This is particularly useful for applications that want to show
the answer itself but also the relevant context surrounding the answer.
Answer block is the smallest HTML element that contains the relevant context. However, not all the content
inside this node is relevant. You can use the `relevant_children_slice` to identify a portion inside this
block that is relevant to the answer.
RecordWithFound:
title: RecordWithFound
description: >-
Product record but support `_found=true / false` field. When
_found=false,
the product_id will not be available.
required:
- product_id
type: object
properties:
product_id:
title: Product Id
description: |2-
The unique identifier for the product.
maxLength: 512
type: string
example: 123ABC-S-Black
Refund:
title: refund
required:
- type
type: object
properties:
type:
title: Type
description: |
Used when a user requests a refund of products they bought.
enum:
- refund
type: string
product_ids:
title: Product Ids
description: >
Products or content the user is interacting with. This field is
required by
almost all the interaction types. We use `product_ids` to refer to
the product / content records that you upload to Miso.
Therefore, it is important to keep this consistent between the two
datasets.
Example:
```
{"product_ids": ["123ABC-BLACK", "123EFG-YELLOW"]}
```
type: array
items:
type: string
maxLength: 512
default: []
example:
- 123ABC-BLACK
product_group_ids:
title: Product Group Ids
description: >
The product groups the user is interacting with. You only need this
field if you model product
variants using `product_id` and `product_group_id` (see Product
API). If so, you should use this field, when a
user is interacting with a *product group* rather than a specific
product variant, for example, when the user
is viewing the master page of a T-shirt (i.e. a product group), but
has not selected the specific size or
color (i.e. a product variant) yet.
In such situations, the `product_id` is not applicable because we
only know the user is interested in
this T-shirt (a product group), but don't know which particular
product variant the user is interested in.
Therefore, we use `product_group_ids` to capture such interactions
in place of `product_ids`.
In the situations where specific `product_ids` are available, for
example, when user selected a particular size
of the T-Shirt, use `product_ids` instead.
Example:
```
{"product_group_ids": ["123ABC"]}
```
type: array
items:
type: string
maxLength: 512
example:
- 123ABC
user_id:
title: User Id
description: >-
Identifies the signed-in user who performed the interaction. We will
use `user_id` to link Interaction records to your
User records. Therefore, it is important to keep this consistent between the two datasets.For visitors who have
not signed in, see `anonymous_id`.
maxLength: 512
type: string
example: user_1234
anonymous_id:
title: Anonymous Id
description: >-
A pseudo-unique substitute for the User Id. We use `anonymous_id` to
identify a visitor who has not signed
in. `anonymous_id` can be implemented using mechanisms such as cookies or browser localStorage. If `anonymous_id`
is not given, we will default it to `SHA1(:::)`. When a visitor signs
in and the `user_id` and `anonymous_id` are both present, the `anonymous_id` will be linked to the `user_id`
along with the past interactions associated with it.
maxLength: 1024
type: string
example: 86D51273AD8BF84217E1567B6CBE7152D7034404
timestamp:
title: Timestamp
description: >
The ISO-8601 timestamp specifying when the interaction occurred. If
the interaction just happened, leave it out and we
will default to the server's time. If you're importing data from the
past, make sure you provide a
timestamp. It is recommended to include milliseconds in the
timestamp to provide a higher time resolution.
Example:
```
{"timestamp": "2018-11-07T00:25:00.073876Z"}
```
type: string
format: date-time
miso_id:
title: Miso Id
description: >
Miso-generated unique Id for each recommendation or search result.
Maintaining this Id for
subsequent page views is important to Miso's performance, as we use
`miso_id` to track and fine-tune the
performance of personalization and search results. When a user
clicks on a recommendation or search result,
you should pass the associated `miso_id` to the next page view, and
associate the `miso_id` with the
interactions that take place on the page (e.g.
`product_detail_page_view`, `add_to_cart`,
`add_to_collection`, `like`, etc.). In this way, Miso will learn
which recommendations work and which didn't.
Example:
```
{"misoId": "123e4567-e89b-12d3-a456-426614174000"}
```
type: string
format: uuid
example: 123e4567-e89b-12d3-a456-426614174000
context:
$ref: '#/components/schemas/WebBasedContext'
x-konfig-properties:
context:
title: Context
description: >
Dictionary of extra information that provides useful context about
an interaction. We use context
information to make recommendations tailored not only for each user,
but also for their current browsing context.
For example, a user browsing on a desktop may have different
browsing behavior than a user browsing on mobile
phone. As another example, a user who gets to the site via a certain
campaign you run on Facebook may have very
different interests than a user who visits your site directly.
Context information is also useful for personalization for entirely
new visitors, as we can immediately
personalize their experiences based on their context alone (e.g. the
referrer or the campaign they clicked through).
Example:
```
{"context": {
"campaign":
{
"name": "spring_sale",
"source": "Google",
"medium": "cpc",
"term": "running+shoes",
"content": "textlink"
},
"truncated_ip": "1.1.1.0",
"locale": "en-US",
"region": "US East",
"page":
{
"url": "https://example.com/miso-tshirt-123ABC",
"referrer": "https://example.com/",
"title": "My Product Page"
},
"user_agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0)"
},
"custom_context": {
"other_context_var_1": "value_1",
"other_context_var_2": "value_2"
}
}
```
RemoveFromCart:
title: remove_from_cart
required:
- type
type: object
properties:
type:
title: Type
description: |
Used when a user removes a product from their shopping cart.
enum:
- remove_from_cart
type: string
product_ids:
title: Product Ids
description: >
Products or content the user is interacting with. This field is
required by
almost all the interaction types. We use `product_ids` to refer to
the product / content records that you upload to Miso.
Therefore, it is important to keep this consistent between the two
datasets.
Example:
```
{"product_ids": ["123ABC-BLACK", "123EFG-YELLOW"]}
```
type: array
items:
type: string
maxLength: 512
default: []
example:
- 123ABC-BLACK
product_group_ids:
title: Product Group Ids
description: >
The product groups the user is interacting with. You only need this
field if you model product
variants using `product_id` and `product_group_id` (see Product
API). If so, you should use this field, when a
user is interacting with a *product group* rather than a specific
product variant, for example, when the user
is viewing the master page of a T-shirt (i.e. a product group), but
has not selected the specific size or
color (i.e. a product variant) yet.
In such situations, the `product_id` is not applicable because we
only know the user is interested in
this T-shirt (a product group), but don't know which particular
product variant the user is interested in.
Therefore, we use `product_group_ids` to capture such interactions
in place of `product_ids`.
In the situations where specific `product_ids` are available, for
example, when user selected a particular size
of the T-Shirt, use `product_ids` instead.
Example:
```
{"product_group_ids": ["123ABC"]}
```
type: array
items:
type: string
maxLength: 512
example:
- 123ABC
user_id:
title: User Id
description: >-
Identifies the signed-in user who performed the interaction. We will
use `user_id` to link Interaction records to your
User records. Therefore, it is important to keep this consistent between the two datasets.For visitors who have
not signed in, see `anonymous_id`.
maxLength: 512
type: string
example: user_1234
anonymous_id:
title: Anonymous Id
description: >-
A pseudo-unique substitute for the User Id. We use `anonymous_id` to
identify a visitor who has not signed
in. `anonymous_id` can be implemented using mechanisms such as cookies or browser localStorage. If `anonymous_id`
is not given, we will default it to `SHA1(:::)`. When a visitor signs
in and the `user_id` and `anonymous_id` are both present, the `anonymous_id` will be linked to the `user_id`
along with the past interactions associated with it.
maxLength: 1024
type: string
example: 86D51273AD8BF84217E1567B6CBE7152D7034404
timestamp:
title: Timestamp
description: >
The ISO-8601 timestamp specifying when the interaction occurred. If
the interaction just happened, leave it out and we
will default to the server's time. If you're importing data from the
past, make sure you provide a
timestamp. It is recommended to include milliseconds in the
timestamp to provide a higher time resolution.
Example:
```
{"timestamp": "2018-11-07T00:25:00.073876Z"}
```
type: string
format: date-time
miso_id:
title: Miso Id
description: >
Miso-generated unique Id for each recommendation or search result.
Maintaining this Id for
subsequent page views is important to Miso's performance, as we use
`miso_id` to track and fine-tune the
performance of personalization and search results. When a user
clicks on a recommendation or search result,
you should pass the associated `miso_id` to the next page view, and
associate the `miso_id` with the
interactions that take place on the page (e.g.
`product_detail_page_view`, `add_to_cart`,
`add_to_collection`, `like`, etc.). In this way, Miso will learn
which recommendations work and which didn't.
Example:
```
{"misoId": "123e4567-e89b-12d3-a456-426614174000"}
```
type: string
format: uuid
example: 123e4567-e89b-12d3-a456-426614174000
context:
$ref: '#/components/schemas/WebBasedContext'
x-konfig-properties:
context:
title: Context
description: >
Dictionary of extra information that provides useful context about
an interaction. We use context
information to make recommendations tailored not only for each user,
but also for their current browsing context.
For example, a user browsing on a desktop may have different
browsing behavior than a user browsing on mobile
phone. As another example, a user who gets to the site via a certain
campaign you run on Facebook may have very
different interests than a user who visits your site directly.
Context information is also useful for personalization for entirely
new visitors, as we can immediately
personalize their experiences based on their context alone (e.g. the
referrer or the campaign they clicked through).
Example:
```
{"context": {
"campaign":
{
"name": "spring_sale",
"source": "Google",
"medium": "cpc",
"term": "running+shoes",
"content": "textlink"
},
"truncated_ip": "1.1.1.0",
"locale": "en-US",
"region": "US East",
"page":
{
"url": "https://example.com/miso-tshirt-123ABC",
"referrer": "https://example.com/",
"title": "My Product Page"
},
"user_agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0)"
},
"custom_context": {
"other_context_var_1": "value_1",
"other_context_var_2": "value_2"
}
}
```
RemoveFromCollection:
title: remove_from_collection
required:
- type
type: object
properties:
type:
title: Type
description: |
Used when a user removes a product from their personal collection.
enum:
- remove_from_collection
type: string
product_ids:
title: Product Ids
description: >
Products or content the user is interacting with. This field is
required by
almost all the interaction types. We use `product_ids` to refer to
the product / content records that you upload to Miso.
Therefore, it is important to keep this consistent between the two
datasets.
Example:
```
{"product_ids": ["123ABC-BLACK", "123EFG-YELLOW"]}
```
type: array
items:
type: string
maxLength: 512
default: []
example:
- 123ABC-BLACK
product_group_ids:
title: Product Group Ids
description: >
The product groups the user is interacting with. You only need this
field if you model product
variants using `product_id` and `product_group_id` (see Product
API). If so, you should use this field, when a
user is interacting with a *product group* rather than a specific
product variant, for example, when the user
is viewing the master page of a T-shirt (i.e. a product group), but
has not selected the specific size or
color (i.e. a product variant) yet.
In such situations, the `product_id` is not applicable because we
only know the user is interested in
this T-shirt (a product group), but don't know which particular
product variant the user is interested in.
Therefore, we use `product_group_ids` to capture such interactions
in place of `product_ids`.
In the situations where specific `product_ids` are available, for
example, when user selected a particular size
of the T-Shirt, use `product_ids` instead.
Example:
```
{"product_group_ids": ["123ABC"]}
```
type: array
items:
type: string
maxLength: 512
example:
- 123ABC
user_id:
title: User Id
description: >-
Identifies the signed-in user who performed the interaction. We will
use `user_id` to link Interaction records to your
User records. Therefore, it is important to keep this consistent between the two datasets.For visitors who have
not signed in, see `anonymous_id`.
maxLength: 512
type: string
example: user_1234
anonymous_id:
title: Anonymous Id
description: >-
A pseudo-unique substitute for the User Id. We use `anonymous_id` to
identify a visitor who has not signed
in. `anonymous_id` can be implemented using mechanisms such as cookies or browser localStorage. If `anonymous_id`
is not given, we will default it to `SHA1(:::)`. When a visitor signs
in and the `user_id` and `anonymous_id` are both present, the `anonymous_id` will be linked to the `user_id`
along with the past interactions associated with it.
maxLength: 1024
type: string
example: 86D51273AD8BF84217E1567B6CBE7152D7034404
timestamp:
title: Timestamp
description: >
The ISO-8601 timestamp specifying when the interaction occurred. If
the interaction just happened, leave it out and we
will default to the server's time. If you're importing data from the
past, make sure you provide a
timestamp. It is recommended to include milliseconds in the
timestamp to provide a higher time resolution.
Example:
```
{"timestamp": "2018-11-07T00:25:00.073876Z"}
```
type: string
format: date-time
miso_id:
title: Miso Id
description: >
Miso-generated unique Id for each recommendation or search result.
Maintaining this Id for
subsequent page views is important to Miso's performance, as we use
`miso_id` to track and fine-tune the
performance of personalization and search results. When a user
clicks on a recommendation or search result,
you should pass the associated `miso_id` to the next page view, and
associate the `miso_id` with the
interactions that take place on the page (e.g.
`product_detail_page_view`, `add_to_cart`,
`add_to_collection`, `like`, etc.). In this way, Miso will learn
which recommendations work and which didn't.
Example:
```
{"misoId": "123e4567-e89b-12d3-a456-426614174000"}
```
type: string
format: uuid
example: 123e4567-e89b-12d3-a456-426614174000
context:
$ref: '#/components/schemas/WebBasedContext'
x-konfig-properties:
context:
title: Context
description: >
Dictionary of extra information that provides useful context about
an interaction. We use context
information to make recommendations tailored not only for each user,
but also for their current browsing context.
For example, a user browsing on a desktop may have different
browsing behavior than a user browsing on mobile
phone. As another example, a user who gets to the site via a certain
campaign you run on Facebook may have very
different interests than a user who visits your site directly.
Context information is also useful for personalization for entirely
new visitors, as we can immediately
personalize their experiences based on their context alone (e.g. the
referrer or the campaign they clicked through).
Example:
```
{"context": {
"campaign":
{
"name": "spring_sale",
"source": "Google",
"medium": "cpc",
"term": "running+shoes",
"content": "textlink"
},
"truncated_ip": "1.1.1.0",
"locale": "en-US",
"region": "US East",
"page":
{
"url": "https://example.com/miso-tshirt-123ABC",
"referrer": "https://example.com/",
"title": "My Product Page"
},
"user_agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0)"
},
"custom_context": {
"other_context_var_1": "value_1",
"other_context_var_2": "value_2"
}
}
```
Search:
title: search
required:
- type
type: object
properties:
type:
title: Type
description: >
Used to record a search event with the keywords and filters the user
used. What a user searches for
is a very powerful signal about their interests and what they will
eventually buy or consume, so it is important
to capture this information with high fidelity.
enum:
- search
type: string
user_id:
title: User Id
description: >-
Identifies the signed-in user who performed the interaction. We will
use `user_id` to link Interaction records to your
User records. Therefore, it is important to keep this consistent between the two datasets.For visitors who have
not signed in, see `anonymous_id`.
maxLength: 512
type: string
example: user_1234
anonymous_id:
title: Anonymous Id
description: >-
A pseudo-unique substitute for the User Id. We use `anonymous_id` to
identify a visitor who has not signed
in. `anonymous_id` can be implemented using mechanisms such as cookies or browser localStorage. If `anonymous_id`
is not given, we will default it to `SHA1(:::)`. When a visitor signs
in and the `user_id` and `anonymous_id` are both present, the `anonymous_id` will be linked to the `user_id`
along with the past interactions associated with it.
maxLength: 1024
type: string
example: 86D51273AD8BF84217E1567B6CBE7152D7034404
timestamp:
title: Timestamp
description: >
The ISO-8601 timestamp specifying when the interaction occurred. If
the interaction just happened, leave it out and we
will default to the server's time. If you're importing data from the
past, make sure you provide a
timestamp. It is recommended to include milliseconds in the
timestamp to provide a higher time resolution.
Example:
```
{"timestamp": "2018-11-07T00:25:00.073876Z"}
```
type: string
format: date-time
miso_id:
title: Miso Id
description: >
Miso-generated unique Id for each recommendation or search result.
Maintaining this Id for
subsequent page views is important to Miso's performance, as we use
`miso_id` to track and fine-tune the
performance of personalization and search results. When a user
clicks on a recommendation or search result,
you should pass the associated `miso_id` to the next page view, and
associate the `miso_id` with the
interactions that take place on the page (e.g.
`product_detail_page_view`, `add_to_cart`,
`add_to_collection`, `like`, etc.). In this way, Miso will learn
which recommendations work and which didn't.
Example:
```
{"misoId": "123e4567-e89b-12d3-a456-426614174000"}
```
type: string
format: uuid
example: 123e4567-e89b-12d3-a456-426614174000
context:
$ref: '#/components/schemas/WebBasedContext'
search:
$ref: '#/components/schemas/SearchInformation'
x-konfig-properties:
context:
title: Context
description: >
Dictionary of extra information that provides useful context about
an interaction. We use context
information to make recommendations tailored not only for each user,
but also for their current browsing context.
For example, a user browsing on a desktop may have different
browsing behavior than a user browsing on mobile
phone. As another example, a user who gets to the site via a certain
campaign you run on Facebook may have very
different interests than a user who visits your site directly.
Context information is also useful for personalization for entirely
new visitors, as we can immediately
personalize their experiences based on their context alone (e.g. the
referrer or the campaign they clicked through).
Example:
```
{"context": {
"campaign":
{
"name": "spring_sale",
"source": "Google",
"medium": "cpc",
"term": "running+shoes",
"content": "textlink"
},
"truncated_ip": "1.1.1.0",
"locale": "en-US",
"region": "US East",
"page":
{
"url": "https://example.com/miso-tshirt-123ABC",
"referrer": "https://example.com/",
"title": "My Product Page"
},
"user_agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0)"
},
"custom_context": {
"other_context_var_1": "value_1",
"other_context_var_2": "value_2"
}
}
```
search:
title: Search
description: >
The search keywords and filters the user uses. This is only required
by `search` interaction.
SearchInformation:
title: SearchInformation
type: object
properties:
keywords:
title: Keywords
description: >
The search keywords user use. Search keywords are strong signals to
users' interests.
type: string
default: ''
filters:
title: Filters
description: >
Dictionary of filters users apply to the search results in the
following format:
`{"FIELD": ["SELECTION_1", "SELECTION_2"]}`.
type: object
additionalProperties:
type: array
items:
type: string
SearchRequest:
title: SearchRequest
type: object
properties:
engine_id:
title: Engine Id
description: >
The engine you want to get results from. When you have more than one
engine, you can use this parameter to
specify the specific engine you want to get results from. If not
specified, the default engine will be used.
type: string
user_id:
title: User Id
description: >
The user who made the query and for whom Miso will personalize the
results. For an anonymous visitor, use `anonymous_id` instead.
type: string
anonymous_id:
title: Anonymous Id
description: >-
The anonymous visitor who made the query and for whom Miso will
personalize the results. Either
`user_id` or `anonymous_id` needs to be specified for personalization to work.
type: string
user_hash:
title: User Hash
description: >
The hash of `user_id` (or `anonymous_id`) encrypted by your [Secret
API Key](https://api.askmiso.com).
`user_hash` is required to prevent unauthorized API access if you
are
making API calls with a [Publishable API
Key](https://api.askmiso.com).
You should generate the user_hash via HMAC scheme: you encrypt the
desired user_id (or anonymous_id) with your
[Secret API Key](https://api.askmiso.com) on your backend server,
and then let the front-end code send the generated user_hash to Miso
APIs to
verify the identity of the API caller.
As long as the [Secret API Key](https://api.askmiso.com)
is kept secret, the user_hash prevents a malicious attacker from making unauthorized
API calls or impersonating any of your users.
Miso APIs accept the case-incentive "hex digest" of user hash, a
sample Python 3 code to generate it on your backend server
is as follow:
```python
import hashlib
import hmac
YOUR_MISO_SECRET_API_KEY = "039c501ac8dfcac91"
key_bytes = YOUR_MISO_SECRET_API_KEY.encode()
user_id = "USER_123" # or anonymous_id
user_id_bytes = user_id.encode()
user_hash = hmac.new(
key_bytes,
user_id_bytes,
hashlib.sha256).hexdigest()
# user_hash is "7eb04da5e..."
```
You can find more examples for other languages in this [Github
Gist](https://gist.github.com/thewheat/7342c76ade46e7322c3e)
type: string
user_cohort:
title: User Cohort
description: >
The user cohort you want to cold-start the recommendation with. For
example, the following query will make
recommendations based on the preferences of the users whose
`country="United States"`, and `gender="Female"`
in the User Profile dataset.
```
{
"user_cohort": {
"country": "United States",
"gender": "Female"
}
}
```
type: object
additionalProperties:
anyOf:
- type: boolean
- type: string
rows:
title: Rows
description: Number of search results to return.
type: integer
default: 5
type:
title: Type
description: >
The type of products to return. Use this parameter to make the API
return only
a certain type of products (see [Product
APIs](https://api.askmiso.com)).
This is particularly useful for sites that have multiple types of
products:
For example, on a marketplace site, YOu may model *merchandise* and
*store* as two types of *products*. You can
then use type parameter to limit the recommendation or search
results to return only one kind of them.
For instance, the following query will return only *store* products:
```
{"type": "store"}
```
For another example, on a travel website, you might have: *hotel*,
*thing to do*, and *restaurant*,
three kinds
of products. You can use `type` parameter to limit results to one
kind of them. For instance, the following
query will limit the results to only *hotels* product:
```
{"type": "hotel"}
```
type: string
dedupe_product_group_id:
title: Dedupe Product Group Id
description: >
Whether to dedupe product based on `product_group_id`. If
`dedupe_product_group_id=true`,
Miso will prevent products with the same `product_group_id` from
showing multiple
times in the search or recommendation results.
This is particular useful when one product has multiple variants
(for example, different
sizes, colors, or materials), and you only want to show this product
only once in the search or recommendation
results. Miso will then return the variant that is most likely to be
of the user's interest.
type: boolean
default: true
additional_interactions:
title: Additional Interactions
description: >
A list of additional interaction records. You can use this fields to
simulate user interactions without
actually writing them to the interaction dataset.
type: array
items:
anyOf:
- $ref: '#/components/schemas/ProductDetailPageView'
- $ref: '#/components/schemas/Search'
- $ref: '#/components/schemas/AddToCart'
- $ref: '#/components/schemas/RemoveFromCart'
- $ref: '#/components/schemas/Checkout'
- $ref: '#/components/schemas/Refund'
- $ref: '#/components/schemas/Subscribe'
- $ref: '#/components/schemas/AddToCollection'
- $ref: '#/components/schemas/RemoveFromCollection'
- $ref: '#/components/schemas/Read'
- $ref: '#/components/schemas/Watch'
- $ref: '#/components/schemas/Listen'
- $ref: '#/components/schemas/Like'
- $ref: '#/components/schemas/Dislike'
- $ref: '#/components/schemas/Share'
- $ref: '#/components/schemas/Rate'
- $ref: '#/components/schemas/Bookmark'
- $ref: '#/components/schemas/Complete'
- $ref: '#/components/schemas/Feedback'
- $ref: '#/components/schemas/Impression'
- $ref: '#/components/schemas/ViewableImpression'
- $ref: '#/components/schemas/Click'
- $ref: '#/components/schemas/HomePageView'
- $ref: '#/components/schemas/CategoryPageView'
- $ref: '#/components/schemas/PromoPageView'
- $ref: '#/components/schemas/ProductImageView'
- $ref: '#/components/schemas/Custom'
default: []
fl:
title: Fl
description: >
List of fields to retrieve. For example, the following request
retrieves only the `title` field of each product along
with the `product_id`, which is always returned.
```
{"fl": ["title"]}
```
You can also match field names by using `*` as a wildcard. For
example, the query below retrieves the `title`
and any custom attributes under the `attributes` dictionary.
```
{"fl": ["title", "attributes.*"]}
```
The following retrieves all the available fields:
```
{"fl": ["*"]}
```
For the lowest latency, use an empty array to retrieve just the
`product_id` field (which is the default).
```
{"fl": []}
```
type: array
items:
type: string
default: []
exclude:
title: Exclude
description: >-
An array of `product_ids` of products you want to *exclude* from
search results.
type: array
items:
type: string
q:
title: Q
description: >
The search query the user has entered. Miso will perform full-text
search and find any Products
that contain every word in this query. You can also set `q="*"` to
match all Products, which is commonly used along
with Product filtering query `fq` to implement Category Pages.
*(to make a search request, You need to specify either `q` or
`advanced_q`)*
minLength: 1
type: string
advanced_q:
title: Advanced Q
description: >
Like Google's Advanced Search, the `advanced_q` parameter let you
define query beyond simple full-text
search. For one, you can use double-quotes to indicate a phrase
search.
For example, the following query will
only match Products that contain the *phrase* "Toy Story 4", and
will not match Products like "4 Toy Story"
(because the word order is not the same as the given query).
```
{"advanced_q": "full_text:\"Toy Story 4\""}
```
If you don't want phrase search, you can enclose the search terms
with parenthesis to indicate regular full-text query.
For example:
```
{"advanced_q": "full_text:(Toy Story 4)"}
```
You can also use AND/OR boolean operators to combine multiple
full-text queries. For example, the following query will match
Products with phrases "Toy Story 4" and Products with phrases "Toy
Story 3", and will not match "Toy Story 2" or "Toy Story 1":
```
{"advanced_q":
"full_text:\"Toy Story 4\" OR full_text:\"Toy Story 3\""}
```
Finally, you can use AND/OR boolean operators to combine full-text
search with metadata filtering.
For example, the following example will find Products with phrase
"Toy Story" OR Products which have Tom Hanks as an actor.
```
{"advanced_q":
"full_text:\"Toy Story\" OR
custom_attributes.actors:\"Tom Hanks\""}
```
*(to make a search request, You need to specify either `q` or
`advanced_q`)*
minLength: 1
type: string
boosting_tags:
title: Boosting Tags
description: >
When `boosting_tags` is given, and there are pre-defined boost rules
have the same tag(s),
those boost rules will be matched, regardless if the criteria is met
or not.
Useful when want to force trigger specific boost campaign.
type: array
items:
type: string
default: []
example:
- tag-1
- quetag-2
enable_boosting_campaigns:
title: Enable Boosting Campaigns
description: >
When set to true, enable user defined boosting campaigns.
By default boosting campaigns are enabled. But you can explicitly
set this to false to disable
boosting campaigns.
type: boolean
default: true
custom_context:
title: Custom Context
description: >
Dictionary of custom context variables for the current browsing
session. You can specify context variables
specific to your websites or apps in a `{"KEY":VALUE}` format, where
`KEY` must be a string, and `VALUE` can be:
* a `bool`
* a `string` or an `array of string`
* a `number` or an `array of numbers`
* an `array of objects`
* `null`
Miso will take these variables into account when generating
recommendations.
type: object
example:
session_variable_1:
- value_1
- value_2
language:
title: Language
description: >
Two-letter (639-1) language code of the search query. This parameter
is useful when you have a multilingual
product catalog that contains product metadata in different languages.
If given, the search results will prioritize the products that have that specific language and match the search
query. Example query:
```
{"language": "fr"}
```
If not given, Miso will search against all the languages in the
catalog.
type: string
like:
title: Like
description: >-
The text snippet that we want to find products that are similar to
it
type: string
category:
title: Category
description: >
`category` parameter limits the search results to a particular
category or sub-category.
This is particularly suitable for implementing Category Pages where
you want to show personalized ranking of Products under a specific
category. Other filters, such as `q`,
`fq`, `boost_fq` will be applied on top of the category filter.
A category is represented by a list of strings that correspond to
its category hierarchy.
For example, the following query returns Products under `Snacks`
category:
```
{
"q": "*",
"category": ["Snacks"]
}
```
And the following request returns Products under `Snacks -> Chips`
subcategory:
```
{
"q": "*",
"category": ["Snacks", "Chips"]
}
```
type: array
items:
type: string
spellcheck:
$ref: '#/components/schemas/SpellCheckRequest'
start:
title: Start
description: >
Specifies an offset from which Miso will begin returning results.
The default value is `0`. Setting the start parameter to some other
number, such as 3, causes Miso to skip over the
preceding products and start from the product identified by the
offset.
type: integer
default: 0
order_by:
title: Order By
description: >
A list of fields that Miso should use to sort the result, instead of
Miso's default ranking order.
For example, the following query returns all the Products (because
`q=*`), ranked by the `_personalization_score`
first, and then by the values in the
`custom_attributes.promote_score` field in the Product catalog, then
the
distance between the product and New York city.
```
{
"q": "*",
"order_by": [
{
"field": "_personalization_score",
"tie_breaker": {
"type": "relative_difference",
"threshold": "0.05"
},
"order": "desc"
},
{
"field": "custom_attributes.promote_score",
"order": "desc"
},
{
"field": "_geo_distance",
"geo": {
"lat": 40.711967,
"lon": -74.006076,
}
"order": "asc"
}
]
}
```
type: array
items:
$ref: '#/components/schemas/OrderByDefinition'
default: []
facets:
title: Facets
description: >
Specifies a list of fields to create facet search against. You can
specify `facets` in a string array.
For example, the following query return the facet counts for
`categories`, `tags`, and `custom_attributes.director`:
```
{
"facets": [
"categories",
"tags",
"custom_attributes.director"
]
}
```
The response will be like:
```
{
"facet_counts": {
"facet_fields": {
"categories": [
[
"Drama", 20
],
[
"Action", 10
], ...
],
"tags": [
[
"based on novel or book", 5
],
[
"android", 4
], ...
],
"custom_attributes.director": [
[
"Ridley Scott", 26
],
[
"Andrew Abbott", 1
], ...
}
}
```
You can also specify `facets` with an object array to configure each
facet individually.
For example, the following query will return 20 most common facet
values for `tags`
and `custom_attributes.director` fields,
and only the directors whose names start with `Ridley` will be
included in the director facet results.
```
{
"facets": [
{
"field": "tags",
"size": 20
},
{
"field": "custom_attributes.director",
"size": 20,
"include": "Ridley.*"
}
]
}
```
type: array
items:
anyOf:
- $ref: '#/components/schemas/FacetDefinition'
- type: string
default: []
facet_filters:
title: Facet Filters
description: >+
Specifies filters to the search results based on users' selections
in a faceted search UI.
For example, assume you have two facets in your faceted search UI:
`genres` and `custom_attributes.director`.
When the user selects two options in the
`custom_attributes.director` facet, you should send the following
query to
filter the search results for those two options (i.e. `Ridley Scott`
or `Denis Villeneuve`).
```
{
"facets": [
{
"field": "genres",
"size": 5
},
{
"field": "custom_attributes.director",
"size": 20
}
],
"facet_filters": {
"custom_attributes.director": {
"terms": [
"Ridley Scott",
"Denis Villeneuve"
]
}
},
}
```
While you can use `fq` parameter to achieve the same filtering
capability,
you should use `facet_filters` to get the correct facet counts.
In a typical faceted search UI, the facet counts reflect the search
result after applying
filters from **all but the current facets**. For example, in the
query below,
the *directors* facet counts
should reflect the search result after applying the filter from the *genres* facet, i.e. `genres:Sci-Fi`.
Similarly, *genres* facet counts should reflect the search result after applying the filter from the *directors* facet.
`facet_filters` will make the resulting `facet_counts` follow this
*all but except itself* convention, which is rather
tricky to implement with `fq`.
```
"facets": [
{
"field": "genres",
"size": 5
},
{
"field": "custom_attributes.director",
"size": 20
}
],
"facet_filters": {
"custom_attributes.director": {
"terms": [
"Ridley Scott",
"Denis Villeneuve"
]
}
},
}
```
type: object
additionalProperties:
$ref: '#/components/schemas/Filter'
default: {}
anchoring_settings:
title: Anchoring Settings
description: >
Promote a product to a position relative to the highest-ranked
anchor product.
A common use-case is promoting a private-label good by anchoring it
to a name-brand counterpart. When the name-brand good (the anchor)
appears in a search result, the private-label good also appears in
the result (at a specified distance from the anchor product).
The `anchoring_settings` object has the following fields:
* **product_id** - The `product_id` of the product you want to
promote.
* **anchor_ids** - The array of `product_ids` that act as the
anchors.
* **relative_position** *(optional)* - The position that the
promoted product will be returned in the search results, relative to
the highest-ranked anchor product. For example, setting this
parameter to `1` will place the promoted product directly after the
anchor product. The default value is `-1`, which will place the
promoted product directly before the anchor product.
* **start_time** *(optional)* - An ISO-8601 timestamp indicating
when to start the product anchoring. Ex: `2022-01-29T00:00:00Z`
* **end_time** *(optional)* - An ISO-8601 timestamp indicating when
to end the product anchoring. Ex: `2022-05-31T23:59:59Z`
For example, if a user searches for "cookies", the API request might
look like this:
```
POST v1/search/search
{
"q":"cookies",
"anchoring_settings": [
{
"product_id": "private_label_cookies",
"anchor_ids": [
"name_brand_cookies_1",
"name_brand_cookies_2"
],
"relative_position": -1,
"start_time": "2022-01-01T00:00:00Z",
"end_time": "2022-12-31T23:59:59Z"
}
}
]
}
```
type: array
items:
$ref: '#/components/schemas/AnchoringEntry'
default: []
enable_partial_match:
title: Enable Partial Match
description: >
Enable *partial match* to return products that match only *some* of
the keywords in a user's search query. By default,
Miso's Search API only returns products that contain *all* the
keywords in the search query (i.e. an AND operator over
keywords). This strategy usually leads to highly relevant results.
However, when we don't have enough search results to
return to the users, enabling partial match allows the Search API to
relax the criteria and return products that match
only some of the keywords.
This strategy is particularly useful to prevent users from seeing an
empty search result page and abandoning their
search.
For example, let's consider the query request below:
```
{
"query": "Toy story 5",
"enable_partial_match": true
}
```
Since there is no movie called "Toy story 5", we have zero products
to return by default. However, because we set `enable_partial_match`
to `true`, we will return other products that partially match the
query:
```
{
"data": {
"products": [
{
"title": "Toy Story",
"_missing_keywords": ["5"]
},
{
"title": "Toy story 2",
"_missing_keywords": ["5"]
},
...
],
"total": 4
}
}
```
As you can see from the result above, when we don't have the exact
product that the user is looking for, enabling partial match is a
helpful strategy to let users know what alternatives are available,
and prevent them from seeing an empty search result page.
type: boolean
default: false
partial_match_mode:
title: Partial Match Mode
description: >
Determine which partial match mode to enable:
* **blended** (default): When `partial_match_mode` is `blended`, keyword-matched items and semantically-matched items will
be returned in the same, rank-sorted array.
* **separated**: When `partial_match_mode` is `separated`, keyword-matched items will be returned in the `products` array
and partially-matched or semantically-matched items will be returned
in the `partially_matched_products` array.
enum:
- blended
- separated
default: blended
type: string
enable_partial_match_threshold:
title: Enable Partial Match Threshold
description: >
If `partial_match_mode=separated`, you need to provide a value for
`enable_partial_match_threshold`.
This parameter, which accepts an integer (*n*), creates a condition
for Miso’s Search Engine to only provide partially
matched results if there are *n* or fewer exact keyword matches. For
example, if we set `enable_partial_match_threshold=3`,
partially matched results will *only* be returned when there are
three or fewer exact keyword matches.
type: integer
enable_semantic_search:
title: Enable Semantic Search
description: >
Enable *semantic search* to return products that are semantically
relevant to the search query.
Semantic search is a powerful tool that further improves the partial
match results. It finds products that might not contain
any of the search keywords, but are highly relevant to users' search
intent.
For example, consider the query: `rubbing alcohol`, which is a
household cleaning product. When `enable_semantic_search=true`,
even if we do not have any products that match `rubbing alcohol`,
Miso is still able to return results like the
following:
```
{
"data": {
"products": [],
"total": 0,
"partially_matched_products": [
{
"title": "Clorox Disinfecting Wipes Multi-Surface Cleaning",
"_missing_keywords": ["rubbing", "alcohol"]
},
{
"title": "Purell Advanced Hand Sanitizer Refreshing Gel",
"_missing_keywords": ["rubbing", "alcohol"]
},
...
]
}
}
```
Note that, these two products from Clorox or Purell do not contain
any of the search keywords,
Miso's semantic search functionality, however, is still able to
identify them as good matches based on their semantic
relevancy to the query `rubbing alcohol`.
Similarly, consider a single word search query: `aspirin`. Normally,
a single-word query will lead to an empty search
page if we don't have products containing that word. However, when
`enable_semantic_search=true`,
even if we do not directly have `aspirin` in the product catalog,
Miso is still able to return results that are highly
relevant to users' search intent, such as:
```
{
"data": {
"products": [],
"total": 0,
"partially_matched_products": [
{
"title": "Advil Pain Reliever and Fever Reducer",
"_missing_keywords": ["aspirin"]
},
{
"title": "Tylenol Extra Strength Caplets",
"_missing_keywords": ["aspirin"]
},
...
]
}
}
```
type: boolean
default: false
semantic_search_threshold:
title: Semantic Search Threshold
description: >
Determine the threshold for semantic search. Only the products with
a semantic similarity score higher than the
threshold will be returned. Setting this too low (e.g. < 0.3) will
result in less relevant results being returned.
type: number
default: 0.5
enable_matched_fields:
title: Enable Matched Fields
description: >+
Determine whether to return `_matched_fields` in the search response
(default: false).
If `enable_matched_fields=true`,
each returned product will have an `_matched_fields` array that
shows which parts of the product catalog match
the search query.
For example, the following request will return `_matched_fields`:
```
{
"q": "toy story",
"enable_matched_fields": true
}
```
The response will be like:
```
{
"data": {
"products": [
{
"title": "Toy Story",
"_matched_fields": ["title", "metadata"]
},
...
]
}
}
```
Currently, `_matched_fields` only contain three kinds of fields:
* `title`
* `description`
* `metadata`, including all the fields beyond title or description in the product catalog.
type: boolean
default: false
query_product_existence:
$ref: '#/components/schemas/CheckProductExistence'
personalization_weight:
title: Personalization Weight
description: Determines how much personalization will affect the search ranking.
maximum: 5
minimum: 0
type: integer
default: 5
fq:
title: Fq
description: >
Defines a query in Solr syntax that can be used to restrict the
superset of
products to return, without influencing the overall ranking. `fq`
can enable users to drill down to products
with specific features based on different product attributes
For example, the query below limits the search results to only show
products whose size is either `M` or `S` and
brand is `Nike`:
```
{"fq": "size:(\"M\" OR \"S\") AND brand:\"Nike\""}
```
You can use `fq` to apply filters against your custom attributes as
well. For example, the query below limits the
search results to only products whose `designer` attribute is
`Calvin Klein`
```
{"fq": "attributes.designer:\"Calvin Klein\""}
```
`fq` can also limit search results by numerical range. For example,
the following query limits the results to
products that have `rating >= 4`.
```
{"fq": "rating:[4 TO *]"}
```
type: string
boost_fq:
title: Boost Fq
description: >
Defines a query in Solr syntax that can be used to boost a subset of
products to the top of the ranking, or to
specific *boost positions* (See `boost_positions` parameter below.)
For example, the query below will promote all the relevant products
whose brand is `Nike` to the top of
recommendation list:
```
{
"boost_fq": "brand:\"Nike\""
}
```
For a slightly more complex example, the query below will promote
the Nike products which have also been tagged
as `ON SALE` to the top of the ranking:
```
{
"boost_fq": "brand:\"Nike\" AND tags:\"ON SALE\""
}
```
It is worth mentioning that, Miso will only boost products that are
relevant and have high likelihood to convert,
and will not boost a low performance product only because it matches
the boosting query.
Depending on your boosting rules, in certain cases, you would like
to prevent recommendation results from being
too monotone due to boosting. With Miso, you have two tools to do
so.
First, you can specify `boost_positions` to place promoted products
at specific positions in the ranking. For
example, the query below will place boosted products only at the
first and fourth places in the ranking
(positions are 0-based), and place the remaining products in their
original ranking, skipping these two positions.
```
{
"boost_fq": "brand:\"Nike\" AND tags:\"ON SALE\"",
"boost_positions": [0, 3]
}
```
The second tool is `diversification`. `diversification` parameter,
on a best-effort basis, will try to
maintain a minimum distance between products that have the same
attributes. For example, the following query
will place products made by the same brand apart from each other.
```
{
"boost_fq": "brand:\"Nike\" AND tags:\"ON SALE\"",
"diversification": {
"brand": {"minimum_distance": 1}
}
}
```
type: string
boost_positions:
title: Boost Positions
description: >
Defines a list of 0-based positions you want to place the boosted
products at.
For example, the query below will promote products whose brand is
`Nike` as the top and second recommendations:
```
{
"boost_fq": "brand:\"Nike\"",
"boost_positions": [0, 1]
}
```
If `boost_positions` is not specified (which is the default
behavior), all the boosted products will be ranked
higher than the rest of the products.
type: array
items:
type: integer
boost_rules:
title: Boost Rules
description: >
Define a list of boosting rules that will be applied to the search
or recommendation results simultaneously. `boost_rules`
parameter is particularly useful when you want to boost more than
one sets of products, and promote each of them to different
positions. For example, the query below will promote products whose
brand is `Nike` to the top
and second results, and products whose brand is `Adidas` to the
third and fourth results:
```
{
"boost_rules": [
{
"boost_fq": "brand:\"Nike\"",
"boost_positions": [0, 1]
},
{
"boost_fq": "brand:\"Adidas\"",
"boost_positions": [2, 3]
}
]
}
```
type: array
items:
$ref: '#/components/schemas/BoostingFilterBase'
default: []
geo:
$ref: '#/components/schemas/GeoQuery'
diversification:
title: Diversification
description: >
Defines diversification rules to prevent products with the same
attributes (e.g. sneakers made by the same brand
or books from the same authors) from showing up too close to each
other in the results.
For instance, customers who have purchased many of sneakers from
Nike may happen to have recommendations or
search results where all top-5 entries are sneakers made by Nike.
Purely considering accuracy, these
recommendations appear excellent since the user clearly appreciates
Nike sneakers. However,
such results might be considered too "plain" by the user, owing to
its lack of diversity.
`diversification` parameter allows you to avoid this problem by
enforcing a desired *minimum distance* between
products. For example, consider a list of four products whose
`brand` are *Nike, Nike, Adidas,* and *PUMA*
respectively. The query below will make sure there are at least one
different product between two Nike
products, e.g. the diversified ranking may become *Nike, Adidas,
Nike,* and *PUMA* :
```
{
"diversification": {"brand": {"minimum_distance": 1}}
}
```
You can also increase the minimum_distance to place products further
apart. For example, the following query will
make sure, for the two Nike products, there are at least *two* other
products between them.
As a result, the diversified ranking may become *Nike, Adidas,
PUMA*, and *Nike*.:
```
{
"diversification": {"brand": {"minimum_distance": 2}}
}
```
The diversification algorithm reranks the products on a best-effort
basis. For example, for the product list
described earlier, it is not possible to place two Nike product
three places apart from each other. Therefore,
the diversified ranking will still remain *Nike, Adidas, PUMA,* and
Nike* even if we set `minimum_distance=3`.
type: object
additionalProperties:
$ref: '#/components/schemas/DiversifyField'
x-konfig-properties:
spellcheck:
title: Spellcheck
description: Spellcheck configuration
default:
enable_auto_spelling_correction: true
query_product_existence:
title: Query Product Existence
description: >-
Additionally check if certain products will be in the search result
at all (regardless of `start` and `rows` parameters)
geo:
title: Geo
description: >
When set, filter result to include only products within certain
geographic range from given point will be returned,
or to boost product within the same range.
Product should have a field that holds the location of the product,
`location` is used by default,
but other field can also be used.
Distance can be in miles or kilometers. If `distance_unit` is not
set, `mile` will be used.
For example, to limit results to products within 100 miles of New
York city:
```
{
"geo": {
"filter": [{
"lat": 40.73061,
"lon": -73.93524,
"distance": 100
}]
}
}
```
To boost products within 2 kilometers around Alcatraz Island
according to `loc` field:
```
{
"geo": {
"boost": [{
"field": "loc",
"lat": 37.82667,
"lon": -122.42278,
"distance": 2,
"distance_unit": "km"
}]
}
}
```
SearchResponse:
title: SearchResponse
required:
- data
type: object
properties:
message:
title: Message
type: string
default: success
data:
$ref: '#/components/schemas/SearchResponseBody'
SearchResponseBody:
title: SearchResponseBody
required:
- products
- total
- start
- spellcheck
type: object
properties:
took:
title: Took
description: Number of milliseconds Miso took to retrieve the results.
type: integer
default: 0
miso_id:
title: Miso Id
description: >
Miso-generated unique Id for each recommendation or search result.
Maintaining this Id for
subsequent page views is important to Miso's performance as we use
`miso_id` to track and fine-tune the
performance of personalization and search results. When a user
clicks on a recommendation or search result,
you should pass the associated `miso_id` to the next page view, and
associate the `miso_id` with the
interactions that take place on the page (e.g.
`product_detail_page_view`, `add_to_cart`,
`add_to_collection`, `like`, etc.). In this way, Miso will learn
which recommendations work and which didn't.
Example:
```
{"misoId": "123e4567-e89b-12d3-a456-426614174000"}
```
type: string
format: uuid
default: 00000000-0000-0000-0000-000000000000
example: 123e4567-e89b-12d3-a456-426614174000
products:
title: Products
description: The search results.
type: array
items:
$ref: '#/components/schemas/PartialMatchedRecord'
total:
title: Total
description: Total number of search hits.
type: integer
example: 1000
start:
title: Start
description: Starting offset of the search results.
type: integer
example: 0
spellcheck:
$ref: '#/components/schemas/SpellCheckResponse'
product_existence:
title: Product Existence
description: Product existence query result
type: object
additionalProperties:
type: boolean
partially_matched_products:
title: Partially Matched Products
description: The search results that only partially match the search query.
type: array
items:
$ref: '#/components/schemas/PartialMatchedRecord'
facet_counts:
$ref: '#/components/schemas/FacetCounts'
custom_assets:
title: Custom Assets
description: Custom JSON assets uploaded in Dojo.
type: array
items:
type: object
default: []
x-konfig-properties:
spellcheck:
title: Spellcheck
description: >-
Spellcheck results. You can use the information in this object to
prompt users with the correct spelling.
facet_counts:
title: Facet Counts
description: Facet counts
default: {}
SendExperimentResponse:
title: SendExperimentResponse
required:
- took
- in_experiment
- variant
type: object
properties:
took:
title: Took
description: >-
The amount of time (in milliseconds) Miso took to answer this
request.
type: integer
example: 50
in_experiment:
title: In Experiment
description: To show whether the experiment is active or not.
type: boolean
variant:
$ref: '#/components/schemas/VariantObject'
Share:
title: share
required:
- type
type: object
properties:
type:
title: Type
description: |
Used when a user shares a product or piece of content.
enum:
- share
type: string
product_ids:
title: Product Ids
description: >
Products or content the user is interacting with. This field is
required by
almost all the interaction types. We use `product_ids` to refer to
the product / content records that you upload to Miso.
Therefore, it is important to keep this consistent between the two
datasets.
Example:
```
{"product_ids": ["123ABC-BLACK", "123EFG-YELLOW"]}
```
type: array
items:
type: string
maxLength: 512
default: []
example:
- 123ABC-BLACK
product_group_ids:
title: Product Group Ids
description: >
The product groups the user is interacting with. You only need this
field if you model product
variants using `product_id` and `product_group_id` (see Product
API). If so, you should use this field, when a
user is interacting with a *product group* rather than a specific
product variant, for example, when the user
is viewing the master page of a T-shirt (i.e. a product group), but
has not selected the specific size or
color (i.e. a product variant) yet.
In such situations, the `product_id` is not applicable because we
only know the user is interested in
this T-shirt (a product group), but don't know which particular
product variant the user is interested in.
Therefore, we use `product_group_ids` to capture such interactions
in place of `product_ids`.
In the situations where specific `product_ids` are available, for
example, when user selected a particular size
of the T-Shirt, use `product_ids` instead.
Example:
```
{"product_group_ids": ["123ABC"]}
```
type: array
items:
type: string
maxLength: 512
example:
- 123ABC
user_id:
title: User Id
description: >-
Identifies the signed-in user who performed the interaction. We will
use `user_id` to link Interaction records to your
User records. Therefore, it is important to keep this consistent between the two datasets.For visitors who have
not signed in, see `anonymous_id`.
maxLength: 512
type: string
example: user_1234
anonymous_id:
title: Anonymous Id
description: >-
A pseudo-unique substitute for the User Id. We use `anonymous_id` to
identify a visitor who has not signed
in. `anonymous_id` can be implemented using mechanisms such as cookies or browser localStorage. If `anonymous_id`
is not given, we will default it to `SHA1(:::)`. When a visitor signs
in and the `user_id` and `anonymous_id` are both present, the `anonymous_id` will be linked to the `user_id`
along with the past interactions associated with it.
maxLength: 1024
type: string
example: 86D51273AD8BF84217E1567B6CBE7152D7034404
timestamp:
title: Timestamp
description: >
The ISO-8601 timestamp specifying when the interaction occurred. If
the interaction just happened, leave it out and we
will default to the server's time. If you're importing data from the
past, make sure you provide a
timestamp. It is recommended to include milliseconds in the
timestamp to provide a higher time resolution.
Example:
```
{"timestamp": "2018-11-07T00:25:00.073876Z"}
```
type: string
format: date-time
miso_id:
title: Miso Id
description: >
Miso-generated unique Id for each recommendation or search result.
Maintaining this Id for
subsequent page views is important to Miso's performance, as we use
`miso_id` to track and fine-tune the
performance of personalization and search results. When a user
clicks on a recommendation or search result,
you should pass the associated `miso_id` to the next page view, and
associate the `miso_id` with the
interactions that take place on the page (e.g.
`product_detail_page_view`, `add_to_cart`,
`add_to_collection`, `like`, etc.). In this way, Miso will learn
which recommendations work and which didn't.
Example:
```
{"misoId": "123e4567-e89b-12d3-a456-426614174000"}
```
type: string
format: uuid
example: 123e4567-e89b-12d3-a456-426614174000
context:
$ref: '#/components/schemas/WebBasedContext'
x-konfig-properties:
context:
title: Context
description: >
Dictionary of extra information that provides useful context about
an interaction. We use context
information to make recommendations tailored not only for each user,
but also for their current browsing context.
For example, a user browsing on a desktop may have different
browsing behavior than a user browsing on mobile
phone. As another example, a user who gets to the site via a certain
campaign you run on Facebook may have very
different interests than a user who visits your site directly.
Context information is also useful for personalization for entirely
new visitors, as we can immediately
personalize their experiences based on their context alone (e.g. the
referrer or the campaign they clicked through).
Example:
```
{"context": {
"campaign":
{
"name": "spring_sale",
"source": "Google",
"medium": "cpc",
"term": "running+shoes",
"content": "textlink"
},
"truncated_ip": "1.1.1.0",
"locale": "en-US",
"region": "US East",
"page":
{
"url": "https://example.com/miso-tshirt-123ABC",
"referrer": "https://example.com/",
"title": "My Product Page"
},
"user_agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0)"
},
"custom_context": {
"other_context_var_1": "value_1",
"other_context_var_2": "value_2"
}
}
```
SpellCheckRequest:
title: SpellCheckRequest
type: object
properties:
enable_auto_spelling_correction:
title: Enable Auto Spelling Correction
description: >
This parameter controls whether to automatically correct a misspell
search query.
If set to `true`, when Miso detects spelling errors, the search
results will be based on the
**corrected** spelling suggested by Miso.
You call tell if Miso made any correction to the search query by
checking the
`spellcheck.auto_spelling_correction` field in the
API response. When this field is `true`, the search results are
based on the suggested spelling
as opposed to the users' original query.
You can opt-out the spelling correction by setting this parameter to
`false`. In such cases,
Miso will still detect spelling errors,
but the search results will be always based on users' original
spelling.
type: boolean
default: true
SpellCheckResponse:
title: SpellCheckResponse
required:
- spelling_errors
- auto_spelling_correction
- original_query
- original_query_with_markups
- corrected_query
- corrected_query_with_markups
type: object
properties:
spelling_errors:
title: Spelling Errors
description: Whether Miso detects any spelling errors.
type: boolean
auto_spelling_correction:
title: Auto Spelling Correction
description: >-
Whether Miso has automatically corrected the misspelled search
query. When this field is `true`, the search result is based on the
corrected spelling in the `corrected_query` field instead of users'
original search query.
type: boolean
original_query:
title: Original Query
description: Original query string
type: string
example: what is pythn
original_query_with_markups:
title: Original Query With Markups
description: >-
Original query with the spelling errors (if any) surrounded by the
tags
type: string
example: what is pythn
corrected_query:
title: Corrected Query
description: >-
The corrected spelling suggested by Miso. If no spelling error is
detected, this will be the same as `original_query`
type: string
example: what is python
corrected_query_with_markups:
title: Corrected Query With Markups
description: >-
The corrected spelling suggested by Miso where the revised tokens
are surrounded by the tags.
type: string
example: what is python
Subscribe:
title: subscribe
required:
- type
type: object
properties:
type:
title: Type
description: >
Used when a user subscribes a product, for example to receive alerts
when the product comes back in stock or if the price drops.
enum:
- subscribe
type: string
product_ids:
title: Product Ids
description: >
Products or content the user is interacting with. This field is
required by
almost all the interaction types. We use `product_ids` to refer to
the product / content records that you upload to Miso.
Therefore, it is important to keep this consistent between the two
datasets.
Example:
```
{"product_ids": ["123ABC-BLACK", "123EFG-YELLOW"]}
```
type: array
items:
type: string
maxLength: 512
default: []
example:
- 123ABC-BLACK
product_group_ids:
title: Product Group Ids
description: >
The product groups the user is interacting with. You only need this
field if you model product
variants using `product_id` and `product_group_id` (see Product
API). If so, you should use this field, when a
user is interacting with a *product group* rather than a specific
product variant, for example, when the user
is viewing the master page of a T-shirt (i.e. a product group), but
has not selected the specific size or
color (i.e. a product variant) yet.
In such situations, the `product_id` is not applicable because we
only know the user is interested in
this T-shirt (a product group), but don't know which particular
product variant the user is interested in.
Therefore, we use `product_group_ids` to capture such interactions
in place of `product_ids`.
In the situations where specific `product_ids` are available, for
example, when user selected a particular size
of the T-Shirt, use `product_ids` instead.
Example:
```
{"product_group_ids": ["123ABC"]}
```
type: array
items:
type: string
maxLength: 512
example:
- 123ABC
user_id:
title: User Id
description: >-
Identifies the signed-in user who performed the interaction. We will
use `user_id` to link Interaction records to your
User records. Therefore, it is important to keep this consistent between the two datasets.For visitors who have
not signed in, see `anonymous_id`.
maxLength: 512
type: string
example: user_1234
anonymous_id:
title: Anonymous Id
description: >-
A pseudo-unique substitute for the User Id. We use `anonymous_id` to
identify a visitor who has not signed
in. `anonymous_id` can be implemented using mechanisms such as cookies or browser localStorage. If `anonymous_id`
is not given, we will default it to `SHA1(:::)`. When a visitor signs
in and the `user_id` and `anonymous_id` are both present, the `anonymous_id` will be linked to the `user_id`
along with the past interactions associated with it.
maxLength: 1024
type: string
example: 86D51273AD8BF84217E1567B6CBE7152D7034404
timestamp:
title: Timestamp
description: >
The ISO-8601 timestamp specifying when the interaction occurred. If
the interaction just happened, leave it out and we
will default to the server's time. If you're importing data from the
past, make sure you provide a
timestamp. It is recommended to include milliseconds in the
timestamp to provide a higher time resolution.
Example:
```
{"timestamp": "2018-11-07T00:25:00.073876Z"}
```
type: string
format: date-time
miso_id:
title: Miso Id
description: >
Miso-generated unique Id for each recommendation or search result.
Maintaining this Id for
subsequent page views is important to Miso's performance, as we use
`miso_id` to track and fine-tune the
performance of personalization and search results. When a user
clicks on a recommendation or search result,
you should pass the associated `miso_id` to the next page view, and
associate the `miso_id` with the
interactions that take place on the page (e.g.
`product_detail_page_view`, `add_to_cart`,
`add_to_collection`, `like`, etc.). In this way, Miso will learn
which recommendations work and which didn't.
Example:
```
{"misoId": "123e4567-e89b-12d3-a456-426614174000"}
```
type: string
format: uuid
example: 123e4567-e89b-12d3-a456-426614174000
context:
$ref: '#/components/schemas/WebBasedContext'
x-konfig-properties:
context:
title: Context
description: >
Dictionary of extra information that provides useful context about
an interaction. We use context
information to make recommendations tailored not only for each user,
but also for their current browsing context.
For example, a user browsing on a desktop may have different
browsing behavior than a user browsing on mobile
phone. As another example, a user who gets to the site via a certain
campaign you run on Facebook may have very
different interests than a user who visits your site directly.
Context information is also useful for personalization for entirely
new visitors, as we can immediately
personalize their experiences based on their context alone (e.g. the
referrer or the campaign they clicked through).
Example:
```
{"context": {
"campaign":
{
"name": "spring_sale",
"source": "Google",
"medium": "cpc",
"term": "running+shoes",
"content": "textlink"
},
"truncated_ip": "1.1.1.0",
"locale": "en-US",
"region": "US East",
"page":
{
"url": "https://example.com/miso-tshirt-123ABC",
"referrer": "https://example.com/",
"title": "My Product Page"
},
"user_agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0)"
},
"custom_context": {
"other_context_var_1": "value_1",
"other_context_var_2": "value_2"
}
}
```
TaskId:
title: TaskId
required:
- task_id
type: object
properties:
task_id:
title: Task Id
type: string
TieBreakDefinition:
title: TieBreakDefinition
type: object
properties:
type:
title: Type
enum:
- relative_difference
default: relative_difference
type: string
threshold:
title: Threshold
type: number
default: 0
TitleCompletion:
title: TitleCompletion
description: title completion additionally has the `product` the title belongs to.
required:
- text
- text_with_markups
- text_with_inverted_markups
- product
type: object
properties:
text:
title: Text
minLength: 1
type: string
example: Japanese Shiba Inu Dog Eating Miso Soup T-Shirt
text_with_markups:
title: Text With Markups
minLength: 1
type: string
example: Japanese Shiba Inu Dog Eating Miso Soup T-Shirt
text_with_inverted_markups:
title: Text With Inverted Markups
minLength: 1
type: string
example: Japanese Shiba Inu Dog Eating Miso Soup T-Shirt
product:
$ref: '#/components/schemas/Record'
x-konfig-properties:
product:
title: Product
example:
product_id: 123ABC-S-Black
TrendRecResponse:
title: TrendRecResponse
required:
- data
type: object
properties:
message:
title: Message
type: string
default: success
data:
$ref: '#/components/schemas/TrendResponseBody'
TrendResponseBody:
title: TrendResponseBody
required:
- products
type: object
properties:
took:
title: Took
description: Number of milliseconds Miso took to retrieve the results.
type: integer
default: 0
miso_id:
title: Miso Id
description: >
Miso-generated unique Id for each recommendation or search result.
Maintaining this Id for
subsequent page views is important to Miso's performance as we use
`miso_id` to track and fine-tune the
performance of personalization and search results. When a user
clicks on a recommendation or search result,
you should pass the associated `miso_id` to the next page view, and
associate the `miso_id` with the
interactions that take place on the page (e.g.
`product_detail_page_view`, `add_to_cart`,
`add_to_collection`, `like`, etc.). In this way, Miso will learn
which recommendations work and which didn't.
Example:
```
{"misoId": "123e4567-e89b-12d3-a456-426614174000"}
```
type: string
format: uuid
default: 00000000-0000-0000-0000-000000000000
example: 123e4567-e89b-12d3-a456-426614174000
products:
title: Products
description: Trending product results.
type: array
items:
$ref: '#/components/schemas/Record'
UserBulkDeleteIn:
title: UserBulkDeleteIn
required:
- data
type: object
properties:
data:
$ref: '#/components/schemas/UserIdList'
UserBulkIn:
title: UserBulkIn
required:
- data
type: object
properties:
data:
title: Data
type: array
items:
$ref: '#/components/schemas/UserRecord'
UserIdList:
title: UserIdList
required:
- user_ids
type: object
properties:
user_ids:
title: User Ids
type: array
items:
type: string
UserReadOut:
title: UserReadOut
required:
- message
- data
type: object
properties:
message:
title: Message
description: Human-readable message
type: string
example: success
data:
$ref: '#/components/schemas/UserRecord'
UserRecord:
title: UserRecord
required:
- user_id
type: object
properties:
description:
title: Description
description: >
Text description of the user. This can be the user's own bio or the
internal notes about the user. If available,
Miso will analyze this description to better profile a user.
type: string
example: Engineer from Northwind Corp
user_id:
title: User Id
description: >
Unique identifier for a user who has signed in. `user_id` can be in
any format (e.g. users' email, internal user
UUID or serial ID). The only restriction is that the first character
must not be an underline `_`. Miso will use
this id to cross-reference your User records with your Interaction
records.
maxLength: 512
minLength: 1
type: string
example: user_1234
created_at:
title: Created At
description: >
The date the user’s account was created as an ISO-8601 date or
datetime string.
anyOf:
- type: string
format: date-time
- type: string
format: date
updated_at:
title: Updated At
description: >
The date the user’s account was updated as an ISO-8601 date or
datetime string.
anyOf:
- type: string
format: date-time
- type: string
format: date
name:
title: Name
description: The user's full name.
type: string
example: John Doe
profile_image:
title: Profile Image
description: URL to the profile image of the user.
maxLength: 65536
minLength: 1
type: string
format: uri
age:
title: Age
description: Age of the user. We will internally convert it to year of birth.
type: integer
example: 33
gender:
title: Gender
description: The user's gender.
type: string
example: M
city:
title: City
description: City or zipcode the user is based in.
type: string
example: Mountain View
state:
title: State
description: State the user is based in.
type: string
example: California
country:
title: Country
description: Country the user is based in.
type: string
example: US
group_id:
title: Group Id
description: >
Group or Account ID from your CRM. This is useful in B2B scenarios.
For example, you can use `group_id` to
associate a user with their company or account. We will use this
information to infer the user's interests and
fine-tune their personalization and search results. For example,
users from the same group might have similar
interests on the site, and we can improve their user experience
accordingly
type: string
example: Northwind Corp
custom_attributes:
title: Custom Attributes
description: >
Dictionary of custom attributes about the user. As with the [Product
API](#operation/content_write_api_v1_products_post), you can specify
attributes specific to your business in a `{"KEY" : VALUE}` format,
where `KEY` must be a string, and
`VALUE` can be:
* a `string` or `an array of strings`
* a `number` or `an array of numbers`
* an `array of objects`
* a `bool`
* `null`
* Example:
```
{
"custom_attributes": {
"acquisition_channel": "Facebook Campaign 2020",
"declared_interests": ["Drama", "Romance"]
}
}
```
These custom attributes types must be consistent across all User
records in your data set.
Records with inconsistent types will fail to be inserted.
type: object
additionalProperties:
anyOf:
- type: boolean
- type: integer
- type: number
- type: string
- type: array
items:
type: number
- type: array
items:
type: string
- type: array
items:
type: object
additionalProperties:
anyOf:
- type: string
- type: number
- type: integer
- type: boolean
example:
acquisition_channel: Facebook Campaign 2020
declared_interests:
- Drama
- Romance
UserToAttributes:
title: UserToAttributes
description: >-
User to attributes recommendations. Given a user, recommend
product attributes the user will be interested in as well as products in
those attributes
required:
- field
type: object
properties:
boosting_tags:
title: Boosting Tags
description: >
When `boosting_tags` is given, and there are pre-defined boost rules
have the same tag(s),
those boost rules will be matched, regardless if the criteria is met
or not.
Useful when want to force trigger specific boost campaign.
type: array
items:
type: string
default: []
example:
- tag-1
- quetag-2
field:
title: Field
description: >
The attribute you want to make recommendations for. For example, the
following
query will recommend values from the `brand` field that Miso thinks
the user will be interested in:
```
{"field": "brand"}
```
This API also works for custom attributes you define. For example,
if you provide a `designer` custom attribute, then, you can make
`designer` recommendations with the following query.
```
{"field": "custom_attributes.designer"}
```
type: string
boost_attributes:
title: Boost Attributes
description: |+
The attributes to boost to the top of the recommendations
type: array
items:
type: string
default: []
exclude_attributes:
title: Exclude Attributes
description: |+
The attributes to remove from the recommendations
type: array
items:
type: string
default: []
rows:
title: Rows
description: Number of product recommendations to return
type: integer
default: 5
products_per_attribute:
title: Products Per Attribute
description: >
Number of personalized product recommendations to make for **each**
recommended attribute. For example, the following
query will return 5 products for each *brand* we recommend:
```
{
"field": "brand",
"products_per_attribute": 2
}
```
Note that a large number of `products_per_attribute` will increase
latency slightly because we need to
perform more computation for each of the recommended attributes. If
you only need attribute
recommendations, you can set
`products_per_attribute=0` to reduce latency.
type: integer
default: 2
engine_id:
title: Engine Id
description: >
The engine you want to get results from. When you have more than one
engine, you can use this parameter to
specify the specific engine you want to get results from. If not
specified, the default engine will be used.
type: string
user_id:
title: User Id
description: >
The user who made the query and for whom Miso will personalize the
results. For an anonymous visitor, use `anonymous_id` instead.
type: string
anonymous_id:
title: Anonymous Id
description: >-
The anonymous visitor who made the query and for whom Miso will
personalize the results. Either
`user_id` or `anonymous_id` needs to be specified for personalization to work.
type: string
user_hash:
title: User Hash
description: >
The hash of `user_id` (or `anonymous_id`) encrypted by your [Secret
API Key](https://api.askmiso.com).
`user_hash` is required to prevent unauthorized API access if you
are
making API calls with a [Publishable API
Key](https://api.askmiso.com).
You should generate the user_hash via HMAC scheme: you encrypt the
desired user_id (or anonymous_id) with your
[Secret API Key](https://api.askmiso.com) on your backend server,
and then let the front-end code send the generated user_hash to Miso
APIs to
verify the identity of the API caller.
As long as the [Secret API Key](https://api.askmiso.com)
is kept secret, the user_hash prevents a malicious attacker from making unauthorized
API calls or impersonating any of your users.
Miso APIs accept the case-incentive "hex digest" of user hash, a
sample Python 3 code to generate it on your backend server
is as follow:
```python
import hashlib
import hmac
YOUR_MISO_SECRET_API_KEY = "039c501ac8dfcac91"
key_bytes = YOUR_MISO_SECRET_API_KEY.encode()
user_id = "USER_123" # or anonymous_id
user_id_bytes = user_id.encode()
user_hash = hmac.new(
key_bytes,
user_id_bytes,
hashlib.sha256).hexdigest()
# user_hash is "7eb04da5e..."
```
You can find more examples for other languages in this [Github
Gist](https://gist.github.com/thewheat/7342c76ade46e7322c3e)
type: string
user_cohort:
title: User Cohort
description: >
The user cohort you want to cold-start the recommendation with. For
example, the following query will make
recommendations based on the preferences of the users whose
`country="United States"`, and `gender="Female"`
in the User Profile dataset.
```
{
"user_cohort": {
"country": "United States",
"gender": "Female"
}
}
```
type: object
additionalProperties:
anyOf:
- type: boolean
- type: string
type:
title: Type
description: >
The type of products to return. Use this parameter to make the API
return only
a certain type of products (see [Product
APIs](https://api.askmiso.com)).
This is particularly useful for sites that have multiple types of
products:
For example, on a marketplace site, YOu may model *merchandise* and
*store* as two types of *products*. You can
then use type parameter to limit the recommendation or search
results to return only one kind of them.
For instance, the following query will return only *store* products:
```
{"type": "store"}
```
For another example, on a travel website, you might have: *hotel*,
*thing to do*, and *restaurant*,
three kinds
of products. You can use `type` parameter to limit results to one
kind of them. For instance, the following
query will limit the results to only *hotels* product:
```
{"type": "hotel"}
```
type: string
dedupe_product_group_id:
title: Dedupe Product Group Id
description: >
Whether to dedupe product based on `product_group_id`. If
`dedupe_product_group_id=true`,
Miso will prevent products with the same `product_group_id` from
showing multiple
times in the search or recommendation results.
This is particular useful when one product has multiple variants
(for example, different
sizes, colors, or materials), and you only want to show this product
only once in the search or recommendation
results. Miso will then return the variant that is most likely to be
of the user's interest.
type: boolean
default: true
additional_interactions:
title: Additional Interactions
description: >
A list of additional interaction records. You can use this fields to
simulate user interactions without
actually writing them to the interaction dataset.
type: array
items:
anyOf:
- $ref: '#/components/schemas/ProductDetailPageView'
- $ref: '#/components/schemas/Search'
- $ref: '#/components/schemas/AddToCart'
- $ref: '#/components/schemas/RemoveFromCart'
- $ref: '#/components/schemas/Checkout'
- $ref: '#/components/schemas/Refund'
- $ref: '#/components/schemas/Subscribe'
- $ref: '#/components/schemas/AddToCollection'
- $ref: '#/components/schemas/RemoveFromCollection'
- $ref: '#/components/schemas/Read'
- $ref: '#/components/schemas/Watch'
- $ref: '#/components/schemas/Listen'
- $ref: '#/components/schemas/Like'
- $ref: '#/components/schemas/Dislike'
- $ref: '#/components/schemas/Share'
- $ref: '#/components/schemas/Rate'
- $ref: '#/components/schemas/Bookmark'
- $ref: '#/components/schemas/Complete'
- $ref: '#/components/schemas/Feedback'
- $ref: '#/components/schemas/Impression'
- $ref: '#/components/schemas/ViewableImpression'
- $ref: '#/components/schemas/Click'
- $ref: '#/components/schemas/HomePageView'
- $ref: '#/components/schemas/CategoryPageView'
- $ref: '#/components/schemas/PromoPageView'
- $ref: '#/components/schemas/ProductImageView'
- $ref: '#/components/schemas/Custom'
default: []
fl:
title: Fl
description: >
List of fields to retrieve. For example, the following request
retrieves only the `title` field of each product along
with the `product_id`, which is always returned.
```
{"fl": ["title"]}
```
You can also match field names by using `*` as a wildcard. For
example, the query below retrieves the `title`
and any custom attributes under the `attributes` dictionary.
```
{"fl": ["title", "attributes.*"]}
```
The following retrieves all the available fields:
```
{"fl": ["*"]}
```
For the lowest latency, use an empty array to retrieve just the
`product_id` field (which is the default).
```
{"fl": []}
```
type: array
items:
type: string
default: []
exclude:
title: Exclude
description: >-
An array of `product_ids` of products you want to *exclude* from
search results.
type: array
items:
type: string
fq:
title: Fq
description: >
Defines a query in Solr syntax that can be used to restrict the
superset of
products to return, without influencing the overall ranking. `fq`
can enable users to drill down to products
with specific features based on different product attributes
For example, the query below limits the search results to only show
products whose size is either `M` or `S` and
brand is `Nike`:
```
{"fq": "size:(\"M\" OR \"S\") AND brand:\"Nike\""}
```
You can use `fq` to apply filters against your custom attributes as
well. For example, the query below limits the
search results to only products whose `designer` attribute is
`Calvin Klein`
```
{"fq": "attributes.designer:\"Calvin Klein\""}
```
`fq` can also limit search results by numerical range. For example,
the following query limits the results to
products that have `rating >= 4`.
```
{"fq": "rating:[4 TO *]"}
```
type: string
boost_fq:
title: Boost Fq
description: >
Defines a query in Solr syntax that can be used to boost a subset of
products to the top of the ranking, or to
specific *boost positions* (See `boost_positions` parameter below.)
For example, the query below will promote all the relevant products
whose brand is `Nike` to the top of
recommendation list:
```
{
"boost_fq": "brand:\"Nike\""
}
```
For a slightly more complex example, the query below will promote
the Nike products which have also been tagged
as `ON SALE` to the top of the ranking:
```
{
"boost_fq": "brand:\"Nike\" AND tags:\"ON SALE\""
}
```
It is worth mentioning that, Miso will only boost products that are
relevant and have high likelihood to convert,
and will not boost a low performance product only because it matches
the boosting query.
Depending on your boosting rules, in certain cases, you would like
to prevent recommendation results from being
too monotone due to boosting. With Miso, you have two tools to do
so.
First, you can specify `boost_positions` to place promoted products
at specific positions in the ranking. For
example, the query below will place boosted products only at the
first and fourth places in the ranking
(positions are 0-based), and place the remaining products in their
original ranking, skipping these two positions.
```
{
"boost_fq": "brand:\"Nike\" AND tags:\"ON SALE\"",
"boost_positions": [0, 3]
}
```
The second tool is `diversification`. `diversification` parameter,
on a best-effort basis, will try to
maintain a minimum distance between products that have the same
attributes. For example, the following query
will place products made by the same brand apart from each other.
```
{
"boost_fq": "brand:\"Nike\" AND tags:\"ON SALE\"",
"diversification": {
"brand": {"minimum_distance": 1}
}
}
```
type: string
boost_positions:
title: Boost Positions
description: >
Defines a list of 0-based positions you want to place the boosted
products at.
For example, the query below will promote products whose brand is
`Nike` as the top and second recommendations:
```
{
"boost_fq": "brand:\"Nike\"",
"boost_positions": [0, 1]
}
```
If `boost_positions` is not specified (which is the default
behavior), all the boosted products will be ranked
higher than the rest of the products.
type: array
items:
type: integer
boost_rules:
title: Boost Rules
description: >
Define a list of boosting rules that will be applied to the search
or recommendation results simultaneously. `boost_rules`
parameter is particularly useful when you want to boost more than
one sets of products, and promote each of them to different
positions. For example, the query below will promote products whose
brand is `Nike` to the top
and second results, and products whose brand is `Adidas` to the
third and fourth results:
```
{
"boost_rules": [
{
"boost_fq": "brand:\"Nike\"",
"boost_positions": [0, 1]
},
{
"boost_fq": "brand:\"Adidas\"",
"boost_positions": [2, 3]
}
]
}
```
type: array
items:
$ref: '#/components/schemas/BoostingFilterBase'
default: []
geo:
$ref: '#/components/schemas/GeoQuery'
x-konfig-properties:
geo:
title: Geo
description: >
When set, filter result to include only products within certain
geographic range from given point will be returned,
or to boost product within the same range.
Product should have a field that holds the location of the product,
`location` is used by default,
but other field can also be used.
Distance can be in miles or kilometers. If `distance_unit` is not
set, `mile` will be used.
For example, to limit results to products within 100 miles of New
York city:
```
{
"geo": {
"filter": [{
"lat": 40.73061,
"lon": -73.93524,
"distance": 100
}]
}
}
```
To boost products within 2 kilometers around Alcatraz Island
according to `loc` field:
```
{
"geo": {
"boost": [{
"field": "loc",
"lat": 37.82667,
"lon": -122.42278,
"distance": 2,
"distance_unit": "km"
}]
}
}
```
UserToCategories:
title: UserToCategories
description: Attributes for recommendation boosting
type: object
properties:
engine_id:
title: Engine Id
description: >
The engine you want to get results from. When you have more than one
engine, you can use this parameter to
specify the specific engine you want to get results from. If not
specified, the default engine will be used.
type: string
user_id:
title: User Id
description: >
The user who made the query and for whom Miso will personalize the
results. For an anonymous visitor, use `anonymous_id` instead.
type: string
anonymous_id:
title: Anonymous Id
description: >-
The anonymous visitor who made the query and for whom Miso will
personalize the results. Either
`user_id` or `anonymous_id` needs to be specified for personalization to work.
type: string
user_hash:
title: User Hash
description: >
The hash of `user_id` (or `anonymous_id`) encrypted by your [Secret
API Key](https://api.askmiso.com).
`user_hash` is required to prevent unauthorized API access if you
are
making API calls with a [Publishable API
Key](https://api.askmiso.com).
You should generate the user_hash via HMAC scheme: you encrypt the
desired user_id (or anonymous_id) with your
[Secret API Key](https://api.askmiso.com) on your backend server,
and then let the front-end code send the generated user_hash to Miso
APIs to
verify the identity of the API caller.
As long as the [Secret API Key](https://api.askmiso.com)
is kept secret, the user_hash prevents a malicious attacker from making unauthorized
API calls or impersonating any of your users.
Miso APIs accept the case-incentive "hex digest" of user hash, a
sample Python 3 code to generate it on your backend server
is as follow:
```python
import hashlib
import hmac
YOUR_MISO_SECRET_API_KEY = "039c501ac8dfcac91"
key_bytes = YOUR_MISO_SECRET_API_KEY.encode()
user_id = "USER_123" # or anonymous_id
user_id_bytes = user_id.encode()
user_hash = hmac.new(
key_bytes,
user_id_bytes,
hashlib.sha256).hexdigest()
# user_hash is "7eb04da5e..."
```
You can find more examples for other languages in this [Github
Gist](https://gist.github.com/thewheat/7342c76ade46e7322c3e)
type: string
user_cohort:
title: User Cohort
description: >
The user cohort you want to cold-start the recommendation with. For
example, the following query will make
recommendations based on the preferences of the users whose
`country="United States"`, and `gender="Female"`
in the User Profile dataset.
```
{
"user_cohort": {
"country": "United States",
"gender": "Female"
}
}
```
type: object
additionalProperties:
anyOf:
- type: boolean
- type: string
rows:
title: Rows
description: Number of recommended categories to return
type: integer
default: 5
type:
title: Type
description: >
The type of products to return. Use this parameter to make the API
return only
a certain type of products (see [Product
APIs](https://api.askmiso.com)).
This is particularly useful for sites that have multiple types of
products:
For example, on a marketplace site, YOu may model *merchandise* and
*store* as two types of *products*. You can
then use type parameter to limit the recommendation or search
results to return only one kind of them.
For instance, the following query will return only *store* products:
```
{"type": "store"}
```
For another example, on a travel website, you might have: *hotel*,
*thing to do*, and *restaurant*,
three kinds
of products. You can use `type` parameter to limit results to one
kind of them. For instance, the following
query will limit the results to only *hotels* product:
```
{"type": "hotel"}
```
type: string
dedupe_product_group_id:
title: Dedupe Product Group Id
description: >
Whether to dedupe product based on `product_group_id`. If
`dedupe_product_group_id=true`,
Miso will prevent products with the same `product_group_id` from
showing multiple
times in the search or recommendation results.
This is particular useful when one product has multiple variants
(for example, different
sizes, colors, or materials), and you only want to show this product
only once in the search or recommendation
results. Miso will then return the variant that is most likely to be
of the user's interest.
type: boolean
default: true
additional_interactions:
title: Additional Interactions
description: >
A list of additional interaction records. You can use this fields to
simulate user interactions without
actually writing them to the interaction dataset.
type: array
items:
anyOf:
- $ref: '#/components/schemas/ProductDetailPageView'
- $ref: '#/components/schemas/Search'
- $ref: '#/components/schemas/AddToCart'
- $ref: '#/components/schemas/RemoveFromCart'
- $ref: '#/components/schemas/Checkout'
- $ref: '#/components/schemas/Refund'
- $ref: '#/components/schemas/Subscribe'
- $ref: '#/components/schemas/AddToCollection'
- $ref: '#/components/schemas/RemoveFromCollection'
- $ref: '#/components/schemas/Read'
- $ref: '#/components/schemas/Watch'
- $ref: '#/components/schemas/Listen'
- $ref: '#/components/schemas/Like'
- $ref: '#/components/schemas/Dislike'
- $ref: '#/components/schemas/Share'
- $ref: '#/components/schemas/Rate'
- $ref: '#/components/schemas/Bookmark'
- $ref: '#/components/schemas/Complete'
- $ref: '#/components/schemas/Feedback'
- $ref: '#/components/schemas/Impression'
- $ref: '#/components/schemas/ViewableImpression'
- $ref: '#/components/schemas/Click'
- $ref: '#/components/schemas/HomePageView'
- $ref: '#/components/schemas/CategoryPageView'
- $ref: '#/components/schemas/PromoPageView'
- $ref: '#/components/schemas/ProductImageView'
- $ref: '#/components/schemas/Custom'
default: []
fl:
title: Fl
description: >
List of fields to retrieve. For example, the following request
retrieves only the `title` field of each product along
with the `product_id`, which is always returned.
```
{"fl": ["title"]}
```
You can also match field names by using `*` as a wildcard. For
example, the query below retrieves the `title`
and any custom attributes under the `attributes` dictionary.
```
{"fl": ["title", "attributes.*"]}
```
The following retrieves all the available fields:
```
{"fl": ["*"]}
```
For the lowest latency, use an empty array to retrieve just the
`product_id` field (which is the default).
```
{"fl": []}
```
type: array
items:
type: string
default: []
exclude:
title: Exclude
description: >-
An array of `product_ids` of products you want to *exclude* from
search results.
type: array
items:
type: string
boosting_tags:
title: Boosting Tags
description: >
When `boosting_tags` is given, and there are pre-defined boost rules
have the same tag(s),
those boost rules will be matched, regardless if the criteria is met
or not.
Useful when want to force trigger specific boost campaign.
type: array
items:
type: string
default: []
example:
- tag-1
- quetag-2
products_per_category:
title: Products Per Category
description: >-
Number of products to return for **each** category. For example, the
following
query will return 5 products for each category we recommend:
```
{"products": 5}
```
Note that, a large number of `products_per_category` (say >= 20)
will increase query latency (up to around 200ms)
because we need to perform more computation for each of the
recommended categories. If you
only need category recommendations, you should set
`products_per_category` to 0 to reduce latency.
type: integer
default: 5
root_category:
title: Root Category
description: >-
If `root_category` is specified, we will only recommend categories
that are direct children of each of the root
category. For example, the following query will recommend the
products of category that is under `["Clothes"]` category:
```
{"root_category": ["Clothes"]}
```
For another example, the following query will recommend the products
of category that is under `["Clothes", "Dresses"]` category
```
{"root_category": ["Clothes", "Dresses"]}
```
If `root_category` is not specified, we will recommend the *top
level* categories.
type: array
items:
type: string
default: []
fq:
title: Fq
description: >
Defines a query in Solr syntax that can be used to restrict the
superset of
products to return, without influencing the overall ranking. `fq`
can enable users to drill down to products
with specific features based on different product attributes
For example, the query below limits the search results to only show
products whose size is either `M` or `S` and
brand is `Nike`:
```
{"fq": "size:(\"M\" OR \"S\") AND brand:\"Nike\""}
```
You can use `fq` to apply filters against your custom attributes as
well. For example, the query below limits the
search results to only products whose `designer` attribute is
`Calvin Klein`
```
{"fq": "attributes.designer:\"Calvin Klein\""}
```
`fq` can also limit search results by numerical range. For example,
the following query limits the results to
products that have `rating >= 4`.
```
{"fq": "rating:[4 TO *]"}
```
type: string
boost_fq:
title: Boost Fq
description: >
Defines a query in Solr syntax that can be used to boost a subset of
products to the top of the ranking, or to
specific *boost positions* (See `boost_positions` parameter below.)
For example, the query below will promote all the relevant products
whose brand is `Nike` to the top of
recommendation list:
```
{
"boost_fq": "brand:\"Nike\""
}
```
For a slightly more complex example, the query below will promote
the Nike products which have also been tagged
as `ON SALE` to the top of the ranking:
```
{
"boost_fq": "brand:\"Nike\" AND tags:\"ON SALE\""
}
```
It is worth mentioning that, Miso will only boost products that are
relevant and have high likelihood to convert,
and will not boost a low performance product only because it matches
the boosting query.
Depending on your boosting rules, in certain cases, you would like
to prevent recommendation results from being
too monotone due to boosting. With Miso, you have two tools to do
so.
First, you can specify `boost_positions` to place promoted products
at specific positions in the ranking. For
example, the query below will place boosted products only at the
first and fourth places in the ranking
(positions are 0-based), and place the remaining products in their
original ranking, skipping these two positions.
```
{
"boost_fq": "brand:\"Nike\" AND tags:\"ON SALE\"",
"boost_positions": [0, 3]
}
```
The second tool is `diversification`. `diversification` parameter,
on a best-effort basis, will try to
maintain a minimum distance between products that have the same
attributes. For example, the following query
will place products made by the same brand apart from each other.
```
{
"boost_fq": "brand:\"Nike\" AND tags:\"ON SALE\"",
"diversification": {
"brand": {"minimum_distance": 1}
}
}
```
type: string
boost_positions:
title: Boost Positions
description: >
Defines a list of 0-based positions you want to place the boosted
products at.
For example, the query below will promote products whose brand is
`Nike` as the top and second recommendations:
```
{
"boost_fq": "brand:\"Nike\"",
"boost_positions": [0, 1]
}
```
If `boost_positions` is not specified (which is the default
behavior), all the boosted products will be ranked
higher than the rest of the products.
type: array
items:
type: integer
boost_rules:
title: Boost Rules
description: >
Define a list of boosting rules that will be applied to the search
or recommendation results simultaneously. `boost_rules`
parameter is particularly useful when you want to boost more than
one sets of products, and promote each of them to different
positions. For example, the query below will promote products whose
brand is `Nike` to the top
and second results, and products whose brand is `Adidas` to the
third and fourth results:
```
{
"boost_rules": [
{
"boost_fq": "brand:\"Nike\"",
"boost_positions": [0, 1]
},
{
"boost_fq": "brand:\"Adidas\"",
"boost_positions": [2, 3]
}
]
}
```
type: array
items:
$ref: '#/components/schemas/BoostingFilterBase'
default: []
geo:
$ref: '#/components/schemas/GeoQuery'
x-konfig-properties:
geo:
title: Geo
description: >
When set, filter result to include only products within certain
geographic range from given point will be returned,
or to boost product within the same range.
Product should have a field that holds the location of the product,
`location` is used by default,
but other field can also be used.
Distance can be in miles or kilometers. If `distance_unit` is not
set, `mile` will be used.
For example, to limit results to products within 100 miles of New
York city:
```
{
"geo": {
"filter": [{
"lat": 40.73061,
"lon": -73.93524,
"distance": 100
}]
}
}
```
To boost products within 2 kilometers around Alcatraz Island
according to `loc` field:
```
{
"geo": {
"boost": [{
"field": "loc",
"lat": 37.82667,
"lon": -122.42278,
"distance": 2,
"distance_unit": "km"
}]
}
}
```
UserToItemsRequest:
title: UserToItemsRequest
description: Attributes for recommendation boosting
type: object
properties:
engine_id:
title: Engine Id
description: >
The engine you want to get results from. When you have more than one
engine, you can use this parameter to
specify the specific engine you want to get results from. If not
specified, the default engine will be used.
type: string
user_id:
title: User Id
description: >
The user who made the query and for whom Miso will personalize the
results. For an anonymous visitor, use `anonymous_id` instead.
type: string
anonymous_id:
title: Anonymous Id
description: >-
The anonymous visitor who made the query and for whom Miso will
personalize the results. Either
`user_id` or `anonymous_id` needs to be specified for personalization to work.
type: string
user_hash:
title: User Hash
description: >
The hash of `user_id` (or `anonymous_id`) encrypted by your [Secret
API Key](https://api.askmiso.com).
`user_hash` is required to prevent unauthorized API access if you
are
making API calls with a [Publishable API
Key](https://api.askmiso.com).
You should generate the user_hash via HMAC scheme: you encrypt the
desired user_id (or anonymous_id) with your
[Secret API Key](https://api.askmiso.com) on your backend server,
and then let the front-end code send the generated user_hash to Miso
APIs to
verify the identity of the API caller.
As long as the [Secret API Key](https://api.askmiso.com)
is kept secret, the user_hash prevents a malicious attacker from making unauthorized
API calls or impersonating any of your users.
Miso APIs accept the case-incentive "hex digest" of user hash, a
sample Python 3 code to generate it on your backend server
is as follow:
```python
import hashlib
import hmac
YOUR_MISO_SECRET_API_KEY = "039c501ac8dfcac91"
key_bytes = YOUR_MISO_SECRET_API_KEY.encode()
user_id = "USER_123" # or anonymous_id
user_id_bytes = user_id.encode()
user_hash = hmac.new(
key_bytes,
user_id_bytes,
hashlib.sha256).hexdigest()
# user_hash is "7eb04da5e..."
```
You can find more examples for other languages in this [Github
Gist](https://gist.github.com/thewheat/7342c76ade46e7322c3e)
type: string
user_cohort:
title: User Cohort
description: >
The user cohort you want to cold-start the recommendation with. For
example, the following query will make
recommendations based on the preferences of the users whose
`country="United States"`, and `gender="Female"`
in the User Profile dataset.
```
{
"user_cohort": {
"country": "United States",
"gender": "Female"
}
}
```
type: object
additionalProperties:
anyOf:
- type: boolean
- type: string
rows:
title: Rows
description: Number of product recommendations to return
type: integer
default: 5
type:
title: Type
description: >
The type of products to return. Use this parameter to make the API
return only
a certain type of products (see [Product
APIs](https://api.askmiso.com)).
This is particularly useful for sites that have multiple types of
products:
For example, on a marketplace site, YOu may model *merchandise* and
*store* as two types of *products*. You can
then use type parameter to limit the recommendation or search
results to return only one kind of them.
For instance, the following query will return only *store* products:
```
{"type": "store"}
```
For another example, on a travel website, you might have: *hotel*,
*thing to do*, and *restaurant*,
three kinds
of products. You can use `type` parameter to limit results to one
kind of them. For instance, the following
query will limit the results to only *hotels* product:
```
{"type": "hotel"}
```
type: string
dedupe_product_group_id:
title: Dedupe Product Group Id
description: >
Whether to dedupe product based on `product_group_id`. If
`dedupe_product_group_id=true`,
Miso will prevent products with the same `product_group_id` from
showing multiple
times in the search or recommendation results.
This is particular useful when one product has multiple variants
(for example, different
sizes, colors, or materials), and you only want to show this product
only once in the search or recommendation
results. Miso will then return the variant that is most likely to be
of the user's interest.
type: boolean
default: true
additional_interactions:
title: Additional Interactions
description: >
A list of additional interaction records. You can use this fields to
simulate user interactions without
actually writing them to the interaction dataset.
type: array
items:
anyOf:
- $ref: '#/components/schemas/ProductDetailPageView'
- $ref: '#/components/schemas/Search'
- $ref: '#/components/schemas/AddToCart'
- $ref: '#/components/schemas/RemoveFromCart'
- $ref: '#/components/schemas/Checkout'
- $ref: '#/components/schemas/Refund'
- $ref: '#/components/schemas/Subscribe'
- $ref: '#/components/schemas/AddToCollection'
- $ref: '#/components/schemas/RemoveFromCollection'
- $ref: '#/components/schemas/Read'
- $ref: '#/components/schemas/Watch'
- $ref: '#/components/schemas/Listen'
- $ref: '#/components/schemas/Like'
- $ref: '#/components/schemas/Dislike'
- $ref: '#/components/schemas/Share'
- $ref: '#/components/schemas/Rate'
- $ref: '#/components/schemas/Bookmark'
- $ref: '#/components/schemas/Complete'
- $ref: '#/components/schemas/Feedback'
- $ref: '#/components/schemas/Impression'
- $ref: '#/components/schemas/ViewableImpression'
- $ref: '#/components/schemas/Click'
- $ref: '#/components/schemas/HomePageView'
- $ref: '#/components/schemas/CategoryPageView'
- $ref: '#/components/schemas/PromoPageView'
- $ref: '#/components/schemas/ProductImageView'
- $ref: '#/components/schemas/Custom'
default: []
fl:
title: Fl
description: >
List of fields to retrieve. For example, the following request
retrieves only the `title` field of each product along
with the `product_id`, which is always returned.
```
{"fl": ["title"]}
```
You can also match field names by using `*` as a wildcard. For
example, the query below retrieves the `title`
and any custom attributes under the `attributes` dictionary.
```
{"fl": ["title", "attributes.*"]}
```
The following retrieves all the available fields:
```
{"fl": ["*"]}
```
For the lowest latency, use an empty array to retrieve just the
`product_id` field (which is the default).
```
{"fl": []}
```
type: array
items:
type: string
default: []
exclude:
title: Exclude
description: >-
An array of `product_ids` of products you want to *exclude* from
search results.
type: array
items:
type: string
boosting_tags:
title: Boosting Tags
description: >
When `boosting_tags` is given, and there are pre-defined boost rules
have the same tag(s),
those boost rules will be matched, regardless if the criteria is met
or not.
Useful when want to force trigger specific boost campaign.
type: array
items:
type: string
default: []
example:
- tag-1
- quetag-2
fq:
title: Fq
description: >
Defines a query in Solr syntax that can be used to restrict the
superset of
products to return, without influencing the overall ranking. `fq`
can enable users to drill down to products
with specific features based on different product attributes
For example, the query below limits the search results to only show
products whose size is either `M` or `S` and
brand is `Nike`:
```
{"fq": "size:(\"M\" OR \"S\") AND brand:\"Nike\""}
```
You can use `fq` to apply filters against your custom attributes as
well. For example, the query below limits the
search results to only products whose `designer` attribute is
`Calvin Klein`
```
{"fq": "attributes.designer:\"Calvin Klein\""}
```
`fq` can also limit search results by numerical range. For example,
the following query limits the results to
products that have `rating >= 4`.
```
{"fq": "rating:[4 TO *]"}
```
type: string
boost_fq:
title: Boost Fq
description: >
Defines a query in Solr syntax that can be used to boost a subset of
products to the top of the ranking, or to
specific *boost positions* (See `boost_positions` parameter below.)
For example, the query below will promote all the relevant products
whose brand is `Nike` to the top of
recommendation list:
```
{
"boost_fq": "brand:\"Nike\""
}
```
For a slightly more complex example, the query below will promote
the Nike products which have also been tagged
as `ON SALE` to the top of the ranking:
```
{
"boost_fq": "brand:\"Nike\" AND tags:\"ON SALE\""
}
```
It is worth mentioning that, Miso will only boost products that are
relevant and have high likelihood to convert,
and will not boost a low performance product only because it matches
the boosting query.
Depending on your boosting rules, in certain cases, you would like
to prevent recommendation results from being
too monotone due to boosting. With Miso, you have two tools to do
so.
First, you can specify `boost_positions` to place promoted products
at specific positions in the ranking. For
example, the query below will place boosted products only at the
first and fourth places in the ranking
(positions are 0-based), and place the remaining products in their
original ranking, skipping these two positions.
```
{
"boost_fq": "brand:\"Nike\" AND tags:\"ON SALE\"",
"boost_positions": [0, 3]
}
```
The second tool is `diversification`. `diversification` parameter,
on a best-effort basis, will try to
maintain a minimum distance between products that have the same
attributes. For example, the following query
will place products made by the same brand apart from each other.
```
{
"boost_fq": "brand:\"Nike\" AND tags:\"ON SALE\"",
"diversification": {
"brand": {"minimum_distance": 1}
}
}
```
type: string
boost_positions:
title: Boost Positions
description: >
Defines a list of 0-based positions you want to place the boosted
products at.
For example, the query below will promote products whose brand is
`Nike` as the top and second recommendations:
```
{
"boost_fq": "brand:\"Nike\"",
"boost_positions": [0, 1]
}
```
If `boost_positions` is not specified (which is the default
behavior), all the boosted products will be ranked
higher than the rest of the products.
type: array
items:
type: integer
boost_rules:
title: Boost Rules
description: >
Define a list of boosting rules that will be applied to the search
or recommendation results simultaneously. `boost_rules`
parameter is particularly useful when you want to boost more than
one sets of products, and promote each of them to different
positions. For example, the query below will promote products whose
brand is `Nike` to the top
and second results, and products whose brand is `Adidas` to the
third and fourth results:
```
{
"boost_rules": [
{
"boost_fq": "brand:\"Nike\"",
"boost_positions": [0, 1]
},
{
"boost_fq": "brand:\"Adidas\"",
"boost_positions": [2, 3]
}
]
}
```
type: array
items:
$ref: '#/components/schemas/BoostingFilterBase'
default: []
geo:
$ref: '#/components/schemas/GeoQuery'
diversification:
title: Diversification
description: >
Defines diversification rules to prevent products with the same
attributes (e.g. sneakers made by the same brand
or books from the same authors) from showing up too close to each
other in the results.
For instance, customers who have purchased many of sneakers from
Nike may happen to have recommendations or
search results where all top-5 entries are sneakers made by Nike.
Purely considering accuracy, these
recommendations appear excellent since the user clearly appreciates
Nike sneakers. However,
such results might be considered too "plain" by the user, owing to
its lack of diversity.
`diversification` parameter allows you to avoid this problem by
enforcing a desired *minimum distance* between
products. For example, consider a list of four products whose
`brand` are *Nike, Nike, Adidas,* and *PUMA*
respectively. The query below will make sure there are at least one
different product between two Nike
products, e.g. the diversified ranking may become *Nike, Adidas,
Nike,* and *PUMA* :
```
{
"diversification": {"brand": {"minimum_distance": 1}}
}
```
You can also increase the minimum_distance to place products further
apart. For example, the following query will
make sure, for the two Nike products, there are at least *two* other
products between them.
As a result, the diversified ranking may become *Nike, Adidas,
PUMA*, and *Nike*.:
```
{
"diversification": {"brand": {"minimum_distance": 2}}
}
```
The diversification algorithm reranks the products on a best-effort
basis. For example, for the product list
described earlier, it is not possible to place two Nike product
three places apart from each other. Therefore,
the diversified ranking will still remain *Nike, Adidas, PUMA,* and
Nike* even if we set `minimum_distance=3`.
type: object
additionalProperties:
$ref: '#/components/schemas/DiversifyField'
pagination_id:
title: Pagination Id
description: >
A unique identifier to enable pagination in Recommendation APIs. By
default, Recommendation APIs do not support
pagination because the results from Miso, by its natural, will
change in real-time with new user interactions.
`pagination_id` allows you to implement pagination more easily by
memorize what products we have
returned to the current user with the same `pagination_id`.
To enable pagination, you generate a `pagination_id` and set it in
the first and subsequent requests in the same browsing session
where you want to enable pagination. With `pagination_id` set, you
can access recommendations
in different pages using the combination of `start` and `rows`
parameters, and Miso will ensure that no duplicated
recommendation will be returned in different pages.
For example, assuming you are implementing an infinite scroll with
Miso Recommendation APIs. Before you make the first request,
you generate a `pagination_id` using the `current datetime` or
`uuid` like the following:
```javascript
// current datetime
var my_pagination_id = Date.now().toString()
// OR uuid
const uuidv4 = require("uuid/v4")
var my_pagination_id = uuidv4()
```
You can then request the first page of results with
`my_pagination_id` like the following:
```javascript
{
"pagination_id": my_pagination_id,
"start": 0,
"rows": 10
}
```
Then, you can request the next page of results with the same
`my_pagination_id`, and Miso will ensure
that no duplicated result is returned:
```javascript
{
"pagination_id": my_pagination_id,
"start": 10,
"rows": 10
}
```
Note that, a `pagination_id` will timeout if there is no further
request associated with it for 30 minutes.
Also, `pagination_id` is scoped by individual users: i.e. different
users' results will not be affected
even if they use the same `pagination_id`.
maxLength: 512
type: string
start:
title: Start
description: >
The start of the page you want to access. Combine this with `rows`
to implement pagination. You can only set it when `pagination_id` is
given.
type: integer
default: 0
x-konfig-properties:
geo:
title: Geo
description: >
When set, filter result to include only products within certain
geographic range from given point will be returned,
or to boost product within the same range.
Product should have a field that holds the location of the product,
`location` is used by default,
but other field can also be used.
Distance can be in miles or kilometers. If `distance_unit` is not
set, `mile` will be used.
For example, to limit results to products within 100 miles of New
York city:
```
{
"geo": {
"filter": [{
"lat": 40.73061,
"lon": -73.93524,
"distance": 100
}]
}
}
```
To boost products within 2 kilometers around Alcatraz Island
according to `loc` field:
```
{
"geo": {
"boost": [{
"field": "loc",
"lat": 37.82667,
"lon": -122.42278,
"distance": 2,
"distance_unit": "km"
}]
}
}
```
ValidationError:
title: ValidationError
required:
- loc
- msg
- type
type: object
properties:
loc:
title: Location
type: array
items:
type: string
msg:
title: Message
type: string
type:
title: Error Type
type: string
VariantObject:
title: VariantObject
required:
- id
- name
- slug
- status
type: object
properties:
id:
title: Id
description: The UUID of this variant.
type: string
example: 59769b89-5f1f-46d5-a4fa-a583ebd2f7fd
name:
title: Name
description: The name of this variant.
type: string
example: Treatment_Group
slug:
title: Slug
description: The slug name of this variant.
type: string
example: Treatment_Group
configuration:
title: Configuration
description: The configuration of this variant.
anyOf:
- type: object
- type: array
items: {}
- type: string
example:
model: A
status:
title: Status
description: The current status for this variant.
enum:
- Draft
- Scheduled
- Active
- Completed
- Archived
type: string
example: Active
ViewableImpression:
title: viewable_impression
required:
- type
type: object
properties:
type:
title: Type
description: >
When a product or content asset is presented to the user, it is not
guarantee that the user will see it.
An viewable impression is an impression that is "viewable" by the
user.
Usually, content asset is considered viewable if more than 50% of
its area is visible on screen.
You can also use different definition for what is considered
viewable.
Miso will automatically find the best recommendation as long as the
difference between
viewable and non-viewable impression is consistant.
enum:
- viewable_impression
type: string
product_ids:
title: Product Ids
description: >
Products or content the user is interacting with. This field is
required by
almost all the interaction types. We use `product_ids` to refer to
the product / content records that you upload to Miso.
Therefore, it is important to keep this consistent between the two
datasets.
Example:
```
{"product_ids": ["123ABC-BLACK", "123EFG-YELLOW"]}
```
type: array
items:
type: string
maxLength: 512
default: []
example:
- 123ABC-BLACK
product_group_ids:
title: Product Group Ids
description: >
The product groups the user is interacting with. You only need this
field if you model product
variants using `product_id` and `product_group_id` (see Product
API). If so, you should use this field, when a
user is interacting with a *product group* rather than a specific
product variant, for example, when the user
is viewing the master page of a T-shirt (i.e. a product group), but
has not selected the specific size or
color (i.e. a product variant) yet.
In such situations, the `product_id` is not applicable because we
only know the user is interested in
this T-shirt (a product group), but don't know which particular
product variant the user is interested in.
Therefore, we use `product_group_ids` to capture such interactions
in place of `product_ids`.
In the situations where specific `product_ids` are available, for
example, when user selected a particular size
of the T-Shirt, use `product_ids` instead.
Example:
```
{"product_group_ids": ["123ABC"]}
```
type: array
items:
type: string
maxLength: 512
example:
- 123ABC
user_id:
title: User Id
description: >-
Identifies the signed-in user who performed the interaction. We will
use `user_id` to link Interaction records to your
User records. Therefore, it is important to keep this consistent between the two datasets.For visitors who have
not signed in, see `anonymous_id`.
maxLength: 512
type: string
example: user_1234
anonymous_id:
title: Anonymous Id
description: >-
A pseudo-unique substitute for the User Id. We use `anonymous_id` to
identify a visitor who has not signed
in. `anonymous_id` can be implemented using mechanisms such as cookies or browser localStorage. If `anonymous_id`
is not given, we will default it to `SHA1(:::)`. When a visitor signs
in and the `user_id` and `anonymous_id` are both present, the `anonymous_id` will be linked to the `user_id`
along with the past interactions associated with it.
maxLength: 1024
type: string
example: 86D51273AD8BF84217E1567B6CBE7152D7034404
timestamp:
title: Timestamp
description: >
The ISO-8601 timestamp specifying when the interaction occurred. If
the interaction just happened, leave it out and we
will default to the server's time. If you're importing data from the
past, make sure you provide a
timestamp. It is recommended to include milliseconds in the
timestamp to provide a higher time resolution.
Example:
```
{"timestamp": "2018-11-07T00:25:00.073876Z"}
```
type: string
format: date-time
miso_id:
title: Miso Id
description: >
Miso-generated unique Id for each recommendation or search result.
Maintaining this Id for
subsequent page views is important to Miso's performance, as we use
`miso_id` to track and fine-tune the
performance of personalization and search results. When a user
clicks on a recommendation or search result,
you should pass the associated `miso_id` to the next page view, and
associate the `miso_id` with the
interactions that take place on the page (e.g.
`product_detail_page_view`, `add_to_cart`,
`add_to_collection`, `like`, etc.). In this way, Miso will learn
which recommendations work and which didn't.
Example:
```
{"misoId": "123e4567-e89b-12d3-a456-426614174000"}
```
type: string
format: uuid
example: 123e4567-e89b-12d3-a456-426614174000
context:
$ref: '#/components/schemas/WebBasedContext'
x-konfig-properties:
context:
title: Context
description: >
Dictionary of extra information that provides useful context about
an interaction. We use context
information to make recommendations tailored not only for each user,
but also for their current browsing context.
For example, a user browsing on a desktop may have different
browsing behavior than a user browsing on mobile
phone. As another example, a user who gets to the site via a certain
campaign you run on Facebook may have very
different interests than a user who visits your site directly.
Context information is also useful for personalization for entirely
new visitors, as we can immediately
personalize their experiences based on their context alone (e.g. the
referrer or the campaign they clicked through).
Example:
```
{"context": {
"campaign":
{
"name": "spring_sale",
"source": "Google",
"medium": "cpc",
"term": "running+shoes",
"content": "textlink"
},
"truncated_ip": "1.1.1.0",
"locale": "en-US",
"region": "US East",
"page":
{
"url": "https://example.com/miso-tshirt-123ABC",
"referrer": "https://example.com/",
"title": "My Product Page"
},
"user_agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0)"
},
"custom_context": {
"other_context_var_1": "value_1",
"other_context_var_2": "value_2"
}
}
```
Watch:
title: watch
required:
- type
type: object
properties:
type:
title: Type
description: >
Used to record when and for how long a user watches content that is
of a video format.
enum:
- watch
type: string
duration:
title: Duration
description: >
How long (in seconds) the user stayed on this page, or consumed
(listened, read, or watched) a product. This field is
optional, but it's very important in scenarios where consumption
duration matters, including
`product_detail_page_view`, `category_page_view`, `watch`, `listen`,
and `read`. For example, if a user only
views or consumes a product for less than 5 seconds, that user is
probably not interested in the product. On
the other hand, if a user stays on a page for a while, it usually
means they are seriously engaging with or
considering the product. When `duration` is absent, we will use the
timestamp of the next interaction to
infer a rough duration value.
Example:
```
{"duration": 61.5}
```
type: number
example: 61.5
product_ids:
title: Product Ids
description: >
Products or content the user is interacting with. This field is
required by
almost all the interaction types. We use `product_ids` to refer to
the product / content records that you upload to Miso.
Therefore, it is important to keep this consistent between the two
datasets.
Example:
```
{"product_ids": ["123ABC-BLACK", "123EFG-YELLOW"]}
```
type: array
items:
type: string
maxLength: 512
default: []
example:
- 123ABC-BLACK
product_group_ids:
title: Product Group Ids
description: >
The product groups the user is interacting with. You only need this
field if you model product
variants using `product_id` and `product_group_id` (see Product
API). If so, you should use this field, when a
user is interacting with a *product group* rather than a specific
product variant, for example, when the user
is viewing the master page of a T-shirt (i.e. a product group), but
has not selected the specific size or
color (i.e. a product variant) yet.
In such situations, the `product_id` is not applicable because we
only know the user is interested in
this T-shirt (a product group), but don't know which particular
product variant the user is interested in.
Therefore, we use `product_group_ids` to capture such interactions
in place of `product_ids`.
In the situations where specific `product_ids` are available, for
example, when user selected a particular size
of the T-Shirt, use `product_ids` instead.
Example:
```
{"product_group_ids": ["123ABC"]}
```
type: array
items:
type: string
maxLength: 512
example:
- 123ABC
user_id:
title: User Id
description: >-
Identifies the signed-in user who performed the interaction. We will
use `user_id` to link Interaction records to your
User records. Therefore, it is important to keep this consistent between the two datasets.For visitors who have
not signed in, see `anonymous_id`.
maxLength: 512
type: string
example: user_1234
anonymous_id:
title: Anonymous Id
description: >-
A pseudo-unique substitute for the User Id. We use `anonymous_id` to
identify a visitor who has not signed
in. `anonymous_id` can be implemented using mechanisms such as cookies or browser localStorage. If `anonymous_id`
is not given, we will default it to `SHA1(:::)`. When a visitor signs
in and the `user_id` and `anonymous_id` are both present, the `anonymous_id` will be linked to the `user_id`
along with the past interactions associated with it.
maxLength: 1024
type: string
example: 86D51273AD8BF84217E1567B6CBE7152D7034404
timestamp:
title: Timestamp
description: >
The ISO-8601 timestamp specifying when the interaction occurred. If
the interaction just happened, leave it out and we
will default to the server's time. If you're importing data from the
past, make sure you provide a
timestamp. It is recommended to include milliseconds in the
timestamp to provide a higher time resolution.
Example:
```
{"timestamp": "2018-11-07T00:25:00.073876Z"}
```
type: string
format: date-time
miso_id:
title: Miso Id
description: >
Miso-generated unique Id for each recommendation or search result.
Maintaining this Id for
subsequent page views is important to Miso's performance, as we use
`miso_id` to track and fine-tune the
performance of personalization and search results. When a user
clicks on a recommendation or search result,
you should pass the associated `miso_id` to the next page view, and
associate the `miso_id` with the
interactions that take place on the page (e.g.
`product_detail_page_view`, `add_to_cart`,
`add_to_collection`, `like`, etc.). In this way, Miso will learn
which recommendations work and which didn't.
Example:
```
{"misoId": "123e4567-e89b-12d3-a456-426614174000"}
```
type: string
format: uuid
example: 123e4567-e89b-12d3-a456-426614174000
context:
$ref: '#/components/schemas/WebBasedContext'
x-konfig-properties:
context:
title: Context
description: >
Dictionary of extra information that provides useful context about
an interaction. We use context
information to make recommendations tailored not only for each user,
but also for their current browsing context.
For example, a user browsing on a desktop may have different
browsing behavior than a user browsing on mobile
phone. As another example, a user who gets to the site via a certain
campaign you run on Facebook may have very
different interests than a user who visits your site directly.
Context information is also useful for personalization for entirely
new visitors, as we can immediately
personalize their experiences based on their context alone (e.g. the
referrer or the campaign they clicked through).
Example:
```
{"context": {
"campaign":
{
"name": "spring_sale",
"source": "Google",
"medium": "cpc",
"term": "running+shoes",
"content": "textlink"
},
"truncated_ip": "1.1.1.0",
"locale": "en-US",
"region": "US East",
"page":
{
"url": "https://example.com/miso-tshirt-123ABC",
"referrer": "https://example.com/",
"title": "My Product Page"
},
"user_agent": "Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0)"
},
"custom_context": {
"other_context_var_1": "value_1",
"other_context_var_2": "value_2"
}
}
```
WebBasedContext:
title: WebBasedContext
type: object
properties:
campaign:
$ref: '#/components/schemas/Campaign'
truncated_ip:
title: Truncated Ip
description: >
User's truncated IP address. We use IP address to determine the
country of the users.
type: string
format: ipv4
example: 1.1.1.0
locale:
title: Locale
description: Locale string of the current session, for example en-US.
type: string
example: en-US
region:
title: Region
description: >
The region/location of the site the user is visiting. This is for
sites that serve different regions or
markets. You can define your own region keywords, for example, `US
East`, `Europe`, `LATM`, etc.
type: string
example: US East
page:
$ref: '#/components/schemas/Page'
user_agent:
title: User Agent
description: >
User agent of the device making the request. We use this to
determine if a user is browsing the site on
mobile or desktop, and tailor the recommendations and search results
accordingly.
Example:
```
{"user_agent":
"Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0"}
```
type: string
example: >-
Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:47.0) Gecko/20100101
Firefox/47.0
custom_context:
title: Custom Context
description: >
Dictionary of custom context variables for the current browsing
session. You can specify context variables
specific to your websites or apps in a `{"KEY":VALUE}` format, where
`KEY` must be a string, and `VALUE` can be:
* a `bool`
* a `string` or an `array of string`
* a `number` or an `array of numbers`
* an `array of objects`
* `null`
Miso will take these variables into account when generating
recommendations.
type: object
additionalProperties:
anyOf:
- type: boolean
- type: integer
- type: number
- type: string
- type: array
items:
type: number
- type: array
items:
type: string
- type: array
items:
type: object
additionalProperties:
anyOf:
- type: string
- type: number
- type: integer
- type: boolean
example:
session_variable_1:
- value_1
- value_2
x-konfig-properties:
campaign:
title: Campaign
description: >
The campaign that resulted in the interaction. Campaign dictionary
contains standard UTM parameters: `name`,
`source`, `medium`, `term`, `content`. We use campaign information
to infer users' interests and fine-tune the
personalization and search results based on the current user's
campaign information.
page:
title: Page
description: >-
The current page in the browser. Page dictionary containing
referrer, title and url. we will use page view
as a pseudo interaction to infer users' interest.
YMALRequest:
title: YMALRequest
description: Attributes for recommendation boosting
type: object
properties:
product_id:
title: Product Id
description: >
The `product_id` of the *anchor* product. The returned
recommendations will be
the products that are similar or are liked by the same users who
also like the anchor product.
minLength: 1
type: string
product_ids:
title: Product Ids
description: >
The `product_ids` of a **list** of *anchor* products. The returned
recommendations will be
the products that are similar or are liked by the same users who
also like these anchor products. For example,
you can use the products in a user's shopping cart as the anchor
products to make purchase recommendations
for this user.
minLength: 1
type: array
items:
type: string
minLength: 1
product_group_id:
title: Product Group Id
description: >
The `product_group_id` of the *anchor* product group. The returned
recommendations will be
the products that are similar or are liked by the same users who
also like the anchor *product group*.
You should use `product_group_id` on a *product
group* page, before users select a specific product variant. For
example, you should use `product_group_id`
on the product group page of a T-shirt, and use `product_id`, once
user choose any specific size or color
variants of the T-shirt.
minLength: 1
type: string
product_group_ids:
title: Product Group Ids
description: >
The `product_group_ids` of the *anchor* product groups. The returned
recommendations will be
the products that are similar or are liked by the same users who
also like the anchor *product groups*.
You should use `product_group_ids` in pages you want to recommend
products related to multiple product groups.
type: array
items:
type: string
buy_together:
title: Buy Together
description: >+
Whether to focus on the Products that are frequently *bought
together*. `buy_together` parameter is by default `false`,
which make the *Product To Products API* focus on Products that are
related to the anchor products, e.g. the products
with similar contents or frequently attract the interests of the
same group of users.
When `buy_together=true`, the ProductToProducts API will focus on
the type of Products that are more frequently bought
together along with the anchor product(s) in the same transactions
or session.
type: boolean
default: false
engine_id:
title: Engine Id
description: >
The engine you want to get results from. When you have more than one
engine, you can use this parameter to
specify the specific engine you want to get results from. If not
specified, the default engine will be used.
type: string
user_id:
title: User Id
description: >
The user who made the query and for whom Miso will personalize the
results. For an anonymous visitor, use `anonymous_id` instead.
type: string
anonymous_id:
title: Anonymous Id
description: >-
The anonymous visitor who made the query and for whom Miso will
personalize the results. Either
`user_id` or `anonymous_id` needs to be specified for personalization to work.
type: string
user_hash:
title: User Hash
description: >
The hash of `user_id` (or `anonymous_id`) encrypted by your [Secret
API Key](https://api.askmiso.com).
`user_hash` is required to prevent unauthorized API access if you
are
making API calls with a [Publishable API
Key](https://api.askmiso.com).
You should generate the user_hash via HMAC scheme: you encrypt the
desired user_id (or anonymous_id) with your
[Secret API Key](https://api.askmiso.com) on your backend server,
and then let the front-end code send the generated user_hash to Miso
APIs to
verify the identity of the API caller.
As long as the [Secret API Key](https://api.askmiso.com)
is kept secret, the user_hash prevents a malicious attacker from making unauthorized
API calls or impersonating any of your users.
Miso APIs accept the case-incentive "hex digest" of user hash, a
sample Python 3 code to generate it on your backend server
is as follow:
```python
import hashlib
import hmac
YOUR_MISO_SECRET_API_KEY = "039c501ac8dfcac91"
key_bytes = YOUR_MISO_SECRET_API_KEY.encode()
user_id = "USER_123" # or anonymous_id
user_id_bytes = user_id.encode()
user_hash = hmac.new(
key_bytes,
user_id_bytes,
hashlib.sha256).hexdigest()
# user_hash is "7eb04da5e..."
```
You can find more examples for other languages in this [Github
Gist](https://gist.github.com/thewheat/7342c76ade46e7322c3e)
type: string
user_cohort:
title: User Cohort
description: >
The user cohort you want to cold-start the recommendation with. For
example, the following query will make
recommendations based on the preferences of the users whose
`country="United States"`, and `gender="Female"`
in the User Profile dataset.
```
{
"user_cohort": {
"country": "United States",
"gender": "Female"
}
}
```
type: object
additionalProperties:
anyOf:
- type: boolean
- type: string
rows:
title: Rows
description: Number of product recommendations to return
type: integer
default: 5
type:
title: Type
description: >
The type of products to return. Use this parameter to make the API
return only
a certain type of products (see [Product
APIs](https://api.askmiso.com)).
This is particularly useful for sites that have multiple types of
products:
For example, on a marketplace site, YOu may model *merchandise* and
*store* as two types of *products*. You can
then use type parameter to limit the recommendation or search
results to return only one kind of them.
For instance, the following query will return only *store* products:
```
{"type": "store"}
```
For another example, on a travel website, you might have: *hotel*,
*thing to do*, and *restaurant*,
three kinds
of products. You can use `type` parameter to limit results to one
kind of them. For instance, the following
query will limit the results to only *hotels* product:
```
{"type": "hotel"}
```
type: string
dedupe_product_group_id:
title: Dedupe Product Group Id
description: >
Whether to dedupe product based on `product_group_id`. If
`dedupe_product_group_id=true`,
Miso will prevent products with the same `product_group_id` from
showing multiple
times in the search or recommendation results.
This is particular useful when one product has multiple variants
(for example, different
sizes, colors, or materials), and you only want to show this product
only once in the search or recommendation
results. Miso will then return the variant that is most likely to be
of the user's interest.
type: boolean
default: true
additional_interactions:
title: Additional Interactions
description: >
A list of additional interaction records. You can use this fields to
simulate user interactions without
actually writing them to the interaction dataset.
type: array
items:
anyOf:
- $ref: '#/components/schemas/ProductDetailPageView'
- $ref: '#/components/schemas/Search'
- $ref: '#/components/schemas/AddToCart'
- $ref: '#/components/schemas/RemoveFromCart'
- $ref: '#/components/schemas/Checkout'
- $ref: '#/components/schemas/Refund'
- $ref: '#/components/schemas/Subscribe'
- $ref: '#/components/schemas/AddToCollection'
- $ref: '#/components/schemas/RemoveFromCollection'
- $ref: '#/components/schemas/Read'
- $ref: '#/components/schemas/Watch'
- $ref: '#/components/schemas/Listen'
- $ref: '#/components/schemas/Like'
- $ref: '#/components/schemas/Dislike'
- $ref: '#/components/schemas/Share'
- $ref: '#/components/schemas/Rate'
- $ref: '#/components/schemas/Bookmark'
- $ref: '#/components/schemas/Complete'
- $ref: '#/components/schemas/Feedback'
- $ref: '#/components/schemas/Impression'
- $ref: '#/components/schemas/ViewableImpression'
- $ref: '#/components/schemas/Click'
- $ref: '#/components/schemas/HomePageView'
- $ref: '#/components/schemas/CategoryPageView'
- $ref: '#/components/schemas/PromoPageView'
- $ref: '#/components/schemas/ProductImageView'
- $ref: '#/components/schemas/Custom'
default: []
fl:
title: Fl
description: >
List of fields to retrieve. For example, the following request
retrieves only the `title` field of each product along
with the `product_id`, which is always returned.
```
{"fl": ["title"]}
```
You can also match field names by using `*` as a wildcard. For
example, the query below retrieves the `title`
and any custom attributes under the `attributes` dictionary.
```
{"fl": ["title", "attributes.*"]}
```
The following retrieves all the available fields:
```
{"fl": ["*"]}
```
For the lowest latency, use an empty array to retrieve just the
`product_id` field (which is the default).
```
{"fl": []}
```
type: array
items:
type: string
default: []
exclude:
title: Exclude
description: >-
An array of `product_ids` of products you want to *exclude* from
search results.
type: array
items:
type: string
boosting_tags:
title: Boosting Tags
description: >
When `boosting_tags` is given, and there are pre-defined boost rules
have the same tag(s),
those boost rules will be matched, regardless if the criteria is met
or not.
Useful when want to force trigger specific boost campaign.
type: array
items:
type: string
default: []
example:
- tag-1
- quetag-2
fq:
title: Fq
description: >
Defines a query in Solr syntax that can be used to restrict the
superset of
products to return, without influencing the overall ranking. `fq`
can enable users to drill down to products
with specific features based on different product attributes
For example, the query below limits the search results to only show
products whose size is either `M` or `S` and
brand is `Nike`:
```
{"fq": "size:(\"M\" OR \"S\") AND brand:\"Nike\""}
```
You can use `fq` to apply filters against your custom attributes as
well. For example, the query below limits the
search results to only products whose `designer` attribute is
`Calvin Klein`
```
{"fq": "attributes.designer:\"Calvin Klein\""}
```
`fq` can also limit search results by numerical range. For example,
the following query limits the results to
products that have `rating >= 4`.
```
{"fq": "rating:[4 TO *]"}
```
type: string
boost_fq:
title: Boost Fq
description: >
Defines a query in Solr syntax that can be used to boost a subset of
products to the top of the ranking, or to
specific *boost positions* (See `boost_positions` parameter below.)
For example, the query below will promote all the relevant products
whose brand is `Nike` to the top of
recommendation list:
```
{
"boost_fq": "brand:\"Nike\""
}
```
For a slightly more complex example, the query below will promote
the Nike products which have also been tagged
as `ON SALE` to the top of the ranking:
```
{
"boost_fq": "brand:\"Nike\" AND tags:\"ON SALE\""
}
```
It is worth mentioning that, Miso will only boost products that are
relevant and have high likelihood to convert,
and will not boost a low performance product only because it matches
the boosting query.
Depending on your boosting rules, in certain cases, you would like
to prevent recommendation results from being
too monotone due to boosting. With Miso, you have two tools to do
so.
First, you can specify `boost_positions` to place promoted products
at specific positions in the ranking. For
example, the query below will place boosted products only at the
first and fourth places in the ranking
(positions are 0-based), and place the remaining products in their
original ranking, skipping these two positions.
```
{
"boost_fq": "brand:\"Nike\" AND tags:\"ON SALE\"",
"boost_positions": [0, 3]
}
```
The second tool is `diversification`. `diversification` parameter,
on a best-effort basis, will try to
maintain a minimum distance between products that have the same
attributes. For example, the following query
will place products made by the same brand apart from each other.
```
{
"boost_fq": "brand:\"Nike\" AND tags:\"ON SALE\"",
"diversification": {
"brand": {"minimum_distance": 1}
}
}
```
type: string
boost_positions:
title: Boost Positions
description: >
Defines a list of 0-based positions you want to place the boosted
products at.
For example, the query below will promote products whose brand is
`Nike` as the top and second recommendations:
```
{
"boost_fq": "brand:\"Nike\"",
"boost_positions": [0, 1]
}
```
If `boost_positions` is not specified (which is the default
behavior), all the boosted products will be ranked
higher than the rest of the products.
type: array
items:
type: integer
boost_rules:
title: Boost Rules
description: >
Define a list of boosting rules that will be applied to the search
or recommendation results simultaneously. `boost_rules`
parameter is particularly useful when you want to boost more than
one sets of products, and promote each of them to different
positions. For example, the query below will promote products whose
brand is `Nike` to the top
and second results, and products whose brand is `Adidas` to the
third and fourth results:
```
{
"boost_rules": [
{
"boost_fq": "brand:\"Nike\"",
"boost_positions": [0, 1]
},
{
"boost_fq": "brand:\"Adidas\"",
"boost_positions": [2, 3]
}
]
}
```
type: array
items:
$ref: '#/components/schemas/BoostingFilterBase'
default: []
geo:
$ref: '#/components/schemas/GeoQuery'
diversification:
title: Diversification
description: >
Defines diversification rules to prevent products with the same
attributes (e.g. sneakers made by the same brand
or books from the same authors) from showing up too close to each
other in the results.
For instance, customers who have purchased many of sneakers from
Nike may happen to have recommendations or
search results where all top-5 entries are sneakers made by Nike.
Purely considering accuracy, these
recommendations appear excellent since the user clearly appreciates
Nike sneakers. However,
such results might be considered too "plain" by the user, owing to
its lack of diversity.
`diversification` parameter allows you to avoid this problem by
enforcing a desired *minimum distance* between
products. For example, consider a list of four products whose
`brand` are *Nike, Nike, Adidas,* and *PUMA*
respectively. The query below will make sure there are at least one
different product between two Nike
products, e.g. the diversified ranking may become *Nike, Adidas,
Nike,* and *PUMA* :
```
{
"diversification": {"brand": {"minimum_distance": 1}}
}
```
You can also increase the minimum_distance to place products further
apart. For example, the following query will
make sure, for the two Nike products, there are at least *two* other
products between them.
As a result, the diversified ranking may become *Nike, Adidas,
PUMA*, and *Nike*.:
```
{
"diversification": {"brand": {"minimum_distance": 2}}
}
```
The diversification algorithm reranks the products on a best-effort
basis. For example, for the product list
described earlier, it is not possible to place two Nike product
three places apart from each other. Therefore,
the diversified ranking will still remain *Nike, Adidas, PUMA,* and
Nike* even if we set `minimum_distance=3`.
type: object
additionalProperties:
$ref: '#/components/schemas/DiversifyField'
pagination_id:
title: Pagination Id
description: >
A unique identifier to enable pagination in Recommendation APIs. By
default, Recommendation APIs do not support
pagination because the results from Miso, by its natural, will
change in real-time with new user interactions.
`pagination_id` allows you to implement pagination more easily by
memorize what products we have
returned to the current user with the same `pagination_id`.
To enable pagination, you generate a `pagination_id` and set it in
the first and subsequent requests in the same browsing session
where you want to enable pagination. With `pagination_id` set, you
can access recommendations
in different pages using the combination of `start` and `rows`
parameters, and Miso will ensure that no duplicated
recommendation will be returned in different pages.
For example, assuming you are implementing an infinite scroll with
Miso Recommendation APIs. Before you make the first request,
you generate a `pagination_id` using the `current datetime` or
`uuid` like the following:
```javascript
// current datetime
var my_pagination_id = Date.now().toString()
// OR uuid
const uuidv4 = require("uuid/v4")
var my_pagination_id = uuidv4()
```
You can then request the first page of results with
`my_pagination_id` like the following:
```javascript
{
"pagination_id": my_pagination_id,
"start": 0,
"rows": 10
}
```
Then, you can request the next page of results with the same
`my_pagination_id`, and Miso will ensure
that no duplicated result is returned:
```javascript
{
"pagination_id": my_pagination_id,
"start": 10,
"rows": 10
}
```
Note that, a `pagination_id` will timeout if there is no further
request associated with it for 30 minutes.
Also, `pagination_id` is scoped by individual users: i.e. different
users' results will not be affected
even if they use the same `pagination_id`.
maxLength: 512
type: string
start:
title: Start
description: >
The start of the page you want to access. Combine this with `rows`
to implement pagination. You can only set it when `pagination_id` is
given.
type: integer
default: 0
x-konfig-properties:
geo:
title: Geo
description: >
When set, filter result to include only products within certain
geographic range from given point will be returned,
or to boost product within the same range.
Product should have a field that holds the location of the product,
`location` is used by default,
but other field can also be used.
Distance can be in miles or kilometers. If `distance_unit` is not
set, `mile` will be used.
For example, to limit results to products within 100 miles of New
York city:
```
{
"geo": {
"filter": [{
"lat": 40.73061,
"lon": -73.93524,
"distance": 100
}]
}
}
```
To boost products within 2 kilometers around Alcatraz Island
according to `loc` field:
```
{
"geo": {
"boost": [{
"field": "loc",
"lat": 37.82667,
"lon": -122.42278,
"distance": 2,
"distance_unit": "km"
}]
}
}
```
app__schemas__engine_api__request__PreviewBoosting:
title: PreviewBoosting
description: Properties to receive on Boosting creation
required:
- query_option
- boost_match_type
- boost
- position
type: object
properties:
query:
title: Query
description: The boosting rule query.
type: string
queries:
title: Queries
description: Multiple query of the boosting rule.
type: array
items:
type: string
query_option:
title: Query Option
description: >-
The options of the query. Please fill this field with contains,
not_contain, is, and is_not value.
enum:
- contains
- not_contain
- is
- is_not
type: string
filter_query:
title: Filter Query
description: The filter queries of the boosting rule.
type: array
items:
$ref: '#/components/schemas/FilterQueryItem'
boost_match_type:
title: Boost Match Type
description: Type of the query. Please fill this field with any or all.
enum:
- any
- all
type: string
boost:
title: Boost
description: The items of the boosting rule.
type: array
items:
$ref: '#/components/schemas/BoostItem'
position:
title: Position
description: The position of the boosting rule should occur.
type: array
items:
type: integer
json_asset:
title: Json Asset
description: The boosting json asset.
type: string
example:
CO:
- product-name: name
product-image-url: url
boosting_tags:
title: Boosting Tags
description: The comma-separated boosting tags.
type: array
items:
type: string
example:
- tag-1
- tag-2
app__schemas__engine_api__request__Question:
title: Question
description: Question object
required:
- question
type: object
properties:
question:
title: Question
description: The text of question.
minLength: 1
type: string
weight:
title: Weight
description: The weight of question.
type: number
default: 1
app__schemas__engine_api__response__Question:
title: Question
description: 'Question object '
required:
- question
type: object
properties:
question:
title: Question
minLength: 1
type: string
weight:
title: Weight
type: number
default: 1
app__schemas__rec_boosting__PreviewBoosting:
title: PreviewBoosting
description: Attributes of boosting
required:
- api_names
- boost_match_type
- boost
- position
type: object
properties:
api_names:
title: Api Names
description: The api_names values
type: array
items:
type: string
anchor_products:
title: Anchor Products
description: The anchor products ids
type: array
items:
type: string
default: []
module_names:
title: Module Names
description: The module name
type: array
items:
type: string
boost_match_type:
title: Boost Match Type
description: Type of the query. Please fill this field with any or all.
enum:
- any
- all
type: string
boost:
title: Boost
description: The items of the boosting rule.
type: array
items:
$ref: '#/components/schemas/BoostItem'
position:
title: Position
description: 1-based index of the position of the boosting rule should occur.
type: array
items:
type: integer
example:
- 1
- 2
boosting_tags:
title: Boosting Tags
description: The comma-separated boosting tags.
type: array
items:
type: string
example:
- tag-1
- tag-2
ExperimentApIsSendEventResponse:
type: object
properties:
message:
type: string
example: api_key is invalid. Please check your api_key in Dojo.
example:
message: api_key is invalid. Please check your api_key in Dojo.
ExperimentApIsSendEvent404Response:
type: object
properties:
message:
type: string
example: Variant is not found. Please check your variant_name.
example:
message: Variant is not found. Please check your variant_name.
ExperimentApIsSendEvent422Response:
type: object
properties:
message:
type: string
example: Request schema error. See "data.errors" for details
data:
type: object
properties:
errors:
type: array
items:
type: object
properties:
loc:
type: array
items:
oneOf:
- type: string
example: body
- type: number
example: 35
example: 35
msg:
type: string
example: 'Expecting '','' delimiter: line 3 column 5 (char 35)'
type:
type: string
example: value_error.jsondecode
example:
message: Request schema error. See "data.errors" for details
data:
errors:
- loc:
- body
- 35
msg: 'Expecting '','' delimiter: line 3 column 5 (char 35)'
type: value_error.jsondecode
InteractionApIsInsertRecordsResponse:
type: object
properties:
message:
type: string
example: invalid api key.
example:
message: invalid api key.
InteractionApIsInsertRecords403Response:
type: object
properties:
message:
type: string
example: >-
Request is denied due to bot blocking. Please only access this API
from a real browser or use Secret API Key instead.
example:
message: >-
Request is denied due to bot blocking. Please only access this API
from a real browser or use Secret API Key instead.
InteractionApIsInsertRecords422Response:
type: object
properties:
errors:
type: boolean
example: true
message:
type: string
example: >-
None of the records were inserted because at least one of them
contained schema errors. Please see the `data` field for details.
data:
type: array
items:
type: string
example: >-
data.0.product_ids is invalid. The attribute was expected to be of
type ''array', 'null'' but type 'string' was given.
example:
errors: true
message: >-
None of the records were inserted because at least one of them
contained schema errors. Please see the `data` field for details.
data:
- >-
data.0.product_ids is invalid. The attribute was expected to be of
type ''array', 'null'' but type 'string' was given.
- >-
data.0.timestamp is invalid. The attribute should match the
'date-time' format.
ProductContentApIsBulkInsertResponse:
type: object
properties:
'message:':
type: string
example: Request timeout.
example:
'message:': Request timeout.
ProductContentApIsBulkInsert401Response:
type: object
properties:
message:
type: string
example: invalid api key.
example:
message: invalid api key.
ProductContentApIsBulkInsert403Response:
type: object
properties:
message:
type: string
example: >-
Request is denied due to bot blocking. Please only access this API
from a real browser or use Secret API Key instead.
example:
message: >-
Request is denied due to bot blocking. Please only access this API
from a real browser or use Secret API Key instead.
ProductContentApIsBulkInsert422Response:
type: object
properties:
errors:
type: boolean
example: true
message:
type: string
example: >-
None of the records are inserted, because at least one of them
contain schema errors. Please see `data` field for details.
data:
type: array
items:
type: string
example: >-
data.0.product_id is invalid. The attribute expected to be of type
'string', but 'array' is given.
example:
errors: true
message: >-
None of the records are inserted, because at least one of them contain
schema errors. Please see `data` field for details.
data:
- >-
data.0.product_id is invalid. The attribute expected to be of type
'string', but 'array' is given.
- >-
data.0.created_at is invalid. The attribute should match 'date-time'
format.
ProductContentApIsBulkInsert500Response:
type: object
properties:
message:
type: string
example: Something went wrong. Please contact miso product team.
example:
message: Something went wrong. Please contact miso product team.
ProductContentApIsDeleteProductContentResponse:
type: object
properties:
'message:':
type: string
example: Request timeout.
example:
'message:': Request timeout.
ProductContentApIsDeleteProductContent401Response:
type: object
properties:
message:
type: string
example: invalid api key.
example:
message: invalid api key.
ProductContentApIsDeleteProductContent403Response:
type: object
properties:
message:
type: string
example: >-
Request is denied due to bot blocking. Please only access this API
from a real browser or use Secret API Key instead.
example:
message: >-
Request is denied due to bot blocking. Please only access this API
from a real browser or use Secret API Key instead.
ProductContentApIsDeleteProductContent500Response:
type: object
properties:
message:
type: string
example: Something went wrong. Please contact miso product team.
example:
message: Something went wrong. Please contact miso product team.
ProductContentApIsGetProductDetailsResponse:
type: object
properties:
message:
type: string
example: invalid api key.
example:
message: invalid api key.
ProductContentApIsGetProductDetails404Response:
type: object
properties:
message:
type: string
example: not found
example:
message: not found
ProductContentApIsGetProductDetails500Response:
type: object
properties:
message:
type: string
example: Something went wrong. Please contact miso product team.
example:
message: Something went wrong. Please contact miso product team.
ProductContentApIsGetProductIdsResponse:
type: object
properties:
message:
type: string
example: invalid api key.
example:
message: invalid api key.
ProductContentApIsGetProductIds500Response:
type: object
properties:
message:
type: string
example: Something went wrong. Please contact miso product team.
example:
message: Something went wrong. Please contact miso product team.
ProductContentApIsBulkDeleteResponse:
type: object
properties:
'message:':
type: string
example: Request timeout.
example:
'message:': Request timeout.
ProductContentApIsBulkDelete401Response:
type: object
properties:
message:
type: string
example: invalid api key.
example:
message: invalid api key.
ProductContentApIsBulkDelete403Response:
type: object
properties:
message:
type: string
example: >-
Request is denied due to bot blocking. Please only access this API
from a real browser or use Secret API Key instead.
example:
message: >-
Request is denied due to bot blocking. Please only access this API
from a real browser or use Secret API Key instead.
ProductContentApIsBulkDelete500Response:
type: object
properties:
message:
type: string
example: Something went wrong. Please contact miso product team.
example:
message: Something went wrong. Please contact miso product team.
UserApIsBulkUploadResponse:
type: object
properties:
'message:':
type: string
example: Request timeout.
example:
'message:': Request timeout.
UserApIsBulkUpload401Response:
type: object
properties:
message:
type: string
example: invalid api key.
example:
message: invalid api key.
UserApIsBulkUpload403Response:
type: object
properties:
message:
type: string
example: >-
Request is denied due to bot blocking. Please only access this API
from a real browser or use Secret API Key instead.
example:
message: >-
Request is denied due to bot blocking. Please only access this API
from a real browser or use Secret API Key instead.
UserApIsBulkUpload422Response:
type: object
properties:
errors:
type: boolean
example: true
message:
type: string
example: >-
None of the records are inserted, because at least one of them
contain schema errors. Please see `data` field for details.
data:
type: array
items:
type: string
example: >-
data.0.user_id is invalid. The attribute expected to be of type
'string', but 'array' is given.
example:
errors: true
message: >-
None of the records are inserted, because at least one of them contain
schema errors. Please see `data` field for details.
data:
- >-
data.0.user_id is invalid. The attribute expected to be of type
'string', but 'array' is given.
- >-
data.0.created_at is invalid. The attribute should match 'date-time'
format.
UserApIsBulkUpload500Response:
type: object
properties:
message:
type: string
example: Something went wrong. Please contact miso product team.
example:
message: Something went wrong. Please contact miso product team.
UserApIsDeleteUserResponse:
type: object
properties:
'message:':
type: string
example: Request timeout.
example:
'message:': Request timeout.
UserApIsDeleteUser401Response:
type: object
properties:
message:
type: string
example: invalid api key.
example:
message: invalid api key.
UserApIsDeleteUser403Response:
type: object
properties:
message:
type: string
example: >-
Request is denied due to bot blocking. Please only access this API
from a real browser or use Secret API Key instead.
example:
message: >-
Request is denied due to bot blocking. Please only access this API
from a real browser or use Secret API Key instead.
UserApIsDeleteUser500Response:
type: object
properties:
message:
type: string
example: Something went wrong. Please contact miso product team.
example:
message: Something went wrong. Please contact miso product team.
UserApIsGetUserDetailsResponse:
type: object
properties:
message:
type: string
example: invalid api key.
example:
message: invalid api key.
UserApIsGetUserDetails403Response:
type: object
properties:
message:
type: string
example: >-
Request is denied due to bot blocking. Please only access this API
from a real browser or use Secret API Key instead.
example:
message: >-
Request is denied due to bot blocking. Please only access this API
from a real browser or use Secret API Key instead.
UserApIsGetUserDetails404Response:
type: object
properties:
message:
type: string
example: not found
example:
message: not found
UserApIsGetUserDetails500Response:
type: object
properties:
message:
type: string
example: Something went wrong. Please contact miso product team.
example:
message: Something went wrong. Please contact miso product team.
UserApIsBulkUserDeleteResponse:
type: object
properties:
'message:':
type: string
example: Request timeout.
example:
'message:': Request timeout.
UserApIsBulkUserDelete401Response:
type: object
properties:
message:
type: string
example: invalid api key.
example:
message: invalid api key.
UserApIsBulkUserDelete403Response:
type: object
properties:
message:
type: string
example: >-
Request is denied due to bot blocking. Please only access this API
from a real browser or use Secret API Key instead.
example:
message: >-
Request is denied due to bot blocking. Please only access this API
from a real browser or use Secret API Key instead.
UserApIsBulkUserDelete500Response:
type: object
properties:
message:
type: string
example: Something went wrong. Please contact miso product team.
example:
message: Something went wrong. Please contact miso product team.
securitySchemes:
Secret API Key:
description: >+
Your secret API key is used to access every Miso API endpoint. You
should secure this key and only use it on a backend
server. Never leave this key in your client-side JavaScript code. If the
private key is compromised, you can revoke it
in [Dojo](https://dojo.askmiso.com/docs/api-browser) and get a new one.
Specify your secret key in the `api_key` query parameter. For example:
```
POST /v1/users?api_key=039c501ac8dfcac91c6f05601cee876e1cc07e17
```
type: apiKey
in: query
name: api_key
Publishable API Key:
description: >
Your publishable API key is used to call Miso's APIs from your front-end
code. It can be used to stream interactions from the browser using
Miso's Interactions Upload API or to access read-only search and
recommendation results for a given user. When using the publishable API
key, the requested user_id will need to be hashed to maintain the
necessary security compliance.
Specify your publishable key in the `api_key` query parameter. For
example:
```
POST /v1/interactions?api_key=039c501ac8dfcac91c6f05601cee876e1cc07e17
```
type: apiKey
in: query
name: api_key
x-tagGroups:
- tags:
- Interaction APIs
- Product / Content APIs
- User APIs
name: Data APIs
- tags:
- Search APIs
- Recommendation APIs
- Ask APIs
- Signal API
- Bulk API
name: Engine APIs
- tags:
- Experiment APIs
name: Experiment APIs
- tags:
- Q&A APIs
name: Q&A API