Skip to the content
EnrichedNowDocs

    Type to search every page.

    Menu

    Scraper API2GIS

    twogis.search

    The places on a page of 2GIS's search results for a query in a city: address, pin, categories, rating, attributes and hours.

    Id
    twogis.search
    Version
    1
    Billed per
    request — 1 unit for a charged run
    Runs
    within one request

    Start it with POST /v1/scrapers/twogis.search/runs. How runs work is in Running a scraper; what a run costs is in Usage and units.

    Inputs

    The fields of input. A field that is not listed here is refused.

    Inputs of twogis.search
    FieldTypeDescription
    queryrequiredstringWhat to search for: a kind of place (coffee, аптека), a name or an address.Limit: at least 1 characters, at most 200 characters.
    cityrequiredstringThe city to search in, as 2GIS names it in its page addresses: moscow, spb, novosibirsk, almaty, dubai.Limit: at least 2 characters, at most 61 characters.
    pageintegerThe results page, from 1. A page holds up to 12 places.Limit: 1 to 1000. Default: 1.
    max_resultsintegerReturn at most this many places of the page; all of them when not given.Limit: 1 to 12.
    • city is the name 2GIS files a city under in its page addresses: moscow, spb, novosibirsk, almaty, dubai. A name it does not have ends failed with unknown_city.
    • One run reads one page, up to 12 places, in the order 2GIS shows them. A search nothing matches, and a page past the last one, end ok with zero records.
    • Names, addresses and categories are in the language of the city's own 2GIS site: Russian for most cities, English for the Emirates.
    • type is branch for an organisation's branch. A search for an address or a landmark also returns records of type building, street, station and the like.
    • A card has no contacts. Pass a record's place_id to twogis.place for the telephone numbers and websites.

    Record fields

    Every record of a run has these fields. A value that is not known is null — never an empty string and never 0.

    Record fields of twogis.search
    FieldTypeNotes
    place_idstring2GIS's id of the place.
    typestringWhat the place is: branch for an organisation's branch, or building, street, adm_div (a district or a town), station, attraction and the like.
    namestringThe name as the page writes it, e.g. Orto, cafe.
    short_namestring or nullThe name without what follows the comma, e.g. Orto.
    descriptionstring or nullWhat the name is followed by, e.g. cafe.
    urlstringThe place's page on 2GIS.
    addressstring or nullThe street address, e.g. 395, Jumeirah road.
    address_commentstring or nullWhat the page adds to the address, e.g. the floor or the office.
    building_namestring or nullThe name of the building the place is in, when the page gives one.
    postal_codestring or nullThe postal code.
    districtstring or nullThe district of the city.
    citystring or nullThe city or town.
    regionstring or nullThe region the city is in.
    countrystring or nullThe country, in the page's language.
    latitudenumber or nullThe latitude of the place's pin, in decimal degrees.
    longitudenumber or nullThe longitude of that pin.
    categoriesarray of stringThe categories 2GIS lists the place in, the main one first.
    ratingnumber or nullThe average rating, 1 to 5. Null for a place nobody has rated.
    rating_countinteger or nullHow many ratings the average is of.
    review_countinteger or nullHow many of those ratings come with a written review.
    attributesarray of stringWhat the page lists the place as offering or having, e.g. Wi-Fi, Average bill 40 AED.
    hoursarray of objectThe opening hours, a row per day and period. Empty when the page lists none.
    day (in hours[])stringThe day of the week: Mon, Tue, Wed, Thu, Fri, Sat or Sun.
    opens (in hours[])stringWhen the place opens, HH:MM in its own time.
    closes (in hours[])stringWhen it closes, HH:MM; earlier than opens when it closes after midnight, 24:00 at midnight.
    open_24_7boolean or nullTrue when the page says the place is open around the clock.
    utc_offset_minutesinteger or nullThe place's time zone as minutes ahead of UTC.
    organization_idstring or null2GIS's id of the organisation the branch belongs to.
    branch_countinteger or nullHow many branches that organisation has on 2GIS.
    photo_countinteger or nullHow many photos the page has of the place.
    imagestring or nullThe place's main photo.
    promotedboolean or nullTrue when the place is shown as an advertiser.
    removedbooleanTrue when 2GIS says the place was removed from its directory: it may have closed for good or for a while.Default: false.
    positionintegerThe place's position on the results page, from 1.
    pageintegerThe results page it was on.
    fetched_atstring (date-time)When the page was read, in UTC.

    Example request

    # Start a run and wait up to 60 seconds for it to finish
    curl -X POST "https://api.enrichednow.com/v1/scrapers/twogis.search/runs?wait=60" \
      -H "Authorization: Bearer $ENRICHEDNOW_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{"input":{"query":"coffee","city":"dubai"}}'
    
    # Read its records, with the id the first call answered
    curl "https://api.enrichednow.com/v1/runs/$RUN_ID/records?limit=100" \
      -H "Authorization: Bearer $ENRICHEDNOW_API_KEY"
    from enrichednow import EnrichedNow
    
    client = EnrichedNow()  # reads ENRICHEDNOW_API_KEY
    
    # Start a run, wait for it to end, and get its records
    result = client.scrape("twogis.search", {"query": "coffee", "city": "dubai"})
    print(result.run.id, result.run.status, result.run.record_count)
    
    # Read its records: pages are fetched as you go
    for record in result.records:
        print(record)

    Install it with pip install enrichednow, then save as run.py and run python3 run.py

    import EnrichedNow from "enrichednow";
    
    const client = new EnrichedNow(); // reads ENRICHEDNOW_API_KEY
    
    // Start a run, wait for it to end, and get its records
    const { run, records } = await client.scrape("twogis.search", { query: "coffee", city: "dubai" });
    console.log(run.id, run.status, run.record_count);
    
    // Read its records: pages are fetched as you go
    for await (const record of records) console.log(record);

    Install it with npm install enrichednow, then save as run.mjs and run node run.mjs

    package main
    
    import (
    	"context"
    	"fmt"
    	"log"
    	"time"
    
    	enrichednow "github.com/enrichednow/enrichednow-go"
    )
    
    func main() {
    	client, err := enrichednow.NewClient() // reads ENRICHEDNOW_API_KEY
    	if err != nil {
    		log.Fatal(err)
    	}
    	ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute)
    	defer cancel()
    
    	// Start a run, wait for it to end, and get its records
    	run, records, err := client.Scrape(ctx, "twogis.search", map[string]any{"query": "coffee", "city": "dubai"})
    	if err != nil {
    		log.Fatal(err)
    	}
    	fmt.Println(run.ID, run.Status, run.RecordCount)
    
    	// Read its records: pages are fetched as you go
    	for records.Next() {
    		fmt.Println(string(records.Current()))
    	}
    	if err := records.Err(); err != nil {
    		log.Fatal(err)
    	}
    }

    Install it with go get github.com/enrichednow/enrichednow-go@latest, then save as run.go and run go run run.go

    import com.enrichednow.EnrichedNowClient;
    import com.enrichednow.ScrapeResult;
    import java.util.Map;
    
    public class Run {
        public static void main(String[] args) {
            EnrichedNowClient client = EnrichedNowClient.fromEnv(); // reads ENRICHEDNOW_API_KEY
    
            // Start a run, wait for it to end, and get its records
            ScrapeResult result = client.scrape("twogis.search", Map.of("query", "coffee", "city", "dubai"));
            System.out.println(result.run().id() + " " + result.run().status() + " " + result.run().recordCount());
    
            // Read its records: pages are fetched as you go
            for (Map<String, Object> record : result.records()) {
                System.out.println(record);
            }
        }
    }

    Add com.enrichednow:enrichednow-java:0.4.0 to your Maven or Gradle build, then save as Run.java

    enrichednow run twogis.search --input query=coffee --input city=dubai

    Install it with curl -fsSL https://raw.githubusercontent.com/enrichednow/enrichednow-cli/main/install.sh | sh

    It starts a run with this scraper’s example input, waits for it to finish and reads its records a page at a time. The key is read from ENRICHEDNOW_API_KEY.

    The body on its own:

    JSON
    {
      "input": {
        "query": "coffee",
        "city": "dubai"
      }
    }

    Example response

    The run, once it has ended. A run that has not ended within wait comes back with 202 and the status queued or running.

    JSON
    {
      "id": "run_841742f37553189ff9c27ba1",
      "scraper_id": "twogis.search",
      "scraper_version": 1,
      "status": "ok",
      "reason": null,
      "input": {
        "query": "coffee",
        "city": "dubai"
      },
      "record_count": 1,
      "units": 1,
      "units_per_request": 1,
      "units_per_record": null,
      "units_per_page": null,
      "diagnostics": {
        "requests": 1,
        "bytes": 259214,
        "wall_ms": 885,
        "facts": {}
      },
      "created_at": "2026-11-16T22:37:50.170950Z",
      "started_at": "2026-11-16T22:37:50.178331Z",
      "finished_at": "2026-11-16T22:37:51.066313Z"
    }

    Its records, from GET /v1/runs/{id}/records. The record is a real one: this scraper's own parser read it from a page recorded from the site.

    JSON
    {
      "records": [
        {
          "place_id": "70000001035714425",
          "type": "branch",
          "name": "Starbucks, coffee shop",
          "short_name": "Starbucks",
          "description": "coffee shop",
          "url": "https://2gis.ru/dubai/firm/70000001035714425",
          "address": "Al Bayt 4, 19, Al Seef road",
          "address_comment": "G Floor",
          "building_name": "Al Bayt 4",
          "postal_code": null,
          "district": "Al Hamriya",
          "city": "Dubai",
          "region": "Dubai Emirate",
          "country": "UAE",
          "latitude": 25.26464,
          "longitude": 55.303865,
          "categories": [
            "Coffee shop"
          ],
          "rating": 4.8,
          "rating_count": 76,
          "review_count": 22,
          "attributes": [
            "Average bill 30 AED",
            "Breakfast menu",
            "Outdoor sitting area"
          ],
          "hours": [
            {
              "day": "Mon",
              "opens": "08:00",
              "closes": "24:00"
            },
            {
              "day": "Tue",
              "opens": "08:00",
              "closes": "24:00"
            }
          ],
          "open_24_7": null,
          "utc_offset_minutes": 240,
          "organization_id": "70000001033047305",
          "branch_count": 309,
          "photo_count": 62,
          "image": "https://i6.photo.2gis.com/main/branch/99/70000001035714425/common",
          "promoted": false,
          "removed": false,
          "position": 1,
          "page": 1,
          "fetched_at": "2026-11-19T18:07:41.636733Z"
        }
      ],
      "next_cursor": null
    }

    What was done to the record for this page, and nothing else — the API returns every value whole. A text that was cut ends with … [truncated].

    • Shortened: attributes: 10 items, the first 3 shown.
    • Shortened: hours: 7 items, the first 2 shown.

    A run does not always end ok. Results and statuses lists every status and the reasons every scraper shares; the reasons of the 2GIS scrapers are in their own section there.