# Company Enrichment

Firmographics (industry, size, revenue, location) for a company domain. Add firmographics to accounts: industry, size, revenue, founding year and location, for segmentation and routing.

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

## Inputs and options

Input: `domain` (Company domain)

This tool has no options.

## Try one value

```sql
CALL TOMBA.core.company_enrichment('acme.com');
```

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

```json
{
    "status": "found",
    "credits": 1,
    "results": [
        {
            "NAME": "Acme",
            "INDUSTRY": "Software Development",
            "EMPLOYEES": "51-200",
            "ANNUAL_REVENUE": "10m-50m",
            "FOUNDED_YEAR": 2012,
            "COUNTRY": "US"
        }
    ]
}
```

`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.accounts (WEBSITE STRING);
INSERT INTO my_db.public.accounts VALUES
    ('acme.com'),
    ('globex.com');
GRANT SELECT ON TABLE my_db.public.accounts TO APPLICATION TOMBA;
```

Run the tool, then read the results:

```sql
CALL TOMBA.core.enrich_companies('MY_DB.PUBLIC.ACCOUNTS', 'WEBSITE', 'ACCOUNTS_COMPANY_ENRICHMENT', 100);

SELECT INPUT_DOMAIN, NAME, INDUSTRY, SECTOR, EMPLOYEES, ANNUAL_REVENUE, FOUNDED_YEAR, COUNTRY
  FROM TOMBA.results.ACCOUNTS_COMPANY_ENRICHMENT
 WHERE lookup_status = 'found';
```

Signature: `enrich_companies(input_table STRING, domain_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:

`NAME`, `LEGAL_NAME`, `DOMAIN`, `DESCRIPTION`, `INDUSTRY`, `SECTOR`, `EMPLOYEES`, `ANNUAL_REVENUE`, `FOUNDED_YEAR`, `COMPANY_TYPE`, `CITY`, `COUNTRY`, `COUNTRY_CODE`, `LINKEDIN_HANDLE`, `TWITTER_HANDLE`, `LOGO`, followed by the [common columns](../reference/output-columns)
(`LOOKUP_STATUS`, `CREDITS`, `DATA`, `SOURCE`, …).

## Tips

- The domain column can hold full URLs (`https://www.acme.com/about`): the app keeps only the domain.
- To find new companies rather than enrich known ones, use Companies Search.

## Related

- [Companies Search](./companies-search)
- [Similar Domains](./similar-domains)
- [Domain Search](./domain-search)
