Download OpenAPI specification:Download
The front office is typically used within front-end apps, for example a website or a mobile application. With this API, you can handle interactions with documents and search for personalized documents.
All the request bodies in this API are JSON encoded and their content-type
header should be set to application/json
.
Most methods require a user_id
.
From our perspective, a user_id
is simply required to group interactions together. We don't need to know who that user is, so it is preferred to create this user_id
in a privacy-preserving way.
For example, create a hash method which transforms your user into an ID hash.
The search and recommendation API, at a high level, returns a list of documents, with each entry having a score, the document id and potentially other data that is provided during ingestion.
In practice, our systems provide searches and recommendations based on an internal representation we call "snippet",
as it's derived from a snippet of processed text. Since a document can have multiple snippets associated with it, each document in the result contains a snippet id, which consists of the document id and a sub_id
which specifies which snippet exactly this result is based on. The getting started documentation provides more details about this.
The document id is a string which always refers to the document as a whole, no matter how many snippets it has.
The snippet id is a struct containing a document_id
field and a sub_id
field, it refers to a
a specific snippet that belongs to the document document_id
.
We recommend using the snippet id where possible. For example, if you want to register an interaction or do a similarity search based on the previous results you should use the full returned snippet id, not just the document id.
Finds a number of recommendations for the given user_id
.
Recommendations are based on snippets and each recommendation contains the snippet id it is based on as well as a score. A higher score means that the document matches the preferences of the user better. Scores can be compared only with other scores that belong to the same request; comparing scores of documents that have been obtained through different requests can lead to unexpected results.
Depending on the request parameters the recommendation can also include additional fields.
The recommendations also contain the properties of the snippets parent document if this is requested and the properties are not empty.
Documents that have been interacted with by the user are filtered out from the result.
Note that you can request personalized documents for a specific user_id
, only after that same user_id
has made enough interactions via our system.
user_id required | string (Id) [ 1 .. 256 ] characters ^[a-zA-Z0-9\-:@.][a-zA-Z0-9\-:@._]*$ Example: id1 An id can be any non-empty string that consist of arabic digits, latin letters, hyphens, colons, @s, dots or underscores (except as the first character). The length constraints are in bytes, not characters. |
count | integer <int32> (Count) [ 1 .. 100 ] Maximum number of documents to return. | ||||||||||||||||||||||||||
published_after | string <date-time> (PublishedAfter) [ 10 .. 40 ] characters Deprecated Deprecated. Use a | ||||||||||||||||||||||||||
include_properties | boolean (IncludeProperties) Default: {"$ref":"#/components/schemas/IncludeProperties/default"} Include the properties of each document in the response. | ||||||||||||||||||||||||||
include_snippet | boolean (IncludeSnippet) Default: {"$ref":"#/components/schemas/IncludeSnippet/default"} Includes the snippets text for each search result. | ||||||||||||||||||||||||||
FilterCompare (object) or FilterCombine (object) or FilterIds (object) Filter the documents wrt their properties. Comparison:
A key must be a valid Combination: Combinators may only be nested two times. Ids:
Works like the Be aware that | |||||||||||||||||||||||||||
One of = 1 properties
|
{- "count": 10,
- "published_after": "2019-08-24T14:15:22Z",
- "include_properties": true,
- "include_snippet": true,
- "filter": {
- "document property id1": {
- "$eq": true,
- "$in": [ ],
- "$gt": 0,
- "$gte": 0,
- "$lt": 0,
- "$lte": 0
}, - "document property id2": {
- "$eq": true,
- "$in": [ ],
- "$gt": 0,
- "$gte": 0,
- "$lt": 0,
- "$lte": 0
}
}
}
{- "documents": [
- {
- "id": "document_id0",
- "snippet_id": {
- "document_id": "document_id0",
- "sub_id": 2
}, - "score": 0.87,
- "properties": {
- "title": "News title"
}
}
]
}
Use /users/{user_id}/recommendations
instead.
Get a list of snippets personalized for the given user_id
.
Each snippet has an id and contains the id of the document it originates from as well as a score. A higher score means that the document matches the preferences of the user better. Scores can be compared only with other scores that belong to the same request; comparing scores of documents that have been obtained through different requests can lead to unexpected results.
The snippet also contain the parent documents properties if this is requested and the properties are not empty.
Documents that have been interacted with by the user are filtered out from the result.
Note that you can request personalized documents for a specific user_id
, only after that same user_id
has made enough interactions via our system.
user_id required | string (Id) [ 1 .. 256 ] characters ^[a-zA-Z0-9\-:@.][a-zA-Z0-9\-:@._]*$ Example: id1 An id can be any non-empty string that consist of arabic digits, latin letters, hyphens, colons, @s, dots or underscores (except as the first character). The length constraints are in bytes, not characters. |
count | integer <int32> (Count) [ 1 .. 100 ] Maximum number of documents to return. | ||||||||||||||||||||||||||
published_after | string <date-time> (PublishedAfter) [ 10 .. 40 ] characters Deprecated Deprecated. Use a | ||||||||||||||||||||||||||
include_properties | boolean (IncludeProperties) Default: {"$ref":"#/components/schemas/IncludeProperties/default"} Include the properties of each document in the response. | ||||||||||||||||||||||||||
include_snippet | boolean (IncludeSnippet) Default: {"$ref":"#/components/schemas/IncludeSnippet/default"} Includes the snippets text for each search result. | ||||||||||||||||||||||||||
FilterCompare (object) or FilterCombine (object) or FilterIds (object) Filter the documents wrt their properties. Comparison:
A key must be a valid Combination: Combinators may only be nested two times. Ids:
Works like the Be aware that | |||||||||||||||||||||||||||
One of = 1 properties
|
{- "count": 10,
- "published_after": "2019-08-24T14:15:22Z",
- "include_properties": true,
- "include_snippet": true,
- "filter": {
- "document property id1": {
- "$eq": true,
- "$in": [ ],
- "$gt": 0,
- "$gte": 0,
- "$lt": 0,
- "$lte": 0
}, - "document property id2": {
- "$eq": true,
- "$in": [ ],
- "$gt": 0,
- "$gte": 0,
- "$lt": 0,
- "$lte": 0
}
}
}
{- "documents": [
- {
- "id": "document_id0",
- "snippet_id": {
- "document_id": "document_id0",
- "sub_id": 2
}, - "score": 0.87,
- "properties": {
- "title": "News title"
}
}
]
}
Deprecated. Use POST /users/{user_id}/personalized_documents
instead.
user_id required | string (Id) [ 1 .. 256 ] characters ^[a-zA-Z0-9\-:@.][a-zA-Z0-9\-:@._]*$ Example: id1 An id can be any non-empty string that consist of arabic digits, latin letters, hyphens, colons, @s, dots or underscores (except as the first character). The length constraints are in bytes, not characters. |
count | integer <int32> (Count) [ 1 .. 100 ] Default: 10 Maximum number of documents to return. |
published_after | string <date-time> (PublishedAfter) [ 10 .. 40 ] characters Deprecated Deprecated. Use a |
include_properties | boolean (IncludeProperties) Include the properties of each document in the response. |
include_snippet | boolean (IncludeSnippet) Includes the snippets text for each search result. |
FilterCompare (object) or FilterCombine (object) or FilterIds (object) (Filter) Filter the documents wrt their properties. Comparison:
A key must be a valid Combination: Combinators may only be nested two times. Ids:
Works like the Be aware that |
{- "documents": [
- {
- "id": "document_id0",
- "snippet_id": {
- "document_id": "document_id0",
- "sub_id": 2
}, - "score": 0.87,
- "properties": {
- "title": "News title"
}
}
]
}
Finds a number of recommendations for the given user_id
or a history.
Recommendations are based on snippets and each recommendation contains the snippet id it is based on as well as a score. A higher score means that the document matches the preferences of the user or the history better. Scores can be compared only with other scores that belong to the same request; comparing scores of documents that have been obtained through different requests can lead to unexpected results.
Depending on the request parameters the recommendation can also include additional fields.
The recommendations also contain the properties of the snippets parent document if this is requested and the properties are not empty.
By default documents that have been interacted with by the user or are listed in the history are filtered out from the result. This behavior can be changed with exclude_seen
.
Note that you can request personalized documents for a specific user_id
, only after that same user_id
has made enough interactions via our system.
Histories are not stored in the system.
count | integer <int32> (Count) [ 1 .. 100 ] Maximum number of documents to return. | ||||||||||||||||||||||||||
published_after | string <date-time> (PublishedAfter) [ 10 .. 40 ] characters Deprecated Deprecated. Use a | ||||||||||||||||||||||||||
include_properties | boolean (IncludeProperties) Default: {"$ref":"#/components/schemas/IncludeProperties/default"} Include the properties of each document in the response. | ||||||||||||||||||||||||||
include_snippet | boolean (IncludeSnippet) Default: {"$ref":"#/components/schemas/IncludeSnippet/default"} Includes the snippets text for each search result. | ||||||||||||||||||||||||||
required | object Personalize the ranking of candidates based on a users preferences. | ||||||||||||||||||||||||||
| |||||||||||||||||||||||||||
FilterCompare (object) or FilterCombine (object) or FilterIds (object) Filter the documents wrt their properties. Comparison:
A key must be a valid Combination: Combinators may only be nested two times. Ids:
Works like the Be aware that | |||||||||||||||||||||||||||
One of = 1 properties
|
{- "count": 10,
- "published_after": "2019-08-24T14:15:22Z",
- "include_properties": true,
- "include_snippet": true,
- "personalize": {
- "exclude_seen": true,
- "user": {
- "id": "id1",
- "history": [
- {
- "id": "id1",
- "timestamp": "2000-05-14T20:22:50Z"
}
]
}
}, - "filter": {
- "document property id1": {
- "$eq": true,
- "$in": [ ],
- "$gt": 0,
- "$gte": 0,
- "$lt": 0,
- "$lte": 0
}, - "document property id2": {
- "$eq": true,
- "$in": [ ],
- "$gt": 0,
- "$gte": 0,
- "$lt": 0,
- "$lte": 0
}
}
}
{- "documents": [
- {
- "id": "document_id0",
- "snippet_id": {
- "document_id": "document_id0",
- "sub_id": 2
}, - "score": 0.87,
- "properties": {
- "title": "News title"
}
}
]
}
Register an interaction between a user and a snippet or a whole document.
For web sites, consider triggering this method whenever a certain document url loads, preferably after the user spent some time on the page, in order to prevent false positives. For apps, consider implementing a "like" button, where the on-click triggers this method.
Please remember that it is recommended to register a reaction with the specific snippet the user interacted with instead of the document as a whole. You can do so by providing snippet ids instead of document ids.
user_id required | string (Id) [ 1 .. 256 ] characters ^[a-zA-Z0-9\-:@.][a-zA-Z0-9\-:@._]*$ Example: id1 An id can be any non-empty string that consist of arabic digits, latin letters, hyphens, colons, @s, dots or underscores (except as the first character). The length constraints are in bytes, not characters. |
required | Array of objects (UserInteractionData) [ 1 .. 1000 ] items | ||||
Array ([ 1 .. 1000 ] items)
|
{- "documents": [
- {
- "id": "id1"
}
]
}
{- "request_id": "string",
- "kind": "InvalidUserId",
- "details": { }
}
Semantically search through the documents in different ways.
When a snippet id is used, the system will return snippets across all documents, that are similar to the one referred to by the given id.
When a document id is used it will currently search as if you had provided the snippet id of an arbitrary snippet in the document. This means it's for now only meaningful usable with documents which only have one snippet. That will likely change in the future.
When a query
is provided, the system will return documents that are similar to the query.
If enable_hybrid_search
is passed, then the system will also perform keyword matching between the query and the documents.
It is possible to personalize the result by passing a user id or history. In this case, the system will consider the user's interests to rank the documents.
Each document contains the id
and the score
, where a higher value means that the document is more similar to the input. Scores can be compared only with other scores that belong to the same request; comparing scores of documents that have been obtained through different requests can lead to unexpected results.
The documents also contain their properties
if this is requested and the properties are not empty.
required | object (InputDocument) = 1 properties Information about a document provided as input for an search. You can either include an existing document | ||||||||||||||||||||||||||
| |||||||||||||||||||||||||||
count | integer <int32> (Count) [ 1 .. 100 ] Maximum number of documents to return. | ||||||||||||||||||||||||||
published_after | string <date-time> (PublishedAfter) [ 10 .. 40 ] characters Deprecated Deprecated. Use a | ||||||||||||||||||||||||||
include_properties | boolean (IncludeProperties) Default: {"$ref":"#/components/schemas/IncludeProperties/default"} Include the properties of each document in the response. | ||||||||||||||||||||||||||
include_snippet | boolean (IncludeSnippet) Default: {"$ref":"#/components/schemas/IncludeSnippet/default"} Includes the snippets text for each search result. | ||||||||||||||||||||||||||
object Personalize the ranking of candidates based on a users preferences. | |||||||||||||||||||||||||||
| |||||||||||||||||||||||||||
enable_hybrid_search | boolean Default: false Enable the hybrid search mode. | ||||||||||||||||||||||||||
FilterCompare (object) or FilterCombine (object) or FilterIds (object) Filter the documents wrt their properties. Comparison:
A key must be a valid Combination: Combinators may only be nested two times. Ids:
Works like the Be aware that | |||||||||||||||||||||||||||
One of = 1 properties
|
{- "document": {
- "id": "id1",
- "query": "string"
}, - "count": 10,
- "published_after": "2019-08-24T14:15:22Z",
- "include_properties": true,
- "include_snippet": true,
- "personalize": {
- "exclude_seen": true,
- "user": {
- "id": "id1",
- "history": [
- {
- "id": "id1",
- "timestamp": "2000-05-14T20:22:50Z"
}
]
}
}, - "enable_hybrid_search": false,
- "filter": {
- "document property id1": {
- "$eq": true,
- "$in": [ ],
- "$gt": 0,
- "$gte": 0,
- "$lt": 0,
- "$lte": 0
}, - "document property id2": {
- "$eq": true,
- "$in": [ ],
- "$gt": 0,
- "$gte": 0,
- "$lt": 0,
- "$lte": 0
}
}
}
{- "documents": [
- {
- "id": "document_id0",
- "snippet_id": {
- "document_id": "document_id0",
- "sub_id": 2
}, - "score": 0.87,
- "properties": {
- "title": "News title"
}
}
]
}