# rc.doForPeople

Run rc.openPersonPage, rc.saveToProject or rc.sendMessage for each candidate that rc.searchPeople finds in LinkedIn Recruiter Lite.

> 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 runs the actions in its `then` parameter for each candidate that [rc.searchPeople](/docs/action-rc-search-people) finds in LinkedIn Recruiter Lite.

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

:::surface python
This action cannot start a workflow, so the SDK has no method for it: put it under `rc.searchPeople` in the workflow you pass to [`custom_workflow`](/sdks/custom-workflow), with its keys as written – 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 `rc.searchPeople` in the workflow you pass to [`linkedin workflow run`](/cli/workflows#workflow-run) – see [Building Workflows](/docs/building-workflows).
:::

> The child actions run for every candidate the search returns, so the `limit` of `rc.searchPeople` sets how many candidates are processed.

## Constraints

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

> ⬆️ **Parent Actions:** [rc.searchPeople](/docs/action-rc-search-people).

> ⬇️ **Child Actions:** [rc.openPersonPage](/docs/action-rc-open-person-page), [rc.saveToProject](/docs/action-rc-save-to-project), [rc.sendMessage](/docs/action-rc-send-message).

The child actions get each candidate's Recruiter profile from the search, so leave out their `personUrl`. `rc.sendMessage` sends a new InMail here, so it needs `subject` and does not take `threadId`.

## Parameters

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

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

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

- `then` – required. Object or array of child actions to run for each candidate.

## How it runs

- **One candidate at a time.** For each candidate, the child actions run in the order given, as the search reads its result pages.
- **The first failure stops the search.** When a child action fails, the remaining child actions for that candidate do not run and the search stops. `rc.searchPeople` still succeeds and returns the candidates collected so far; the last one carries the failed result in `then`. A failed child action means a Recruiter page failed, possibly on a warning screen, and each further page load could make that worse. A [limit](/docs/recruiter-lite-overview#limits) reached on the way stops the search the same way, with `limitExceeded`.
- **Except a refused InMail.** When `rc.sendMessage` fails with `inMailCreditRequired` or `inMailNotAvailable`, Recruiter refused that one candidate before anything was typed. That candidate's remaining child actions do not run, and the search goes on with the next candidate.
- **One profile view per action.** `rc.openPersonPage` and `rc.saveToProject` each open the candidate's profile and each count one `rcPersonProfileViews`. With both in `then`, a candidate costs two. Use `rc.saveToProject` alone when you only need the save. `rc.sendMessage` opens the profile too: it counts one `rcPersonProfileViews` whatever its outcome, and one `rcMessages` when the message is sent.

## Result options

This action doesn't produce its own distinct result. Each candidate that `rc.searchPeople` returns carries a `then` field: an array with the result of each child action run for them, in order.

## Usage example

**Workflow** – save the first 10 candidates of a search to a project:

```json tab=HTTP
{
  "actionType": "rc.searchPeople",
  "limit": 10,
  "filter": {
    "jobTitles": ["Data Engineer"],
    "locations": ["Amsterdam, North Holland, Netherlands"],
    "hidePreviouslyViewed": true
  },
  "then": {
    "actionType": "rc.doForPeople",
    "then": {
      "actionType": "rc.saveToProject",
      "projectId": "1700000001"
    }
  }
}
```

```typescript tab=Node
const workflow = await linkedapi.customWorkflow.execute({
  actionType: "rc.searchPeople",
  limit: 10,
  filter: {
    jobTitles: ["Data Engineer"],
    locations: ["Amsterdam, North Holland, Netherlands"],
    hidePreviouslyViewed: true
  },
  then: {
    actionType: "rc.doForPeople",
    then: {
      actionType: "rc.saveToProject",
      projectId: "1700000001"
    }
  }
});

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

```python tab=Python
workflow = linkedapi.custom_workflow.execute(
    {
        "actionType": "rc.searchPeople",
        "limit": 10,
        "filter": {
            "jobTitles": ["Data Engineer"],
            "locations": ["Amsterdam, North Holland, Netherlands"],
            "hidePreviouslyViewed": True,
        },
        "then": {
            "actionType": "rc.doForPeople",
            "then": {
                "actionType": "rc.saveToProject",
                "projectId": "1700000001",
            },
        },
    }
)

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

```bash tab=CLI
linkedin workflow run <<'EOF'
{
  "actionType": "rc.searchPeople",
  "limit": 10,
  "filter": {
    "jobTitles": ["Data Engineer"],
    "locations": ["Amsterdam, North Holland, Netherlands"],
    "hidePreviouslyViewed": true
  },
  "then": {
    "actionType": "rc.doForPeople",
    "then": {
      "actionType": "rc.saveToProject",
      "projectId": "1700000001"
    }
  }
}
EOF
```

:::surface http
**Completion** – the second candidate's save failed, so the search stopped there:
:::

:::surface node,python
**Completion** – `result()` returns this whole completion in `data`. The second candidate's save failed, so the search stopped there:
:::

:::surface cli
**Completion** – `linkedin workflow run` prints this whole completion as `data`. The second candidate's save failed, so the search stopped there:
:::

```json
{
  "actionType": "rc.searchPeople",
  "success": true,
  "data": [
    {
      "name": "Jane Example",
      "recruiterProfileUrl": "https://www.linkedin.com/talent/profile/AEMAAB0xExampleProfileId1",
      "headline": "Data Engineer at Example Logistics",
      "location": "Amsterdam, North Holland, Netherlands",
      "avatarUrl": null,
      "viewerState": { "connectionDegree": "2nd" },
      "then": [
        {
          "actionType": "rc.saveToProject",
          "success": true,
          "data": { "alreadyInProject": false }
        }
      ]
    },
    {
      "name": "Alex Sample",
      "recruiterProfileUrl": "https://www.linkedin.com/talent/profile/AEMAAB0xExampleProfileId2",
      "headline": "Senior Data Engineer",
      "location": "Amsterdam, North Holland, Netherlands",
      "avatarUrl": null,
      "viewerState": { "connectionDegree": "3rd+" },
      "then": [
        {
          "actionType": "rc.saveToProject",
          "success": false,
          "error": {
            "type": "recruiterMultipleSessionsDetected",
            "message": "LinkedIn detected Recruiter in use from more than one place on this seat and paused it. Sign out of Recruiter in every other browser and device, then open this account's browser, confirm LinkedIn's notice with Continue to Recruiter, and retry. Repeated detections can get the seat suspended."
          }
        }
      ]
    }
  ]
}
```
