Yandex Cloud
Search
Contact UsGet started
  • Blog
  • Pricing
  • Documentation
  • All Services
  • System Status
    • Featured
    • Infrastructure & Network
    • Data Platform
    • Containers
    • Developer tools
    • Serverless
    • Security
    • Monitoring & Resources
    • ML & AI
    • Business tools
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Customer Stories
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Education and Science
    • Yandex Cloud Partner program
  • Blog
  • Pricing
  • Documentation
© 2025 Direct Cursus Technology L.L.C.
Yandex Search API
    • Overview
        • GET requests
        • POST requests
    • XML response
    • HTML response
    • Generative response
    • Quotas and limits
  • Access management
  • Pricing policy
  • Audit Trails events

In this article:

  • Request format
  • Request parameters
  • Request body format
  • Request body parameters
  • Grouping tag:
  • POST request example
  1. Concepts
  2. API v1
  3. Text search
  4. POST requests

POST requests

Written by
Yandex Cloud
Updated at April 30, 2025
  • Request format
    • Request parameters
  • Request body format
  • Request body parameters
    • Grouping tag:
  • POST request example

With the Yandex Search API API v1, you can run requests with preset parameters to the Yandex search database. You can submit search parameters to the service as an HTTP request using the POST method. Yandex Search API will return a response as an XML or HTML document.

To use the search, when signing up for the service, specify the list of IP addresses you will use to run queries to the service and select the appropriate search type. Based on the selected search type, specify the appropriate domain name in your query:

  • yandex.ru: For the Russian search type
  • yandex.com.tr: For the Turkish search type
  • yandex.com: For the International search type

To run a query, you need a service account with the search-api.executor role and a relevant API key you created.

Request formatRequest format

Warning

If you have any special characters in the parameter values provided in the request body, replace them with the respective escaped sequences based on the XML encoding. For example, use & for ampersand (&).

The URL of your request to Yandex Search API and the list of supported parameters will be different depending on the format you want the result in: XML or HTML.

XML
HTML
https://yandex.<domain>/search/xml
  ? [folderid=<folder_ID>]
  & [filter=<filtering_type>]
  & [lr=<search_region_ID>]
  & [l10n=<notification_language>]
https://yandex.<domain>/search/xml/html
  ? [folderid=<folder_ID>]
  & [filter=<filtering_type>]
  & [lr=<search_region_ID>]

Request parametersRequest parameters

Folder ID and API keyFolder ID and API key

