> ## 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 Profiles

> Search LinkedIn profiles by name, company, location, and more

### This is basic profile search scraper endpoint, [please check this information before using it](/guides/profile-search).

* Please note that this is not the same API as used in [the Apify Actor](https://apify.com/harvestapi/linkedin-profile-search).

## Examples

* Search by name (fuzzy) and location:

<CodeGroup>
  ```javascript JavaScript theme={null}
  const params = new URLSearchParams({
    search: 'Mark',
    currentCompany: 'https://www.linkedin.com/company/google',
    location: 'Australia',
    page: '1',
  });
  fetch(`https://api.harvestapi.io/linkedin/profile-search?${params.toString()}`, {
    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/profile-search?search=Mark&companyId=1441&location=Australia&page=1 \
    --header 'X-API-Key: <api-key>'
  ```

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

  url = "https://api.harvestapi.io/linkedin/profile-search?search=Mark&companyId=1441&location=Australia&page=1"

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

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

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

* Search by name strict:

```javascript JavaScript theme={null}
const params = new URLSearchParams({
  search: 'Mark Peterson',
  firstName: 'Mark',
  lastName: 'Peterson',
});
fetch(`https://api.harvestapi.io/linkedin/profile-search?${params.toString()}`, {
  headers: { 'X-API-Key': '<api-key>' },
})
  .then((response) => response.json())
  .then((data) => console.log(data));
```

## 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/profile-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/profile-search:
    get:
      summary: Search LinkedIn profiles
      description: Search LinkedIn profiles by name, company, location, and more
      parameters:
        - name: search
          in: query
          description: Search profiles by name
          schema:
            type: string
            format: url
        - name: currentCompany
          in: query
          required: false
          description: >-
            Filter by company ID or Company URL. One value or multiple
            comma-separated
          schema:
            type: string
        - name: pastCompany
          in: query
          required: false
          description: >-
            Filter by past company ID or Company URL. One value or multiple
            comma-separated
          schema:
            type: string
        - name: school
          in: query
          required: false
          description: >-
            Filter by school ID or School URL. One value or multiple
            comma-separated
          schema:
            type: string
        - name: firstName
          in: query
          description: Filter by first name
          schema:
            type: string
        - name: lastName
          in: query
          description: Filter by last name
          schema:
            type: string
        - name: title
          in: query
          description: Filter by title
          schema:
            type: string
        - name: location
          in: query
          description: Filter by location text
          schema:
            type: string
        - name: geoId
          in: query
          description: >-
            Filter by location as LinkedIn Geo ID. Overrides the location query
            param. Use the /linkedin/geo-id-search endpoint to find the Geo ID
          schema:
            type: string
        - name: industryId
          in: query
          description: Filter by industry ID. One value or multiple comma-separated
          schema:
            type: string
        - name: keywordsCompany
          in: query
          description: Filter by keywords in company name
          schema:
            type: string
        - name: keywordsSchool
          in: query
          description: Filter by keywords in school name
          schema:
            type: string
        - name: followerOf
          in: query
          required: false
          description: >-
            Filter profiles that are followers of a LinkedIn profile. Provide
            the profile URL or ID. One value or multiple comma-separated
          schema:
            type: string
        - name: page
          in: query
          description: Page number, use for pagination
          schema:
            type: string
      responses:
        '200':
          description: Profile search response
          content:
            application/json:
              schema:
                type: object
                properties:
                  elements:
                    type: array
                    items:
                      $ref: '#/components/schemas/ProfileShort'
                  pagination:
                    $ref: '#/components/schemas/Pagination'
                    type: object
                  status:
                    type: string
                  error:
                    type: string
                  query:
                    type: object
                    properties:
                      search:
                        type: string
                      companyId:
                        type: string
                      location:
                        type: string
                      geoId:
                        type: string
                      page:
                        type: string
        '400':
          description: Unexpected error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  schemas:
    ProfileShort:
      required:
        - publicIdentifier
      type: object
      properties:
        id:
          type: string
        publicIdentifier:
          type: string
        name:
          type: string
        position:
          type: string
        location:
          type: object
          properties:
            linkedinText:
              type: string
        linkedinUrl:
          type: string
        photo:
          type: string
        hidden:
          type: boolean
    Pagination:
      type: object
      properties:
        totalPages:
          type: integer
          format: int32
        totalElements:
          type: integer
          format: int32
        pageNumber:
          type: integer
          format: int32
        previousElements:
          type: integer
          format: int32
        pageSize:
          type: integer
          format: int32
        paginationToken:
          type: string
          format: nullable
    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

````