# st.searchPeople

> 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 people applying various filtering criteria.

:::surface node,python
In the SDK this is the `searchPeople` 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 person search` – the command is below, under [Parameters](#parameters).
:::

## Constraints

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

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

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

## Parameters

```json tab=HTTP
{
  "actionType": "st.searchPeople",
  "label": "johnDoeSearch1",
  "term": "John Doe",
  "limit": 2,
  "filter": {
    "firstName": "John",
    "lastName": "Doe",
    "position": "CEO",
    "locations": ["New York", "San Francisco", "London"],
    "industries": ["Software Development", "Professional Services"],
    "currentCompanies": ["Tech Solutions", "Innovatech"],
    "previousCompanies": ["FutureCorp"],
    "schools": ["Harvard University", "MIT"],
    "connectionDegrees": ["2nd", "3rd+"]
  },
  "customSearchUrl": "https://www.linkedin.com/search/results/people/?geoUrn=%5B%22103644278%22%5D&keywords=Bill%20Gates",
  "then": { ... }
}
```

```typescript tab=Node
const workflow = await linkedapi.searchPeople.execute({
  term: "John Doe",
  limit: 2,
  filter: {
    firstName: "John",
    lastName: "Doe",
    position: "CEO",
    locations: ["New York", "San Francisco", "London"],
    industries: ["Software Development", "Professional Services"],
    currentCompanies: ["Tech Solutions", "Innovatech"],
    previousCompanies: ["FutureCorp"],
    schools: ["Harvard University", "MIT"],
    connectionDegrees: ["2nd", "3rd+"]
  },
  customSearchUrl: "https://www.linkedin.com/search/results/people/?geoUrn=%5B%22103644278%22%5D&keywords=Bill%20Gates"
});

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

```python tab=Python
from linkedapi import SearchPeopleParams

workflow = linkedapi.search_people.execute(
    SearchPeopleParams(
        term="John Doe",
        limit=2,
        filter={
            "first_name": "John",
            "last_name": "Doe",
            "position": "CEO",
            "locations": ["New York", "San Francisco", "London"],
            "industries": ["Software Development", "Professional Services"],
            "current_companies": ["Tech Solutions", "Innovatech"],
            "previous_companies": ["FutureCorp"],
            "schools": ["Harvard University", "MIT"],
            "connection_degrees": ["2nd", "3rd+"],
        },
        custom_search_url="https://www.linkedin.com/search/results/people/?geoUrn=%5B%22103644278%22%5D&keywords=Bill%20Gates",
    )
)

result = linkedapi.search_people.result(workflow.workflow_id)
```

```bash tab=CLI
linkedin person search \
  --term "John Doe" \
  --limit 2 \
  --first-name John \
  --last-name Doe \
  --position CEO \
  --locations "New York,San Francisco,London" \
  --industries "Software Development,Professional Services" \
  --current-companies "Tech Solutions,Innovatech" \
  --previous-companies FutureCorp \
  --schools "Harvard University,MIT" \
  --connection-degrees 2nd,3rd+
```

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

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

```bash
linkedin person search [flags]
```

| Flag | Type | Description |
| --- | --- | --- |
| `--term` | string | Search keyword or phrase (required unless `--url` is given) |
| `--url` | string | LinkedIn people search URL – the CLI form of `customSearchUrl`; overrides `--term` and the filters |
| `--limit` | integer | Max results to return |
| `--first-name` | string | Filter by first name |
| `--last-name` | string | Filter by last name |
| `--position` | string | Filter by job position |
| `--locations` | string | Comma-separated locations |
| `--industries` | string | Comma-separated industries |
| `--current-companies` | string | Comma-separated current company names |
| `--previous-companies` | string | Comma-separated previous company names |
| `--schools` | string | Comma-separated school names |
| `--connection-degrees` | string | Comma-separated connection degrees: `1st`, `2nd`, `3rd+` |
:::

- `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 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.
  - `connectionDegrees` (optional) – array of enums representing your connection degree to the person. Matches if the person is at any of the listed degrees. Options:
    - `1st` – your 1st-degree connections.
    - `2nd` – your 2nd-degree connections.
    - `3rd+` – 3rd-degree connections and beyond.
- `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.searchPeople",
  "label": "johnDoeSearch1",
  "success": true,
  "data": [
    {
      "name": "John Doe",
      "urn": "urn:li:member:123456789",
      "publicUrl": "https://www.linkedin.com/in/johndoe",
      "headline": "Founder & CEO at Example Company",
      "location": "London",
      "avatarUrl": "https://media.licdn.com/dms/image/v2/D5603AQE/profile-displayphoto-shrink_100_100/0/1700000000000",
      "viewerState": { "connectionDegree": "2nd" },
      "then": { ... }
    },
    {
      "name": "John Doe",
      "urn": null,
      "publicUrl": "https://www.linkedin.com/in/johnyd",
      "headline": "Product Manager at Semsoft",
      "location": "New York",
      "avatarUrl": null,
      "viewerState": { "connectionDegree": "3rd+" },
      "then": { ... }
    }
  ]
}
```

- `label` – included only if specified in the action parameters.
- `data` – array of search outputs with results of child actions execution.
  - `name` – full name of the person.
  - `urn` – [URN](/docs/data-conventions#linkedin-urns) of the person, or `null` if LinkedIn does not expose it.
  - `publicUrl` – [public](/faq/what-are-hashed-url-and-public-url) LinkedIn URL of the person.
  - `headline` – headline 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.
  - `viewerState` – how your account relates to the person, see [viewer state](/docs/data-conventions#viewer-state).
    - `connectionDegree` – `1st`, `2nd`, or `3rd+`, as LinkedIn shows it next to the name, or `null` if LinkedIn does not show it.
  - `then` – results of child actions execution.

2. **Failed search:**

```json
{
  "actionType": "st.searchPeople",
  "label": "johnDoeSearch1",
  "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.
