# nvSearchCompanies

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

```typescript
try {
  const workflow = await linkedapi.nvSearchCompanies.execute({
    term: "TechCorp",
    limit: 10,
    filter: {
      sizes: ["51-200", "201-500"] as TSearchCompanySize[],
      locations: ["San Francisco", "New York"],
      industries: ["Software Development", "Technology"],
      annualRevenue: {
        min: "10",
        max: "100"
      }
    },
    customSearchUrl: "https://www.linkedin.com/sales/search/company?query=(spellCorrectionEnabled%3Atrue%2Ckeywords%3ALinked%2520API)"
  });

  const { data, errors } = await linkedapi.nvSearchCompanies.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 companies:', 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 NvSearchCompaniesParams, LinkedApiError

try:
    workflow = linkedapi.nv_search_companies.execute(
        NvSearchCompaniesParams(
            term="TechCorp",
            limit=10,
            filter={
                "sizes": ["51-200", "201-500"],
                "locations": ["San Francisco", "New York"],
                "industries": ["Software Development", "Technology"],
                "annual_revenue": {"min": "10", "max": "100"},
            },
            custom_search_url="https://www.linkedin.com/sales/search/company?query=(spellCorrectionEnabled%3Atrue%2Ckeywords%3ALinked%2520API)",
        )
    )

    result = linkedapi.nv_search_companies.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 companies:", 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 **1000**.
- `filter` (optional) – object that specifies filtering criteria for companies. When multiple filter fields are specified, they are combined using `AND` logic.
  - `sizes` (optional) – array of enums representing employee count ranges. Matches if company’s size falls within any of the listed ranges. Options:
    - `1-10`.
    - `11-50`.
    - `51-200`.
    - `201-500`.
    - `501-1000`.
    - `1001-5000`.
    - `5001-10000`.
    - `10001+`.
  - `locations` (optional) – array of free-form strings representing locations. Matches if company is headquartered in any of the listed locations.
  - `industries` (optional) – array of enums representing industries. Matches if company operates in any of the listed industries. Takes specific values available in the LinkedIn interface.
  - `annualRevenue` (optional) – object representing company annual revenue range in million USD:
    - `min` – enum with options:
      - `0`.
      - `0.5`.
      - `1`.
      - `2.5`.
      - `5`.
      - `10`.
      - `20`.
      - `50`.
      - `100`.
      - `500`.
      - `1000`.
    - `max` – enum with options:
      - `0.5`.
      - `1`.
      - `2.5`.
      - `5`.
      - `10`.
      - `20`.
      - `50`.
      - `100`.
      - `500`.
      - `1000`.
      - `1000+`.
- `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` – name of the company.
- `hashedUrl` – [hashed](/faq/what-are-hashed-url-and-public-url) LinkedIn URL of the company.
- `industry` – enum representing the company industry. Takes specific values available in the LinkedIn interface.
- `employeesCount` – total number of employees associated with the company.
- `logoUrl` – URL of the company's logo, or `null` if the company has no logo.

## Errors

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