Web Search API, REST: GenSearch.Search
HTTP request
POST https://searchapi.api.cloud.yandex.net/v2/gen/search
Body parameters
{
"messages": [
{
"content": "string",
"role": "string"
}
],
"folderId": "string",
// Includes only one of the fields `site`, `host`, `url`
"site": {
"site": [
"string"
]
},
"host": {
"host": [
"string"
]
},
"url": {
"url": [
"string"
]
},
// end of the list of possible fields
"fixMisspell": "boolean",
"enableNrfmDocs": "boolean",
"searchFilters": [
{
// Includes only one of the fields `date`, `lang`, `format`
"date": "string",
"lang": "string",
"format": "string"
// end of the list of possible fields
}
],
"searchType": "string",
"getPartialResults": "boolean",
"metadata": {
"fields": "object"
}
}
|
Field |
Description |
|
messages[] |
Single search query or a search query with context in the form of chat with the model. |
|
folderId |
string Required field. ID of the folder. |
|
site |
Includes only one of the fields Restricts the search to the specific websites, hosts or pages. |
|
host |
Includes only one of the fields Restricts the search to the specific websites, hosts or pages. |
|
url |
Includes only one of the fields Restricts the search to the specific websites, hosts or pages. |
|
fixMisspell |
boolean Fix query misspells. |
|
enableNrfmDocs |
boolean Use the documents inaccessible from the site's front page. |
|
searchFilters[] |
Restricts the search by date, document formats or language. |
|
searchType |
enum (SearchType) Search type that determines the domain name that will be used for the search queries.
|
|
getPartialResults |
boolean Get partial results |
|
metadata |
Search flags |
GenSearchMessage
|
Field |
Description |
|
content |
string Required field. Text of user query or the model's response (depending on the role value). |
|
role |
enum (Role) Required field. Message sender's role
|
SiteOption
|
Field |
Description |
|
site[] |
string Restricts the search to the specific websites. |
HostOption
|
Field |
Description |
|
host[] |
string Restricts the search to the specific hosts. |
UrlOption
|
Field |
Description |
|
url[] |
string Restricts the search to the specific pages. |
SearchFilter
|
Field |
Description |
|
date |
string Restrict by document date. See https://yandex.ru/support/search/ru/query-language/search-operators details. Includes only one of the fields |
|
lang |
string Restrict by document language. Use ISO 639-1 language codes. Includes only one of the fields |
|
format |
enum (DocFormat) Restrict by document format. Includes only one of the fields
|
SearchMetadata
|
Field |
Description |
|
fields |
object (map<string, string>) Search flags, |
Response
HTTP Code: 200 - OK
{
"message": {
"content": "string",
"role": "string"
},
"sources": [
{
"url": "string",
"title": "string",
"used": "boolean"
}
],
"searchQueries": [
{
"text": "string",
"reqId": "string"
}
],
"fixedMisspellQuery": "string",
"isAnswerRejected": "boolean",
"isBulletAnswer": "boolean",
"hints": [
"string"
],
"problematicAnswer": "boolean"
}
|
Field |
Description |
|
message |
The text of the generative response. |
|
sources[] |
The documents used to form the generative response. |
|
searchQueries[] |
The search queries, refined by the YandexGPT model and used for the generative response. |
|
fixedMisspellQuery |
string The text of the search query with fixed misspells. |
|
isAnswerRejected |
boolean The model failed to answer due to the ethical concerns. |
|
isBulletAnswer |
boolean A bullet answer in case the model cannot give a proper response and returns a set of bullets with various data. |
|
hints[] |
string Search hints |
|
problematicAnswer |
boolean The answer may contain inappropriate content |
GenSearchMessage
|
Field |
Description |
|
content |
string Required field. Text of user query or the model's response (depending on the role value). |
|
role |
enum (Role) Required field. Message sender's role
|
Source
|
Field |
Description |
|
url |
string Document URL. |
|
title |
string Document title. |
|
used |
boolean The document was used in the answer. |
SearchQuery
|
Field |
Description |
|
text |
string Query text. |
|
reqId |
string Query ID in Yandex Search. |