# st.doForPeople

> 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 apply the actions specified in its `then` parameter to each person provided by the parent action.

:::surface node,python
This action cannot start a workflow, so the SDK has no method for it: put it under its parent action in the workflow you pass to [`customWorkflow`](/sdks/custom-workflow) – see [Building Workflows](/docs/building-workflows).
:::

:::surface cli
This action cannot start a workflow, so the CLI has no command for it: put it under its parent action in the workflow you pass to [`linkedin workflow run`](/cli/workflows) – see [Building Workflows](/docs/building-workflows).
:::

> There is a limit of 20 people that this action can be applied to. If the parent action provides more than 20 people, only the first 20 will be processed.

## Constraints

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

> ⬆️ **Parent Actions:** [st.searchPeople](/docs/action-st-search-people), [st.retrieveCompanyEmployees](/docs/action-st-retrieve-company-employees), [st.retrieveCompanyDMs](/docs/action-st-retrieve-company-dms).

> ⬇️ **Child Actions:** [st.openPersonPage](/docs/action-st-open-person-page).

## Parameters

```json tab=HTTP,CLI
{
  "actionType": "st.doForPeople",
  "then": { ... }
}
```

```typescript tab=Node
{
  actionType: "st.doForPeople",
  then: { ... }
}
```

```python tab=Python
{
    "actionType": "st.doForPeople",
    "then": {...},
}
```

- `then` – object or array of child actions to apply to each person from the parent action.

## Result options

This action doesn't produce its own distinct result. The effects are visible in the people that were involved, as they will contain a `then` field with the results of the applied actions. See usage examples for more details.

## Usage examples

1. **Retrieving basic information about the first 2 people from the search results:**

**Workflow:**

```json tab=HTTP
{
  "actionType": "st.searchPeople",
  "term": "John Doe",
  "limit": 2,
  "filter": {
    "position": "CEO",
    "locations": ["New York", "San Francisco", "London"]
  },
  "then": {
    "actionType": "st.doForPeople",
    "then": {
      "actionType": "st.openPersonPage",
      "basicInfo": true
    }
  }
}
```

```typescript tab=Node
const workflow = await linkedapi.customWorkflow.execute({
  actionType: "st.searchPeople",
  term: "John Doe",
  limit: 2,
  filter: {
    position: "CEO",
    locations: ["New York", "San Francisco", "London"]
  },
  then: {
    actionType: "st.doForPeople",
    then: {
      actionType: "st.openPersonPage",
      basicInfo: true
    }
  }
});

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

```python tab=Python
workflow = linkedapi.custom_workflow.execute(
    {
        "actionType": "st.searchPeople",
        "term": "John Doe",
        "limit": 2,
        "filter": {
            "position": "CEO",
            "locations": ["New York", "San Francisco", "London"],
        },
        "then": {
            "actionType": "st.doForPeople",
            "then": {
                "actionType": "st.openPersonPage",
                "basicInfo": True,
            },
        },
    }
)

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

```bash tab=CLI
linkedin workflow run <<'EOF'
{
  "actionType": "st.searchPeople",
  "term": "John Doe",
  "limit": 2,
  "filter": {
    "position": "CEO",
    "locations": [
      "New York",
      "San Francisco",
      "London"
    ]
  },
  "then": {
    "actionType": "st.doForPeople",
    "then": {
      "actionType": "st.openPersonPage",
      "basicInfo": true
    }
  }
}
EOF
```

:::surface http
**Completion:**
:::

:::surface node,python
**Completion** – `result()` returns this whole completion in `data`:
:::

:::surface cli
**Completion** – `linkedin workflow run` prints this whole completion as `data`:
:::

