> ## Documentation Index
> Fetch the complete documentation index at: https://developer.lemlist.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Enrichment

An enrichment is one request to find data about one person: find their email
(`find_email`), find their phone number (`find_phone`), verify an email
(`verify`) or enrich their LinkedIn profile (`linkedin_enrichment`). Start one
with [Enrich Data](https://developer.lemlist.com/api-reference/endpoints/enrich/enrich-data.md),
[Enrich Lead](https://developer.lemlist.com/api-reference/endpoints/enrich/enrich-lead.md) or many at once with
[Bulk Enrich Data](https://developer.lemlist.com/api-reference/endpoints/enrich/bulk-enrich-data.md). Each call
answers with an enrichment `id` (`enr_…`) right away and the work runs in the
background.

There are two ways to get the result:

1. **Webhooks (recommended)**: lemlist calls your endpoint once the enrichment
   is over. See [Webhooks](#webhooks) below.
2. **Polling**: call [Get Enrichment Result](https://developer.lemlist.com/api-reference/endpoints/enrich/get-enrichment-result.md)
   with the `id` until `enrichmentStatus` is no longer `in-progress`.

## Result keys

Polling and webhooks carry the same per-workflow results, under different key names:

| Workflow | Key in `GET /enrich/{enrichId}` `data` | Key in webhook `data` |
| - | - | - |
| `find_email` | `email` | `find_email` |
| `verify` | `email.status` | `verify.status` |
| `find_phone` | `phone` | `find_phone` |
| `linkedin_enrichment` | `linkedin` | `linkedin_enrichment` |

A key is present only for a requested workflow that produced a result. A
`find_email` or `find_phone` that found nothing still produced a result: its
key is present with `notFound: true`. `failedWorkflows` lists the requested
workflows that ended without any result; they have no key in `data`. A workflow
lemlist runs on its own as a dependency of a requested one is never listed.
`failedWorkflows` is only present when it is not empty.

When the person opted out of enrichment, the value is never returned:
`notFound` is `true`, as when nothing was found.

## Request errors

When an enrichment cannot be started, the start call answers with a
`code` naming why and a `message` explaining it. Bulk rows carry them as
`error` and `message`. `message` is a human-readable text that may be
translated to the language of the API user: branch on `code` (`error` on bulk
rows), never on `message`.

| Code | Meaning |
| - | - |
| `BAD_EMAIL` | Invalid email format |
| `BAD_LINKEDIN_URL` | Invalid LinkedIn URL format: `linkedin_enrichment` needs a person profile URL |
| `MISSING_EMAIL` | Email address is required for verification |
| `MISSING_INPUTS` | Not enough inputs for the requested workflow (see the required inputs in [Bulk Enrich Data](https://developer.lemlist.com/api-reference/endpoints/enrich/bulk-enrich-data.md#required-inputs)) |
| `MISSING_FUNDS` | Not enough credits to complete this enrichment |
| `CREDITS_USAGE_FORBIDDEN` | User LinkedIn account needs to be connected in “Settings” to enrich |
| `NOT_ALLOWED_EMAIL` | You don't have permission to find emails |
| `NOT_ALLOWED_PHONE` | You don't have permission to find phone numbers |
| `NOT_ALLOWED_LINKEDIN` | You don't have permission to enrich LinkedIn profiles |
| `NOT_ALLOWED_VERIFY` | You don't have permission to verify emails |
| `LINKEDIN_UNSUBSCRIBED` | This LinkedIn profile is on the privacy list and cannot be enriched |
| `TEAM_BLOCKED` | The enrichment process is blocked on your team. Please contact support for assistance. |
| `TEAM_IN_ERROR` | The enrichment process is blocked on your team. Please contact support for assistance. Temporary: retry later. |
| `SYSTEM_DISABLED` | Enrichment service is temporarily unavailable, please retry later |
| `NO_AVAILABLE_PROVIDER` | No enrichment provider is available for this request |

On [Enrich Data](https://developer.lemlist.com/api-reference/endpoints/enrich/enrich-data.md) and
[Enrich Lead](https://developer.lemlist.com/api-reference/endpoints/enrich/enrich-lead.md), the HTTP status
depends on the code: `403` for `CREDITS_USAGE_FORBIDDEN`, `503` for
`TEAM_IN_ERROR` and `SYSTEM_DISABLED` (retry later), `400` for the others.

## Failure codes

An enrichment that started but failed as a whole answers `failed` on
[Get Enrichment Result](https://developer.lemlist.com/api-reference/endpoints/enrich/get-enrichment-result.md)
and sends an `enrichmentError` webhook, with a `code` and a `reason`. `reason`
is a human-readable text that may be translated to the language of the API
user: branch on `code`, never on `reason`.

| Code | Meaning |
| - | - |
| `FAILED_TO_PROCESS` | Enrichment service is having issues, please retry later |
| `INVALID_INPUT` | The provided data is invalid |
| `PROVIDER_TIMEOUT` | The enrichment provider did not respond in time |
| `PROVIDER_REJECTED` | The enrichment provider could not process this request |

## Webhooks

Enrichments send two webhook events:

| Event | When |
| - | - |
| `enrichmentDone` | The enrichment is over. Some requested workflows may have ended without any result: check `failedWorkflows`. |
| `enrichmentError` | The enrichment failed as a whole. |

They are delivered to every webhook your team registered for the event with
[Add Webhook](https://developer.lemlist.com/api-reference/endpoints/webhooks/add-webhook.md), and to the
`webhookUrl` passed when the enrichment was started. A `POST` is sent with a
JSON body holding the event `type` and a `data` array. The array can hold
several enrichments of the same event: lemlist may group them in one call.

Each `enrichmentDone` item:

| Field | Type | Description |
| - | - | - |
| `id` | string | Enrichment ID |
| `data.find_email` | object | `email` (absent when not found), `notFound`, `status` (`deliverable`, `risky` or `undeliverable`, when a check resolved) |
| `data.verify` | object | `status`: `deliverable`, `risky` or `undeliverable` |
| `data.find_phone` | object | `phone` (absent when not found), `additionalPhones` (only when the provider returned more numbers), `notFound` |
| `data.linkedin_enrichment` | object | The LinkedIn profile |
| `failedWorkflows` | string\[] | Requested workflows that ended without any result, absent from `data`. A `find_email` or `find_phone` that found nothing is not listed: it answers `notFound: true`. Only present when not empty |
| `metadata` | string or object | The `metadata` sent with the bulk request, `{}` when none was sent |

Each `enrichmentError` item:

| Field | Type | Description |
| - | - | - |
| `id` | string | Enrichment ID |
| `code` | string | One of the [failure codes](#failure-codes) |
| `reason` | string | Human-readable explanation of `code`, possibly translated to the language of the API user. Branch on `code` |
| `error` | string | Raw cause stored on the enrichment, absent when none was stored. Prefer `code` |
| `metadata` | string or object | The `metadata` sent with the bulk request, `{}` when none was sent |

```json enrichmentDone theme={"theme":"dracula"}
{
  "type": "enrichmentDone",
  "data": [
    {
      "id": "enr_ExampleA1b2C3d4E5",
      "data": {
        "find_email": {
          "email": "john@example.com",
          "notFound": false,
          "status": "deliverable"
        },
        "find_phone": {
          "phone": "+15555550100",
          "additionalPhones": ["+15555550101"],
          "notFound": false
        }
      },
      "failedWorkflows": ["linkedin_enrichment"],
      "metadata": {
        "crmId": "12345"
      }
    }
  ]
}
```

```json enrichmentError theme={"theme":"dracula"}
{
  "type": "enrichmentError",
  "data": [
    {
      "id": "enr_ExampleF6g7H8i9J0",
      "code": "PROVIDER_TIMEOUT",
      "reason": "The enrichment provider did not respond in time",
      "error": "PROVIDER_TIMEOUT",
      "metadata": {}
    }
  ]
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.