Yandex Cloud
Search
Contact UsTry it for free
  • Customer Stories
  • Documentation
  • Blog
  • All Services
  • System Status
  • Marketplace
    • Featured
    • Infrastructure & Network
    • Data Platform
    • AI for business
    • Security
    • DevOps tools
    • Serverless
    • Monitoring & Resources
  • All Solutions
    • By industry
    • By use case
    • Economics and Pricing
    • Security
    • Technical Support
    • Start testing with double trial credits
    • Cloud credits to scale your IT product
    • Gateway to Russia
    • Cloud for Startups
    • Center for Technologies and Society
    • Yandex Cloud Partner program
    • Price calculator
    • Pricing plans
  • Customer Stories
  • Documentation
  • Blog
© 2026 Direct Cursus Technology L.L.C.
Yandex Search API
  • Getting started
    • All guides
    • Text search in synchronous mode
    • Text search in deferred mode
    • Searching by text description
    • Searching by image
    • Location-based search
    • Mobile search results
    • Getting a list of search regions
  • Access management
  • Pricing policy
  • Audit Trails events
  • Release notes
  1. Step-by-step guides
  2. Getting a list of search regions

Getting a list of codes for all regions

Written by
Yandex Cloud
Updated at February 3, 2026

The GetRegionsTree REST method and gRPC call allow you to get all the codes Yandex uses to denote the search region. A list of the most commonly used countries and regions can be found in Search regions.

This feature is in the Preview stage.

To complete the steps from this example, create a service account with the search-api.webSearch.user role and get an API key with the yc.search-api.execute scope. You can also use an IAM token as a more secure method. Learn more about authentication in Yandex Search API.

REST API
gRPC API

The GetRegionsTree call does not require a key phrase for the search.

Make an HTTP request by specifying the API key or IAM token you got earlier and your service account's folder ID:

  • Authentication with an IAM token:

    curl \
      --request POST \
      --header "Authorization: Bearer <IAM_token>" \
      "https://searchapi.api.cloud.yandex.net/v2/wordstat/getRegionsTree" \
      > regions_tree.json
    
  • Authentication with an API key:

    curl \
      --request POST \
      --header "Authorization: Api-key <API_key>" \
      "https://searchapi.api.cloud.yandex.net/v2/wordstat/getRegionsTree" \
      > regions_tree.json
    

The result will be saved to the regions_tree.json file.

Response fragment
{
  "regions": [
    {
      "id": "225",
      "name": "Russia",
      "children": [
        {
          "id": "1",
          "name": "Moscow and Moscow Oblast",
          "children": [
            { "id": "213", "name": "Moscow" },
            { "id": "1", "name": "Moscow Oblast" }
          ]
        },
        {
          "id": "2",
          "name": "Saint Petersburg and Leningrad Oblast",
          "children": [
            { "id": "2", "name": "Saint Petersburg" }
          ]
        }
      ]
    }
  ]
}

The GetRegionsTree call does not require a key phrase for the search.

Make a gRPC call by specifying the API key or IAM token you got earlier and your service account's folder ID:

  • Authentication with an IAM token:

    grpcurl \
      -rpc-header "Authorization: Bearer <IAM_token>" \
      -d '{"folderId": "<folder_ID>"}' \
      searchapi.api.cloud.yandex.net:443 yandex.cloud.searchapi.v2.WordstatService/GetRegionsTree \
      > regions_tree.json
    
  • Authentication with an API key:

    grpcurl \
      -rpc-header "Authorization: Api-Key <API_key>" \
      -d '{"folderId": "<folder_ID>"}' \
      searchapi.api.cloud.yandex.net:443 yandex.cloud.searchapi.v2.WordstatService/GetRegionsTree \
      > regions_tree.json
    

The result will be saved to the regions_tree.json file.

Response fragment
{
  "regions": [
    {
      "id": "225",
      "name": "Russia",
      "children": [
        {
          "id": "1",
          "name": "Moscow and Moscow Oblast",
          "children": [
            { "id": "213", "name": "Moscow" },
            { "id": "1", "name": "Moscow Oblast" }
          ]
        },
        {
          "id": "2",
          "name": "Saint Petersburg and Leningrad Oblast",
          "children": [
            { "id": "2", "name": "Saint Petersburg" }
          ]
        }
      ]
    }
  ]
}

Was the article helpful?

Previous
Query distribution by regions
Next
Overview
© 2026 Direct Cursus Technology L.L.C.