# st.searchCompanies

> The API Reference is also the SDK and CLI reference. Consecutive code fences marked `tab=HTTP`, `tab=Node`, `tab=Python` and `tab=CLI` are the same call on each surface (a fence marked `tab=HTTP,CLI` is the same text for both), and a block between `:::surface <names>` and `:::` applies only to the surfaces it names. Identifiers in the text are written as in Node and in HTTP JSON (camelCase); the Python SDK spells methods, parameters and result attributes in snake_case (`sendMessage` → `send_message`, `reconnectionLink` → `reconnection_link`), while names inside HTTP JSON stay camelCase.

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

:::surface node,python
In the SDK this is the `searchCompanies` method. It takes the parameters below except `label` and `then`, which exist only in workflow JSON, and returns the result below in `data`.
:::

:::surface cli
In the CLI this is `linkedin company search` – the command is below, under [Parameters](#parameters).
:::

## Constraints

> ⏺️ **Root Start:** allowed.

> ⬆️ **Parent Actions:** N/A.

> ⬇️ **Child Actions:** [st.doForCompanies](/docs/action-st-do-for-companies).

## Parameters

```json tab=HTTP
{
  "actionType": "st.searchCompanies",
  "label": "techIncSearch1",
  "term": "Tech Inc",
  "limit": 2,
  "filter": {
    "sizes": ["51-200", "201-500"],
    "locations": ["San Francisco", "New York"],
    "industries": ["Software Development", "Robotics Engineering"]
  },
  "customSearchUrl": "https://www.linkedin.com/search/results/companies/?companySize=%5B%22B%22%5D&keywords=Linked%20API",
  "then": { ... }
}
```

```typescript tab=Node
const workflow = await linkedapi.searchCompanies.execute({
  term: "Tech Inc",
  limit: 2,
  filter: {
    sizes: ["51-200", "201-500"],
    locations: ["San Francisco", "New York"],
    industries: ["Software Development", "Robotics Engineering"]
  },
  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);
```

```python tab=Python
from linkedapi import SearchCompaniesParams

workflow = linkedapi.search_companies.execute(
    SearchCompaniesParams(
        term="Tech Inc",
        limit=2,
        filter={
            "sizes": ["51-200", "201-500"],
            "locations": ["San Francisco", "New York"],
            "industries": ["Software Development", "Robotics Engineering"],
        },
        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)
```

```bash tab=CLI
# Not available in the CLI: customSearchUrl
linkedin company search \
  --term "Tech Inc" \
  --limit 2 \
  --sizes 51-200,201-500 \
  --locations "San Francisco,New York" \
  --industries "Software Development,Robotics Engineering"
```

In AI assistants, the MCP server runs this action as the `search_companies` tool.

:::surface cli
In the CLI this is `linkedin company search`:

```bash
linkedin company search [flags]
```

| Flag | Type | Description |
| --- | --- | --- |
| `--term` | string | Search keyword or phrase |
| `--limit` | integer | Max results to return |
| `--sizes` | string | Company sizes, comma-separated (`1-10`, `11-50`, `51-200`, `201-500`, `501-1000`, `1001-5000`, `5001-10000`, `10001+`) |
| `--locations` | string | Comma-separated locations |
| `--industries` | string | Comma-separated industries |
:::

- `label` (optional) – custom label for tracking this action in workflow completion.
- `term` (optional) – keyword or phrase to search, from 1 to 50 characters. Either `term` or `customSearchUrl` must be provided; a request with neither (for example, with `filter` only) is rejected.
- `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. Either `term` or `customSearchUrl` must be provided.
- `then` (optional) – object or array of child actions to be executed within this action.

## Result options

1. **Successful search:**

```json
{
  "actionType": "st.searchCompanies",
  "label": "techIncSearch1",
  "success": true,
  "data": [
    {
      "name": "TechCorp",
      "urn": "urn:li:organization:1234567",
      "publicUrl": "https://www.linkedin.com/company/techcorp",
      "industry": "IT Services and IT Consulting",
      "location": "California",
      "logoUrl": "https://media.licdn.com/dms/image/v2/C4D0BAQE/company-logo_100_100/0/1700000000000",
      "then": { ... }
    },
    {
      "name": "Techical Life",
      "urn": null,
      "publicUrl": "https://www.linkedin.com/company/techlife",
      "industry": "Software Development",
      "location": "Mountain View",
      "logoUrl": null,
      "then": { ... }
    }
  ]
}
```

- `label` – included only if specified in the action parameters.
- `data` – array of search outputs with results of child actions execution.
  - `name` – name of the company.
  - `urn` – [URN](/docs/data-conventions#linkedin-urns) of the company, or `null` if LinkedIn does not expose it.
  - `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.
  - `then` – results of child actions execution.

2. **Failed search:**

```json
{
  "actionType": "st.searchCompanies",
  "label": "techIncSearch1",
  "success": false,
  "error": {
    "type": "searchingNotAllowed",
    "message": "LinkedIn has blocked performing the search."
  }
}
```

- `label` – included only if specified in the action parameters.
- `error.type` – enum with the following possible values:
  - `filterNotApplied` – LinkedIn offered no matching option for one or more filter values. The message lists each field and value, so correct or remove them rather than retrying.
  - `searchingNotAllowed` – LinkedIn has blocked performing the search due to exceeding limits or other restrictions.
