# Email Enrichment

Person details (name, position, company, social profiles) for an email. You have emails (sign-ups, inbound leads) and want the person behind each: name, position, company, social profiles.

**Credits:** 1 search credit when found. Lookups that find nothing cost nothing. See [Pricing and limits](../pricing-and-limits).

## Inputs and options

Input: `email` (Email address)

This tool has no options.

## Try one value

```sql
CALL TOMBA.core.email_enrichment('jane.doe@acme.com');
```

The call returns the result as a `VARIANT` (example values, shortened):

```json
{
    "status": "found",
    "credits": 1,
    "results": [
        {
            "EMAIL": "jane.doe@acme.com",
            "FULL_NAME": "Jane Doe",
            "POSITION": "Head of Sales",
            "COMPANY": "Acme",
            "LINKEDIN": "https://www.linkedin.com/in/..."
        }
    ]
}
```

`status` is `found`, `not_found`, `invalid` or `error`; `results` holds the output columns and `data` the complete
Tomba record.

## Run it over a table

Create a small table to try it (or use one of yours, after [granting the app access](../installation#3-let-the-app-read-your-tables)):

```sql
CREATE OR REPLACE TABLE my_db.public.signups (EMAIL STRING);
INSERT INTO my_db.public.signups VALUES
    ('jane.doe@acme.com'),
    ('john@globex.com');
GRANT SELECT ON TABLE my_db.public.signups TO APPLICATION TOMBA;
```

Run the tool, then read the results:

```sql
CALL TOMBA.core.enrich_emails('MY_DB.PUBLIC.SIGNUPS', 'EMAIL', 'SIGNUPS_EMAIL_ENRICHMENT', 100);

SELECT INPUT_EMAIL, FULL_NAME, POSITION, COMPANY, COUNTRY, LINKEDIN
  FROM TOMBA.results.SIGNUPS_EMAIL_ENRICHMENT
 WHERE lookup_status = 'found';
```

Signature: `enrich_emails(input_table STRING, email_column STRING, output_table STRING, max_rows INT DEFAULT 100000)`

<Callout type="tip">
    Start with a small `max_rows` (like 100) to check the match rate on your
    data, then run the whole table, in the [background](../background-runs) if
    it is large.
</Callout>

## Output columns

Each row starts with `INPUT_<name>` columns (your values, unchanged) and then has:

`EMAIL`, `SCORE`, `VERIFICATION_STATUS`, `FIRST_NAME`, `LAST_NAME`, `FULL_NAME`, `POSITION`, `DEPARTMENT`, `COMPANY`, `WEBSITE_URL`, `COUNTRY`, `LINKEDIN`, `TWITTER`, `EMAIL_TYPE`, `ACCEPT_ALL`, `PHONE_NUMBER`, followed by the [common columns](../reference/output-columns)
(`LOOKUP_STATUS`, `CREDITS`, `DATA`, `SOURCE`, …).

## Tips

- Free-mail addresses (gmail.com, …) rarely match: enrichment is for work emails.
- For a fuller profile (seniority, location, GitHub), use Person Enrichment; for person + company in one call, Combined Enrichment.

## Related

- [Person Enrichment](./person-enrichment)
- [Combined Enrichment](./combined-enrichment)
