# nvSearchPeople

This method allows you to search for people in Sales Navigator applying various filtering criteria.

```typescript
try {
  const workflow = await linkedapi.nvSearchPeople.execute({
    term: "Product Manager",
    limit: 10,
    filter: {
      firstName: "John",
      lastName: "Doe",
      position: "Product Manager",
      locations: ["San Francisco", "New York"],
      industries: ["Software Development", "Technology"],
      currentCompanies: ["Google", "Microsoft"],
      previousCompanies: ["Apple"],
      schools: ["Stanford University", "MIT"],
      yearsOfExperience: ["threeToFive", "sixToTen"]
    },
    customSearchUrl: "https://www.linkedin.com/sales/search/people?query=(recentSearchParam%3A(doLogHistory%3Atrue)%2CspellCorrectionEnabled%3Atrue%2Ckeywords%3ABill%2520Gates)"
  });

  const { data, errors } = await linkedapi.nvSearchPeople.result(workflow.workflowId);

  // The list of possible execution errors is below
  if (errors && errors.length > 0) {
    console.warn('Workflow completed with execution errors:');
    errors.forEach(error => {
      console.warn(` - Type: ${error.type}, Message: ${error.message}`);
    });
  }
  if (data) {
    console.log('Search completed successfully.');
    console.log('Found people:', data);
  }
} catch (e) {
  // A list of all critical errors can be found here:
  // https://linkedapi.io/sdks/handling-results-and-errors/#handling-critical-errors
  if (e instanceof LinkedApiError) {
    console.error(`Critical Error - Type: ${e.type}, Message: ${e.message}`);
  } else {
    console.error('An unexpected, non-API error occurred:', e);
  }
}
```

```python
from linkedapi import NvSearchPeopleParams, LinkedApiError

try:
    workflow = linkedapi.nv_search_people.execute(
        NvSearchPeopleParams(
            term="Product Manager",
            limit=10,
            filter={
                "first_name": "John",
                "last_name": "Doe",
                "position": "Product Manager",
                "locations": ["San Francisco", "New York"],
                "industries": ["Software Development", "Technology"],
                "current_companies": ["Google", "Microsoft"],
                "previous_companies": ["Apple"],
                "schools": ["Stanford University", "MIT"],
                "years_of_experience": ["threeToFive", "sixToTen"],
            },
            custom_search_url="https://www.linkedin.com/sales/search/people?query=(recentSearchParam%3A(doLogHistory%3Atrue)%2CspellCorrectionEnabled%3Atrue%2Ckeywords%3ABill%2520Gates)",
        )
    )

    result = linkedapi.nv_search_people.result(workflow.workflow_id)
    data = result.data
    errors = result.errors

    # The list of possible execution errors is below
    if errors:
        print("Workflow completed with execution errors:")
        for error in errors:
            print(f" - Type: {error.type}, Message: {error.message}")

    if data:
        print("Search completed successfully.")
        print("Found people:", data)
except LinkedApiError as e:
    # A list of all critical errors can be found here:
    # https://linkedapi.io/sdks/handling-results-and-errors/#handling-critical-errors
    print(f"Critical Error - Type: {e.type}, Message: {e.message}")
except Exception as error:
    print("An unexpected, non-API error occurred:", error)
```

## Params

- `term`  – (optional) keyword or phrase to search for.
- `limit`  – (optional) number of search results to return. Defaults to **25**, with a maximum value of **2500**.
- `filter` (optional) – object that specifies filtering criteria for people. When multiple filter fields are specified, they are combined using `AND` logic.
  - `firstName` (optional) – first name of person.
  - `lastName` (optional) – last name of person.
  - `position` (optional) – job position of person.
  - `locations` (optional) – array of free-form strings representing locations. Matches if person is located in any of the listed locations.
  - `industries` (optional) – array of enums representing industries. Matches if person works in any of the listed industries. Takes specific values available in the LinkedIn interface.
  - `currentCompanies` (optional) – array of company names. Matches if person currently works at any of the listed companies.
  - `previousCompanies` (optional) – array of company names. Matches if person previously worked at any of the listed companies.
  - `schools` (optional) – array of institution names. Matches if person currently attends or previously attended any of the listed institutions.
  - `yearsOfExperience` (optional) – array of enums representing professional experience. Matches if person’s experience falls within any of the listed ranges. Options:
    - `lessThanOne` – less than 1 year.
    - `oneToTwo` – 1 to 2 years.
    - `threeToFive` – 3 to 5 years.
    - `sixToTen` – 6 to 10 years.
    - `moreThanTen` – more than 10 years.
- `customSearchUrl` (optional) – URL copied from Sales Navigator search results page after configuring desired filters. When specified, overrides term and filter parameters. Allows using any search configuration available in Sales Navigator.

## Data

Array of search results. Each search result contains:

- `name` – full name of the person.
- `hashedUrl` – [hashed](/faq/what-are-hashed-url-and-public-url) LinkedIn URL of the person.
- `position` – job position of the person.
- `location` – free-form string indicating the person's location.
- `avatarUrl` – URL of the person's profile photo, or `null` if the person has no photo.

## Errors

- `noSalesNavigator` – your account does not have Sales Navigator subscription.
- `searchingNotAllowed` – LinkedIn has blocked performing the search due to exceeding limits or other restrictions.
