# Finding a person's email

To find the email address of a LinkedIn person, run st.findPersonEmail with their profile URL, or as a child of st.openPersonPage – for one profile or for every person a search returns.

> 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.

To find the email address of a LinkedIn person, run [`st.findPersonEmail`](/docs/action-st-find-person-email) with their `personUrl`, or put it under [`st.openPersonPage`](/docs/action-st-open-person-page) to get the person's profile data in the same workflow. The address can come from the person's Contact info, from an email-finding provider, or both.

:::surface node
Each example below has its Node SDK call in the Node tab, and the label over each completion says what that call returns.
:::

:::surface python
Each example below has its Python SDK call in the Python tab, and the label over each completion says what that call returns.
:::

:::surface cli
Each example below has its CLI command in the CLI tab, and the label over each completion says what the command prints.
:::

## Choosing a source

The `source` parameter decides where the action looks and what it can cost:

| `source` | Contact info | Provider | Cost |
| --- | --- | --- | --- |
| `contactInfo` (default) | yes | no | free |
| `provider` | no | always | 1 credit if an address is found |
| `contactInfoThenProvider` | yes | only when Contact info has no email (or, with `requireWorkEmail: true`, no work email) | 1 credit if the provider finds an address |
| `all` | yes | always | 1 credit if the provider finds an address |

LinkedIn shows Contact info mostly to your 1st-degree connections, and it often holds a personal address. The provider finds work addresses from the person's name and their current company's website. For a work address at the lowest cost, use `contactInfoThenProvider` with `requireWorkEmail: true`: the provider is called only for people whose Contact info has no work address.

Provider lookups are paid with [enrichment credits](/docs/enrichment-credits).

## Finding the email of one person

**Workflow:**

```json tab=HTTP
{
  "actionType": "st.findPersonEmail",
  "personUrl": "https://www.linkedin.com/in/person1",
  "source": "contactInfoThenProvider",
  "requireWorkEmail": true
}
```

```typescript tab=Node
const workflow = await linkedapi.findPersonEmail.execute({
  personUrl: "https://www.linkedin.com/in/person1",
  source: "contactInfoThenProvider",
  requireWorkEmail: true
});

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

```python tab=Python
from linkedapi import FindPersonEmailParams

workflow = linkedapi.find_person_email.execute(
    FindPersonEmailParams(
        person_url="https://www.linkedin.com/in/person1",
        source="contactInfoThenProvider",
        require_work_email=True,
    )
)

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

```bash tab=CLI
linkedin person email https://www.linkedin.com/in/person1 \
  --source contactInfoThenProvider \
  --require-work-email \
  --json
```

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

:::surface node,python
**Completion** – `result()` returns its `data` in `data`, and a failed action in `errors`:
:::

:::surface cli
**Completion** – with `--json` the CLI prints its `data` as `data`, or the action's `error`:
:::

```json
{
  "actionType": "st.findPersonEmail",
  "success": true,
  "data": {
    "emails": [
      { "address": "jane@gmail.com", "source": "contactInfo", "type": "personal" },
      { "address": "jane.doe@acme.com", "source": "provider", "type": "work", "status": "valid" }
    ],
    "providerStatus": "found"
  }
}
```

Here the person's Contact info had only a personal address, so `requireWorkEmail` sent them to the provider, which found the work address. The lookup used 1 credit.

:::surface python
In Python, the method takes `require_work_email` and its result has snake_case attributes: `result.data.emails` and `result.data.provider_status`. In the workflow below, which goes through `custom_workflow`, the keys stay as in the JSON.
:::

The action opens the profile itself. To get the person's profile data as well, put `st.findPersonEmail` under `st.openPersonPage` without its own `personUrl`, as in the next example.

## Finding emails for search results

To find emails for the people a search returns, put `st.openPersonPage` with `st.findPersonEmail` as its child under [`st.doForPeople`](/docs/action-st-do-for-people). `basicInfo: true` here only adds each person's profile data to the result; the lookup works without it. Each person is looked up separately, and each successful provider lookup uses its own credit.

**Workflow:**

```json tab=HTTP
{
  "actionType": "st.searchPeople",
  "term": "Head of Sales",
  "limit": 10,
  "then": {
    "actionType": "st.doForPeople",
    "then": {
      "actionType": "st.openPersonPage",
      "basicInfo": true,
      "then": {
        "actionType": "st.findPersonEmail",
        "source": "provider"
      }
    }
  }
}
```

