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

# Clay

> Connect Data Legion's person and company enrichment APIs to Clay using the HTTP API integration. Step-by-step setup for endpoint, authentication, request body, and response mapping.

Connect Data Legion to [Clay](https://www.clay.com) using Clay's [HTTP API integration](https://university.clay.com/docs/http-api-integration-overview). This adds person and company enrichment as a column in any Clay table.

## Prerequisites

* A Clay account with a table that has an email column (for person enrichment) or a domain column (for company enrichment)
* A Data Legion API key

## Person Enrichment Setup

### Add the Enrichment Column

Open your Clay table and click **Add enrichment**. Search for "HTTP API" and select it.

Clay opens a configuration panel. It defaults to the **Generate** tab (AI-assisted setup). For manual configuration, switch to the **Configure** tab.

### Endpoint

Set the method to **POST** and enter the URL:

```text theme={null}
https://api.datalegion.ai/person/enrich
```

See the [Person Enrichment API reference](/docs/api-reference/person-enrichment) for the full list of available fields.

### Headers

| Header         | Value                           |
| -------------- | ------------------------------- |
| `Content-Type` | `application/json`              |
| `API-Key`      | Your Data Legion API key        |
| `User-Agent`   | Your app name (e.g. `Clay/1.0`) |

### Request Body

Select JSON format and enter:

```json theme={null}
{
  "email": "/Email"
}
```

`/Email` is a Clay column reference. It pulls the value from the Email column for each row. If your column has a different name, use that instead (e.g., `"/Work Email"`).

<Note>
  String values in the request body need quotes around the column reference. Clay replaces the reference with the actual cell value at runtime.
</Note>

You can add more input fields to improve match accuracy:

```json theme={null}
{
  "email": "/Email",
  "first_name": "/First Name",
  "last_name": "/Last Name",
  "company": "/Company",
  "birth_date": "/Birth Date"
}
```

To limit the response to specific fields, add `include_fields` to the body:

```json theme={null}
{
  "email": "/Email",
  "include_fields": "full_name,job_title,seniority_level,company_name,company_size,company_industry,work_email,mobile_phone,linkedin_url,city,state"
}
```

See the [Person Enrichment API reference](/docs/api-reference/person-enrichment) for all supported input fields.

### Response Mapping

The API returns a JSON response:

```json theme={null}
{
  "matches": [
    {
      "person": {
        "full_name": "jane doe",
        "job_title": "senior product manager",
        "seniority_level": "senior",
        "company_name": "tech company",
        "work_email": "jane.doe@techcompany.com",
        "mobile_phone": "+15551234567",
        "linkedin_url": "https://www.linkedin.com/in/janedoe"
      },
      "match_metadata": {
        "matched_on": ["email"],
        "match_type": "exact",
        "match_confidence": "high"
      }
    }
  ],
  "total": 1
}
```

Clay uses dot notation for field paths. Set each field path to return using the `matches.0.person` prefix:

| Field Path                          | Column Name  |
| ----------------------------------- | ------------ |
| `matches.0.person.full_name`        | Full Name    |
| `matches.0.person.job_title`        | Job Title    |
| `matches.0.person.seniority_level`  | Seniority    |
| `matches.0.person.company_name`     | Company      |
| `matches.0.person.company_size`     | Company Size |
| `matches.0.person.company_industry` | Industry     |
| `matches.0.person.city`             | City         |
| `matches.0.person.state`            | State        |
| `matches.0.person.work_email`       | Work Email   |
| `matches.0.person.mobile_phone`     | Phone        |
| `matches.0.person.linkedin_url`     | LinkedIn URL |

### Run

Click **Run** to test on a single row. Verify the mapped columns populate correctly, then run across your full table.

If the email doesn't match any records, the API returns HTTP 404 and Clay leaves the enrichment columns empty for that row.

<Note>
  Use Clay's **conditional runs** (under advanced options) to skip rows where the email column is empty. This avoids unnecessary API calls on incomplete records.
</Note>

## Company Enrichment Setup

The same process works for company enrichment. Use the Company Enrich endpoint:

```text theme={null}
https://api.datalegion.ai/company/enrich
```

The request body takes a domain, name, LinkedIn ID, or ticker symbol. Add `include_fields` to limit the response:

```json theme={null}
{
  "domain": "/Company Domain",
  "include_fields": "name,domain,legion_employee_count,industry"
}
```

Use the `matches.0.company` prefix for field paths (e.g., `matches.0.company.legion_employee_count`, `matches.0.company.industry`).

See the [Company Enrichment API reference](/docs/api-reference/company-enrichment) for all supported input and output fields.

## Using Both on the Same Table

You can run person and company enrichment on the same table. Add two HTTP API columns: one for person enrichment keyed on email, and one for company enrichment keyed on domain.

## AI-Assisted Setup

Clay's Generate tab can configure the integration from a natural language description. Paste something like:

> Use the Data Legion Person Enrich API to look up each person by their email address. The endpoint is `https://api.datalegion.ai/person/enrich`, it uses POST with an API-Key header and a User-Agent header, and the request body should include the email field. Return the person's name, job title, company, seniority level, phone, and LinkedIn URL.

Review the generated configuration before running. Check that column references and field paths are correct.

## Rate Limits

The Data Legion API returns rate limit headers on every response (`RateLimit-Remaining`, `RateLimit-Reset`). Clay has a configurable rate limit setting under advanced options for HTTP API enrichments. Set the rate to stay within your API plan limits when running large tables.

See [Rate Limiting](/docs/api-reference/overview#rate-limiting) for details.

## Related

* [How to Enrich Clay Tables with Data Legion](https://www.datalegion.ai/blog/post/enrich-clay-tables-with-data-legion) (blog guide with extended walkthrough)
* [Person Enrichment API](/docs/api-reference/person-enrichment)
* [Company Enrichment API](/docs/api-reference/company-enrichment)
* [MCP Server](/docs/integrations/mcp-server) for AI assistant integrations
* [Clay HTTP API documentation](https://university.clay.com/docs/http-api-integration-overview)
