> ## Documentation Index
> Fetch the complete documentation index at: https://www.datalegion.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Apify

> Run Data Legion person and company enrichment as an Apify Actor. Products, input fields, output rows, billing rules, and how to call the Actor from code or an agent.

The [Data Legion Enrichment](https://apify.com/datalegion/data-legion-enrichment) Actor runs person and company enrichment on [Apify](https://apify.com). Paste a list of emails, phone numbers, social profile URLs, domains, or company names, and the Actor returns one dataset row per record. You don't need a Data Legion account or API key: Apify bills the run, and you pay only for matched records.

## Prerequisites

* An Apify account
* An Apify API token, if you run the Actor from code

## Products

Each run uses one product, set with the `product` input.

| `product` | Returns |
| - | - |
| `person_base_no_pii` | Identity, current role and company, work history, education, skills, social profiles |
| `person_base_pii` | Person Base plus emails, phones, location, age, and sex |
| `person_premium_no_pii` | Person Base plus seniority, job function, decision-maker flag, tenure, and data freshness |
| `person_premium_pii` | Person Premium plus emails, phones, location, age, and sex |
| `company_base` | Firmographics: name, domains, industry, size, type, founding year, description |
| `company_premium` | Company Base plus headcount, growth, turnover, and workforce breakdowns |

The [Actor page](https://apify.com/datalegion/data-legion-enrichment) lists the current price per match for each product.

## Input

| Field | Products | Description |
| - | - | - |
| `emails` | Person | One email per entry |
| `phones` | Person | Phone numbers with the country code, e.g. `+1 415 555 0100` |
| `socialUrls` | Person | LinkedIn, GitHub, X, and similar profile URLs |
| `domains` | Company | Company domains, e.g. `apify.com` |
| `companyNames` | Company | Company names. A domain matches more reliably than a name. |
| `records` | Both | Objects with any Data Legion enrich fields, for lookups the lists don't cover |
| `minConfidence` | Both | Drop matches below `high`, `moderate`, or `low` confidence |
| `requiredFields` | Both | Comma-separated fields a match must have, e.g. `work_email`. Matches without them count as no match and aren't charged. |

Use `records` for a name paired with another detail. People take `email`, `email_hash`, `phone`, `social_url`, `linkedin_id`, `legion_id`, or a name (`full_name`, or `first_name` and `last_name`) with one of `company`, `school`, `job_title`, `city`, `state`, `country`, `postal_code`, `address`, or `birth_date`. Companies take `domain`, `name`, `linkedin_id`, `social_url`, `ticker_symbol`, or `legion_id`, optionally with `industry`.

```json theme={null}
{
  "product": "person_premium_no_pii",
  "records": [
    { "full_name": "Jane Doe", "company": "Tech Company" }
  ]
}
```

The [Person Enrichment](/docs/api-reference/person-enrichment) and [Company Enrichment](/docs/api-reference/company-enrichment) references describe each field.

## Output

Every unique input becomes one row in the run's default dataset:

| Field | Description |
| - | - |
| `index` | Position of the input in the run |
| `input` | The lookup fields sent for this row |
| `status` | `matched`, `no_match`, `invalid_input`, or `error` |
| `person` or `company` | The enriched record, on a match |
| `match_metadata` | How the record matched and with what confidence, on a match |
| `charged` | Whether this row was billed, on a match |
| `duplicate_of` | On a repeat match, the `index` of the row that was billed for the same record |
| `error` | The reason, for `invalid_input` and `error` rows |

The dataset has three views in the Apify Console: Overview (status, input, and match confidence), People, and Companies. Export it as CSV, JSON, or Excel like any Apify dataset. Field definitions are in the [Person Schema](/docs/person-data/schema) and [Company Schema](/docs/company-data/schema).

## Billing

The Actor uses Apify's pay-per-event pricing. You aren't charged for Apify platform usage, only for matches.

* No-match, invalid input, and error rows are free.
* Inputs are deduplicated after normalizing case, scheme, `www.`, and trailing slashes, so `Microsoft.com` and `https://www.microsoft.com/` are one lookup.
* A record is charged once per run. When two inputs resolve to the same person or company, the second row comes back with `charged: false` and `duplicate_of`.
* The Actor stops looking records up when the next match wouldn't fit under the run's maximum charge. The status message says how many records were left, so you can raise the limit and run the rest.

## Running from Code

<CodeGroup>
  ```python Python theme={null}
  import os

  from apify_client import ApifyClient

  client = ApifyClient(os.environ["APIFY_TOKEN"])

  run = client.actor("datalegion/data-legion-enrichment").call(
      run_input={
          "product": "company_base",
          "domains": ["hubspot.com", "atlassian.com", "dropbox.com"],
      },
      max_total_charge_usd=1,
  )

  for row in client.dataset(run.default_dataset_id).list_items().items:
      if row["status"] == "matched":
          print(row["company"]["domain"], row["company"].get("industry"))
  ```

  ```javascript JavaScript theme={null}
  import { ApifyClient } from "apify-client";

  const client = new ApifyClient({ token: process.env.APIFY_TOKEN });

  const run = await client.actor("datalegion/data-legion-enrichment").call(
    {
      product: "company_base",
      domains: ["hubspot.com", "atlassian.com", "dropbox.com"],
    },
    { maxTotalChargeUsd: 1 },
  );

  const { items } = await client.dataset(run.defaultDatasetId).listItems();
  for (const row of items) {
    if (row.status === "matched") {
      console.log(row.company.domain, row.company.industry);
    }
  }
  ```
</CodeGroup>

Apify schedules, webhooks, and integrations such as Google Sheets and Zapier work with the Actor like any other.

## Running from an Agent

Apify's [MCP server](https://mcp.apify.com) lets assistants such as Claude search the Apify Store and call Actors as tools, including this one. To connect an assistant to Data Legion directly with a Data Legion API key, use the [Data Legion MCP Server](/docs/integrations/mcp-server).

## The Actor or the Data Legion API

The Actor covers enrichment from a list, with no account or code required. Search, natural-language discovery, real-time enrichment inside your own systems, and bulk delivery are on the [Data Legion API](/docs/api-reference/overview).

## Related

* [Data Legion Enrichment on the Apify Store](https://apify.com/datalegion/data-legion-enrichment)
* [Person Enrichment API](/docs/api-reference/person-enrichment)
* [Company Enrichment API](/docs/api-reference/company-enrichment)
* [Apify API client documentation](https://docs.apify.com/api/client/python)


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