```typescript tab=Node
const workflow = await linkedapi.customWorkflow.execute({
  actionType: "st.searchPeople",
  term: "Head of Sales",
  limit: 10,
  then: {
    actionType: "st.doForPeople",
    then: {
      actionType: "st.openPersonPage",
      basicInfo: true,
      then: {
        actionType: "st.findPersonEmail",
        source: "provider"
      }
    }
  }
});

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

```python tab=Python
workflow = linkedapi.custom_workflow.execute(
    {
        "actionType": "st.searchPeople",
        "term": "Head of Sales",
        "limit": 10,
        "then": {
            "actionType": "st.doForPeople",
            "then": {
                "actionType": "st.openPersonPage",
                "basicInfo": True,
                "then": {
                    "actionType": "st.findPersonEmail",
                    "source": "provider",
                },
            },
        },
    }
)

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

```bash tab=CLI
linkedin workflow run <<'EOF'
{
  "actionType": "st.searchPeople",
  "term": "Head of Sales",
  "limit": 10,
  "then": {
    "actionType": "st.doForPeople",
    "then": {
      "actionType": "st.openPersonPage",
      "basicInfo": true,
      "then": {
        "actionType": "st.findPersonEmail",
        "source": "provider"
      }
    }
  }
}
EOF
```

:::surface http
**Completion** (abridged to two people):
:::

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

:::surface cli
**Completion** – `linkedin workflow run` prints this whole completion as `data` (abridged to two people):
:::

```json
{
  "actionType": "st.searchPeople",
  "success": true,
  "data": [
    {
      "name": "Jane Doe",
      "publicUrl": "https://www.linkedin.com/in/janedoe",
      ...
      "then": [
        {
          "actionType": "st.openPersonPage",
          "success": true,
          "data": {
            "name": "Jane Doe",
            ...
            "then": {
              "actionType": "st.findPersonEmail",
              "success": true,
              "data": {
                "emails": [
                  { "address": "jane.doe@acme.com", "source": "provider", "type": "work", "status": "valid" }
                ],
                "providerStatus": "found"
              }
            }
          }
        }
      ]
    },
    {
      "name": "John Roe",
      "publicUrl": "https://www.linkedin.com/in/johnroe",
      ...
      "then": [
        {
          "actionType": "st.openPersonPage",
          "success": true,
          "data": {
            "name": "John Roe",
            ...
            "then": {
              "actionType": "st.findPersonEmail",
              "success": true,
              "data": { "emails": [], "providerStatus": "notFound" }
            }
          }
        }
      ]
    }
  ]
}
```

The first person cost 1 credit, and the second cost nothing.

## When credits run out

The workflow starts as long as you have at least 1 credit. Without any, it is rejected with `insufficientEnrichmentCredits` before it starts. Once your credits run out in the middle of a list:

- every remaining lookup that would call the provider ends with `providerStatus: "insufficientCredits"`, and the provider is not called;
- the workflow still runs to the end, and the rest of each person's data comes back as usual;
- Contact info addresses are still returned for `contactInfoThenProvider` and `all`;
- the company page is not opened just to reach the provider. It can still open to classify a Contact info address that is not at a known mail service, and that view counts as usual.

A lookup that finds nothing gives its credit back, so the next person in the list can use it.

## Reading the result

- `emails` – the addresses found, possibly none. Contact info entries come first.
  - `type`: `work` when the domain matches the current company's website, `personal` for a mail service such as gmail.com, otherwise `unknown`.
  - `status` on provider entries: `valid` when the provider is sure the mailbox exists, `probable` when the address is likely but not confirmed.
- `providerStatus` says why the provider was or was not called, and whether a credit was used. Only `found` uses a credit.

Every value is listed on [st.findPersonEmail](/docs/action-st-find-person-email#result-options).

## Limits

Each person's profile counts as one `stPersonProfileViews`: opened by `st.findPersonEmail` itself when it starts the workflow, or by `st.openPersonPage` when it is the parent. The action also opens the person's current company page when it needs the company's website: to classify a Contact info address that is not at a known mail service, or to give the provider a domain. Each opening counts as one `stCompanyPageViews`. When that limit is reached, the page is not opened and the lookup ends with `companyPageLimitReached`. See [Limits](/docs/admin-limits).

> 💡 To go the other way – from an email address to the LinkedIn profile – see [Finding a profile by email](/docs/finding-profile-by-email).

> This page provides examples of [workflows](/docs/building-workflows) and their [completions](/docs/executing-workflows). For detailed documentation on constraints, parameters, and possible results of specific actions, always refer to the corresponding [action documentation pages](/docs/actions-overview).
