> ## Documentation Index
> Fetch the complete documentation index at: https://docs.harvestapi.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Search GeoID

> Search LinkedIn Geo ID by location text

<CodeGroup>
  ```javascript JavaScript theme={null}
  fetch(`https://api.harvestapi.io/linkedin/geo-id-search?search=Australia`, {
    headers: { 'X-API-Key': '<api-key>' },
  })
    .then((response) => response.json())
    .then((data) => console.log(data));
  ```

  ```bash cURL theme={null}
  curl --request GET \
    --url https://api.harvestapi.io/linkedin/geo-id-search?search=Australia \
    --header 'X-API-Key: <api-key>'
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.harvestapi.io/linkedin/geo-id-search?search=Australia"

  headers = {"X-API-Key": "<api-key>"}

  response = requests.request("GET", url, headers=headers)

  print(response.text)
  ```
</CodeGroup>

## Search by LinkedIn GeoID

For most of the cases, when specifying full location name, the search by the `location` parameter works fine.\
However sometimes search by location may not give you what you expect, as LinkedIn have some other suggested location for your text query.
For example, `NY` returns `New Zealand` instead of `New York`; `UK` returns `Ukraine` instead of `United Kingdom`.
The location search is based on LinkedIn autocomplete feature, you can try it [on the website](https://www.linkedin.com/search/results/people/?geoUrn=%5B%22103644278%22%5D) first.
The scraper will use the first suggestion from the autocomplete popup when you type your location.

The same autocomplete is available via our API. You can look up a location and get LinkedIn GeoID to use for the API endpoint.

<CodeGroup>
  ```javascript JavaScript theme={null}
  const apiKey = '<api-key>';

  fetch(`https://api.harvestapi.io/linkedin/geo-id-search?search=New York`, {
    headers: { 'X-API-Key': apiKey },
  })
    .then((response) => response.json())
    .then((data) => {
      console.log('All matches:', data.elements);
      console.log('Closest match GeoID:', data.entityId);

      // Search for profiles in New York
      const params = new URLSearchParams({
        geoId: data.entityId,
        apiKey,
      });
      fetch(`https://api.harvestapi.io/linkedin/profile-search?${params.toString()}`)
        .then((response) => response.json())
        .then((data) => console.log(data));
    });
  ```

  ```bash cURL theme={null}
  curl --request GET \
    --url https://api.harvestapi.io/linkedin/geo-id-search?search=New%20York \
    --header 'X-API-Key: <api-key>'
  ```

  ```python Python theme={null}
  import requests

  url = "https://api.harvestapi.io/linkedin/geo-id-search?search=New York"

  headers = {"X-API-Key": "<api-key>"}

  response = requests.request("GET", url, headers=headers)

  data = response.json()
  print("All matches:", data["elements"])
  print("Closest match GeoID:", data["id"])
  ```
</CodeGroup>


## OpenAPI

````yaml GET /linkedin/geo-id-search
openapi: 3.0.1
info:
  title: HarvestAPI LinkedIn API reference
  description: HarvestAPI LinkedIn API reference
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.harvestapi.io
security:
  - ApiKeyAuthHeader: []
paths:
  /linkedin/geo-id-search:
    get:
      summary: Search LinkedIn Geo ID
      description: Search LinkedIn Geo ID by location text
      parameters:
        - name: search
          in: query
          description: Location text to search for Geo ID (required)
          schema:
            type: string
      responses:
        '200':
          description: Geo ID search response
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                  query:
                    type: object
                    properties:
                      search:
                        type: string
                  status:
                    type: string
                  error:
                    type: string
                  elements:
                    type: array
                    items:
                      type: object
                      properties:
                        geoId:
                          type: string
                        title:
                          type: string
        '400':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    Error:
      required:
        - error
        - message
      type: object
      properties:
        error:
          type: integer
          format: int32
        message:
          type: string
  securitySchemes:
    ApiKeyAuthHeader:
      type: apiKey
      in: header
      name: X-API-Key

````