The folderid field contains the folder ID of the service account you will use to send requests. You will need it for user authentication together with the apikey parameter (the service account's API key).

Provide the API key value in the Authorization header in the following format:

Authorization: Api-Key <API_key>

Filtering resultsFiltering results

The filter field contains a rule for filtering search results and determines whether any documents should be excluded from search results. The possible values include:

  • none: Filtering is disabled. Search results include any documents regardless of their contents.
  • moderate: Moderate filter (default value). Documents of the Adult category are excluded from search results unless a query is explicitly made for searching resources of this category.
  • strict: Family filter. Regardless of a search query, documents of the Adult category and those with profanity are excluded from search results.

Search region IDSearch region ID

Only supported for Russian and Turkish search types.

The lr field contains the ID of the search country or region that impacts the document ranking rules. For example, if you set this field to 11316 (Novosibirsk region), the search results will be generated based on the formula specified for the Novosibirsk region.

For a list of frequently used country and region IDs, see Search regions.

Notification languageNotification language

The l10n parameter is not supported when getting the result in HTML format.

The l10n field sets the notification language for the search response and impacts the text provided in the found-docs-human tag and in error messages.

Possible values depend on the selected search type.

Russian search type (yandex.ru):

  • ru: Russian (default)
  • uk: Ukrainian
  • be: Belarusian
  • kk: Kazakh

Turkish search type (yandex.com.tr): Only the tr value (Turkish) is supported.

International search type (yandex.com): Only the en value (English) is supported.

Request body formatRequest body format

Note

The list of supported request parameters depends on the required output format, XML or HTML.

<?xml version="1.0" encoding="<XML_file_encoding>"?>
<request>
<!--Grouping tag-->
  <query>
     <!--Search query text-->
  </query>
  <sortby order="<!--Sorting order of documents-->">
     <!--Search result sorting type-->
  </sortby>
  <groupings>
    <!--Grouping parameters in child tags-->
    <groupby attr="d" mode="deep" groups-on-page="10" docs-in-group="1" />
  </groupings>
  <maxpassages>
    <!--Maximum number of passages-->
  </maxpassages>
  <page>
    <!--Number of the requested search results page-->
  </page>
</request>

Request body parametersRequest body parameters

Grouping tag:Grouping tag:

The <request> grouping tag integrates all contents of the request body. Child tags contain search query parameters.

QueryQuery

Search query text is provided in the query field. Search queries are handled based on the Yandex query language specifics. Use the appropriate escaped sequences instead of special characters.

The maximum length of a query is 40 words and 400 characters.

Sorting resultsSorting results

The sortby parameter is not supported when getting the result in HTML format.

The sortby field contains the sorting rule for how the search results must be sorted. The possible values are:

  • rlv: By relevance (default).
  • tm: By document update time.

When sorting by update time, the parameter may contain the order attribute for document sorting order:

  • descending: Direct order, i.e., from most recent to oldest (default).
  • ascending: Reverse order, i.e., from oldest to most recent.

Maximum number of passagesMaximum number of passages

The maxpassages parameter is not supported when getting the result in HTML format.

A passage is a fragment of found document that contains words from a search query. Passages are used to generate snippets that are text annotations to found documents.

The maxpassages field sets the maximum number of passages that can be used when generating a document snippet.

The possible values range from 1 to 5. A search result may contain fewer passages than specified by this parameter. By default, a maximum of four passages with search query text is returned per document.

Requested page numberRequested page number

The page field contains the number of a requested page with search results. The number defines a range of positions of documents returned in response. Page numbering starts from zero (the 0 value stands for page 1).

For example, if the number of documents returned on a page is n and the provided parameter is set to p, the search results will include documents within the result position range from p*n+1 to p*n+n, inclusive.

By default, the first page with search results is returned.

Grouping tag:Grouping tag:

The groupings grouping tag integrates the result grouping parameters.

Groupby result groupingGroupby result grouping

The groupby parameter is not supported when getting the result in HTML format.

The groupby parameter consolidates rules for grouping results. Grouping is used to group documents from a single domain into a container. Within the container, the documents are ranked by the sorting rules defined in the sortby field. The results provided in the container can be used to include multiple documents from the same domain in search results.

Possible groupby parameters:

  • mode: Grouping method. The possible values are:
    • flat: Flat grouping. Each group contains a single document. Provided with an empty value for the attr parameter.
    • deep: Grouping by domain. Each group contains documents from one domain. Provided with the attr parameter set to d.
      If the parameter is not set, grouping by domain is used.
  • attr: Service attribute. It depends on the mode attribute value.
  • groups-on-page: Maximum number of groups that can be returned per search results page. The values range from 1 to 100.
  • docs-in-group: Maximum number of documents that can be returned per group. The values range from 1 to 3.

POST request examplePOST request example

The URL and request body presented below return the fifth page of search results for the <table> query. The results are sorted by the document editing time, from the newest to the oldest. The search type is Russian (yandex.ru). Search region: Novosibirsk Oblast. The Family search filter is applied to the search results. The results are grouped by domain. Each group contains three documents, and the number of groups returned per page is 10. The maximum number of passages per document is 2. Yandex Search API returns a UTF-8 encoded XML file.

The URL of your request to Yandex Search API and the list of supported parameters will be different depending on the format you want the result in: XML or HTML.

XML
HTML
https://yandex.ru/search/xml?folderid=b1gt6g8ht345********&filter=strict&lr=11316&l10n=ru
https://yandex.ru/search/xml/html?folderid=b1gt6g8ht345********&filter=strict&lr=11316

Request body:

<?xml version="1.0" encoding="UTF-8"?>
<request>
  <query><table></query>
  <sortby order="descending">tm</sortby>
  <maxpassages>2</maxpassages>
  <page>4</page>
  <groupings>
    <groupby attr="d" mode="deep" groups-on-page="10" docs-in-group="3" />
  </groupings>
</request>

See alsoSee also

  • XML format of response to a text search query
  • HTML format of response to a text search query
  • Running search queries via API v1

Was the article helpful?

Previous
GET requests
Next
GET requests
© 2025 Direct Cursus Technology L.L.C.