```json
{
  "actionType": "st.searchPeople",
  "success": true,
  "data": [
    {
      "name": "John Doe",
      "publicUrl": "https://www.linkedin.com/in/johndoe",
      "headline": "Software Engineer at TechCorp",
      "location": "San Francisco, USA",
      "then": {
        "actionType": "st.openPersonPage",
        "success": true,
        "data": {
          "name": "John Doe",
          "publicUrl": "https://www.linkedin.com/in/johndoe",
          "hashedUrl": "https://www.linkedin.com/in/SInQBmjJ015eLr8",
          "headline": "Software Engineer at TechCorp",
          "location": "San Francisco, USA",
          "countryCode": "US",
          "position": "Software Engineer",
          "companyName": "TechCorp",
          "companyHashedUrl": "https://www.linkedin.com/company/12345678"
        }
      }
    },
    {
      "name": "John Doe",
      "publicUrl": "https://www.linkedin.com/in/johnyde",
      "headline": "Product Manager at TechCorp",
      "location": "New York, USA",
      "then": {
        "actionType": "st.openPersonPage",
        "success": true,
        "data": {
          "name": "John Doe",
          "publicUrl": "https://www.linkedin.com/in/johnyd",
          "hashedUrl": "https://www.linkedin.com/in/Hs763KsjdB153e",
          "headline": "Product Manager at TechCorp",
          "location": "New York, USA",
          "countryCode": "US",
          "position": "Product Manager",
          "companyName": "TechCorp",
          "companyHashedUrl": "https://www.linkedin.com/company/12345678"
        }
      }
    }
  ]
}
```

2. **Sending connection requests to all the company's decision makers:**

**Workflow:**

```json tab=HTTP
{
  "actionType": "st.openCompanyPage",
  "companyUrl": "https://www.linkedin.com/company/techcorp",
  "then": {
    "actionType": "st.retrieveCompanyDMs",
    "then": {
      "actionType": "st.doForPeople",
      "then": {
        "actionType": "st.openPersonPage",
        "then": {
          "actionType": "st.sendConnectionRequest"
        }
      }
    }
  }
}
```

```typescript tab=Node
const workflow = await linkedapi.customWorkflow.execute({
  actionType: "st.openCompanyPage",
  companyUrl: "https://www.linkedin.com/company/techcorp",
  then: {
    actionType: "st.retrieveCompanyDMs",
    then: {
      actionType: "st.doForPeople",
      then: {
        actionType: "st.openPersonPage",
        then: {
          actionType: "st.sendConnectionRequest"
        }
      }
    }
  }
});

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

```python tab=Python
workflow = linkedapi.custom_workflow.execute(
    {
        "actionType": "st.openCompanyPage",
        "companyUrl": "https://www.linkedin.com/company/techcorp",
        "then": {
            "actionType": "st.retrieveCompanyDMs",
            "then": {
                "actionType": "st.doForPeople",
                "then": {
                    "actionType": "st.openPersonPage",
                    "then": {
                        "actionType": "st.sendConnectionRequest",
                    },
                },
            },
        },
    }
)

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

```bash tab=CLI
linkedin workflow run <<'EOF'
{
  "actionType": "st.openCompanyPage",
  "companyUrl": "https://www.linkedin.com/company/techcorp",
  "then": {
    "actionType": "st.retrieveCompanyDMs",
    "then": {
      "actionType": "st.doForPeople",
      "then": {
        "actionType": "st.openPersonPage",
        "then": {
          "actionType": "st.sendConnectionRequest"
        }
      }
    }
  }
}
EOF
```

:::surface http
**Completion:**
:::

:::surface node,python
**Completion** – `result()` returns this whole completion in `data`:
:::

:::surface cli
**Completion** – `linkedin workflow run` prints this whole completion as `data`:
:::

```json
{
  "actionType": "st.openCompanyPage",
  "success": true,
  "data": {
    "then": {
      "actionType": "st.retrieveCompanyDMs",
      "success": true,
      "data": [
        {
          "name": "John Doe",
          "publicUrl": "https://www.linkedin.com/in/johndoe",
          "headline": "CEO at TechCorp",
          "location": "New York, USA",
          "then": {
            "actionType": "st.openPersonPage",
            "success": true,
            "data": {
              "then": {
                "actionType": "st.sendConnectionRequest",
                "success": true
              }
            }
          }
        },
        {
          "name": "CTO Smith",
          "publicUrl": "https://www.linkedin.com/in/janesmith",
          "headline": "Software Engineer at TechCorp",
          "location": "San Francisco, USA",
          "then": {
            "actionType": "st.openPersonPage",
            "success": true,
            "data": {
              "then": {
                "actionType": "st.sendConnectionRequest",
                "success": true
              }
            }
          }
        }
      ]
    }
  }
}
```
