# searchCompanies

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

```typescript
try {
  const workflow = await linkedapi.searchCompanies.execute({
    term: "Technology",
    limit: 10,
    filter: {
      sizes: ["51-200", "201-500"] as TSearchCompanySize[],
      locations: ["San Francisco", "New York"],
      industries: ["Software Development", "Information Technology"]
    },
    customSearchUrl: "https://www.linkedin.com/search/results/companies/?companySize=%5B%22B%22%5D&keywords=Linked%20API"
  });

  const { data, errors } = await linkedapi.searchCompanies.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}`);
    });
  }

  // The structure of the 'data' object is below
  if (data) {
    console.log('Workflow completed successfully. Data:', 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 SearchCompaniesParams, LinkedApiError

try:
    workflow = linkedapi.search_companies.execute(
        SearchCompaniesParams(
            term="Technology",
            limit=10,
            filter={
                "sizes": ["51-200", "201-500"],
                "locations": ["San Francisco", "New York"],
                "industries": ["Software Development", "Information Technology"],
            },
            custom_search_url="https://www.linkedin.com/search/results/companies/?companySize=%5B%22B%22%5D&keywords=Linked%20API",
        )
    )

    result = linkedapi.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}")

    # The structure of the 'data' object is below
    if data:
        print("Workflow completed successfully. Data:", 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.
- `limit` (optional) – number of search results to return. Defaults to **10**, 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.
- `customSearchUrl` (optional) – URL copied from LinkedIn search results page after configuring desired filters. When specified, overrides term and filter parameters. Allows using any search configuration available in the LinkedIn interface.

## Data

Array of search results. Each search result contains:

- `name` – name of the company.
- `publicUrl` – [public](/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.
- `location` – free-form string representing the company headquarters location.
- `logoUrl` – URL of the company's logo, or `null` if the company has no logo.

## Errors

- `searchingNotAllowed` – LinkedIn has blocked performing the search due to exceeding limits or other restrictions.
