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

# Search People by Company

> Search for people at a specific company with pagination support

Search for people (contacts/employees) at a specific company using the Lance database. Results are automatically mapped and upserted to the database for future reference.

## Authentication

This endpoint requires authentication. The user must be logged in.

<Note>
  The search prioritizes company matching in this order: LinkedIn URL, domain,
  then company name. Companies must have at least one of these identifiers to be
  searchable.
</Note>

## Request

### Path Parameters

<ParamField path="id" type="string" required>
  The unique identifier (UUID) of the company to search people for.
</ParamField>

### Query Parameters

<ParamField query="page" type="integer" default={0}>
  Page number for pagination (0-indexed). Values less than 0 are normalized to
  0\.
</ParamField>

<ParamField query="size" type="integer" default={25}>
  Number of results per page. Must be between 1 and 100. Values outside this
  range are clamped to the nearest valid value.
</ParamField>

## Response

<ResponseField name="content" type="Person[]">
  Array of person objects found at the company.

  <Expandable title="Person object properties">
    <ResponseField name="id" type="string" required>
      Unique identifier (UUID) for the person.
    </ResponseField>

    <ResponseField name="createdAt" type="string">
      ISO 8601 timestamp when the person record was created. Can be null.
    </ResponseField>

    <ResponseField name="updatedAt" type="string">
      ISO 8601 timestamp when the person record was last updated. Can be null.
    </ResponseField>

    <ResponseField name="firstName" type="string" required>
      Person's first name.
    </ResponseField>

    <ResponseField name="lastName" type="string" required>
      Person's last name.
    </ResponseField>

    <ResponseField name="jobTitle" type="string">
      Current job title/position. Can be null.
    </ResponseField>

    <ResponseField name="city" type="string">
      City of residence/work. Can be null.
    </ResponseField>

    <ResponseField name="postalCode" type="string">
      Postal/zip code. Can be null.
    </ResponseField>

    <ResponseField name="country" type="string">
      Country of residence/work. Can be null.
    </ResponseField>

    <ResponseField name="linkedinUrl" type="string">
      LinkedIn profile URL (normalized to [https://www.linkedin.com](https://www.linkedin.com) format). Can be null.
    </ResponseField>

    <ResponseField name="phones" type="string[]">
      Array of phone numbers. Defaults to empty array.
    </ResponseField>

    <ResponseField name="emails" type="string[]">
      Array of email addresses (lowercased). Defaults to empty array.
    </ResponseField>

    <ResponseField name="companyId" type="string">
      UUID of the associated company (matches the requested company ID).
    </ResponseField>

    <ResponseField name="seniority" type="string">
      Seniority level (e.g., "Senior", "Manager", "Director"). Can be null.
    </ResponseField>

    <ResponseField name="industry" type="string">
      Industry classification. Can be null.
    </ResponseField>

    <ResponseField name="birthDate" type="string">
      ISO 8601 date of birth. Can be null.
    </ResponseField>

    <ResponseField name="departments" type="string[]">
      Array of department names. Defaults to empty array.
    </ResponseField>

    <ResponseField name="subDepartments" type="string[]">
      Array of sub-department names. Defaults to empty array.
    </ResponseField>

    <ResponseField name="functions" type="string[]">
      Array of job functions. Defaults to empty array.
    </ResponseField>

    <ResponseField name="skills" type="string[]">
      Array of professional skills. Defaults to empty array.
    </ResponseField>

    <ResponseField name="languages" type="array">
      Array of language proficiencies. Defaults to empty array.

      <Expandable title="Language object properties">
        <ResponseField name="language" type="string">
          Language name (e.g., "English", "German"). Can be null.
        </ResponseField>

        <ResponseField name="level" type="string">
          Proficiency level (e.g., "Native", "Fluent"). Can be null.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="educations" type="array">
      Array of education records. Defaults to empty array.

      <Expandable title="Education object properties">
        <ResponseField name="institution" type="object">
          Educational institution details.

          <Expandable title="Institution properties">
            <ResponseField name="id" type="string">Institution ID. Can be null.</ResponseField>
            <ResponseField name="name" type="string">Institution name. Can be null.</ResponseField>
            <ResponseField name="logoUrl" type="string">Logo URL. Can be null.</ResponseField>
            <ResponseField name="linkedinUrl" type="string">LinkedIn URL. Can be null.</ResponseField>
          </Expandable>
        </ResponseField>

        <ResponseField name="degreeName" type="string">Degree name (e.g., "Bachelor of Science"). Can be null.</ResponseField>
        <ResponseField name="fieldOfStudy" type="string">Field of study (e.g., "Computer Science"). Can be null.</ResponseField>
        <ResponseField name="grade" type="string">Grade or GPA. Can be null.</ResponseField>

        <ResponseField name="dates" type="object">
          Start and end dates with `start` and `end` as string dates. Can be null.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="workExperiences" type="array">
      Array of work experience records. Defaults to empty array.

      <Expandable title="Work Experience object properties">
        <ResponseField name="company" type="object">
          Company information. Can be null.

          <Expandable title="Company properties">
            <ResponseField name="id" type="string">Company ID. Can be null.</ResponseField>
            <ResponseField name="name" type="string">Company name. Can be null.</ResponseField>
            <ResponseField name="logoUrl" type="string">Logo URL. Can be null.</ResponseField>
            <ResponseField name="linkedinUrl" type="string">LinkedIn URL. Can be null.</ResponseField>
            <ResponseField name="employees" type="object">Employee count range with `start` and `end`. Can be null.</ResponseField>
          </Expandable>
        </ResponseField>

        <ResponseField name="dates" type="object">
          Employment dates with `start` and `end` as string dates. Can be null.
        </ResponseField>

        <ResponseField name="profilePositions" type="array">
          Array of positions held at the company. Can be null.

          <Expandable title="Position properties">
            <ResponseField name="company" type="string">Company name. Can be null.</ResponseField>
            <ResponseField name="description" type="string">Position description. Can be null.</ResponseField>
            <ResponseField name="title" type="string">Job title. Can be null.</ResponseField>
            <ResponseField name="employmentType" type="string">Employment type (Full-time, Part-time, etc.). Can be null.</ResponseField>
            <ResponseField name="location" type="string">Work location. Can be null.</ResponseField>
            <ResponseField name="dates" type="object">Position dates. Can be null.</ResponseField>
          </Expandable>
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="certificates" type="array">
      Array of professional certificates. Defaults to empty array.

      <Expandable title="Certificate object properties">
        <ResponseField name="name" type="string">Certificate name. Can be null.</ResponseField>
        <ResponseField name="authority" type="string">Issuing authority. Can be null.</ResponseField>
        <ResponseField name="url" type="string">Certificate URL. Can be null.</ResponseField>
        <ResponseField name="license_number" type="string">License number. Can be null.</ResponseField>
        <ResponseField name="display_source" type="string">Display source. Can be null.</ResponseField>
        <ResponseField name="date" type="object">Issue and expiry dates. Can be null.</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="linkedinProfile" type="object">
      LinkedIn profile information. Can be null.

      <Expandable title="LinkedIn Profile properties">
        <ResponseField name="headline" type="string">LinkedIn headline. Can be null.</ResponseField>
        <ResponseField name="summary" type="string">LinkedIn summary/about section. Can be null.</ResponseField>
        <ResponseField name="pictureUrl" type="string">Profile picture URL. Can be null.</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="baseProviderId" type="string">
      Internal provider indentifier. Can be null.
    </ResponseField>

    <ResponseField name="bullhornId" type="integer">
      Bullhorn CRM identifier. Can be null.
    </ResponseField>

    <ResponseField name="crmId" type="string">
      Generic CRM identifier. Can be null.
    </ResponseField>

    <ResponseField name="leadOwnerId" type="string">
      ID of the user who owns this lead. Can be null.
    </ResponseField>

    <ResponseField name="consentStatus" type="string">
      GDPR consent status. Values: `UNKNOWN`, `OPTOUT`. Defaults to `UNKNOWN`.
    </ResponseField>

    <ResponseField name="consentSource" type="string">
      Source of consent information. Can be null.
    </ResponseField>

    <ResponseField name="consentUpdatedAt" type="string">
      ISO 8601 timestamp when consent was last updated. Can be null.
    </ResponseField>

    <ResponseField name="deletedAt" type="string">
      ISO 8601 timestamp when the person was soft-deleted. Null if active.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="totalElements" type="integer">
  Total number of people matching the search criteria across all pages.
</ResponseField>

<ResponseField name="totalPages" type="integer">
  Total number of pages available based on size parameter.
</ResponseField>

<ResponseField name="page" type="integer">
  Current page number (0-indexed).
</ResponseField>

<ResponseField name="size" type="integer">
  Number of results per page.
</ResponseField>

## Examples

<RequestExample>
  ```bash Basic Search theme={null}
  curl -X GET "https://api.lance.app/api/v1/entities/prospects/company/550e8400-e29b-41d4-a716-446655440000/people/search" \
    -H "Authorization: Bearer <token>"
  ```

  ```bash With Pagination theme={null}
  curl -X GET "https://api.lance.app/api/v1/entities/prospects/company/550e8400-e29b-41d4-a716-446655440000/people/search?page=0&size=50" \
    -H "Authorization: Bearer <token>"
  ```

  ```bash Page Through Results theme={null}
  curl -X GET "https://api.lance.app/api/v1/entities/prospects/company/550e8400-e29b-41d4-a716-446655440000/people/search?page=2&size=25" \
    -H "Authorization: Bearer <token>"
  ```
</RequestExample>

<ResponseExample>
  ```json Success Response theme={null}
  {
    "content": [
      {
        "id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
        "createdAt": "2024-01-15T10:30:00.000Z",
        "updatedAt": "2024-01-15T10:30:00.000Z",
        "firstName": "Jane",
        "lastName": "Smith",
        "jobTitle": "VP of Engineering",
        "city": "San Francisco",
        "postalCode": "94105",
        "country": "United States",
        "linkedinUrl": "https://www.linkedin.com/in/janesmith",
        "phones": ["+1-555-987-6543"],
        "emails": ["jane.smith@acmetech.com"],
        "companyId": "550e8400-e29b-41d4-a716-446655440000",
        "seniority": "VP",
        "industry": "Software Development",
        "birthDate": null,
        "departments": ["Engineering"],
        "subDepartments": ["Platform"],
        "functions": ["Engineering Management"],
        "skills": ["Leadership", "Software Architecture", "Team Building"],
        "languages": [
          { "language": "English", "level": "Native" },
          { "language": "Spanish", "level": "Professional" }
        ],
        "educations": [
          {
            "institution": {
              "id": null,
              "name": "Stanford University",
              "logoUrl": "https://media.licdn.com/school/stanford.png",
              "linkedinUrl": "https://www.linkedin.com/school/stanford-university"
            },
            "degreeName": "Master of Science",
            "fieldOfStudy": "Computer Science",
            "grade": null,
            "dates": { "start": "2008", "end": "2010" }
          }
        ],
        "workExperiences": [
          {
            "company": {
              "id": null,
              "name": "Acme Technologies",
              "logoUrl": "https://media.licdn.com/company/acme.png",
              "linkedinUrl": "https://www.linkedin.com/company/acme-technologies",
              "employees": { "start": "201", "end": "500" }
            },
            "dates": { "start": "2020-01", "end": null },
            "profilePositions": [
              {
                "company": "Acme Technologies",
                "description": "Leading the engineering organization...",
                "title": "VP of Engineering",
                "employmentType": "Full-time",
                "location": "San Francisco, CA",
                "dates": { "start": "2020-01", "end": null }
              }
            ]
          }
        ],
        "certificates": [],
        "linkedinProfile": {
          "headline": "VP of Engineering at Acme Technologies | Building the future of enterprise software",
          "summary": "Passionate engineering leader with 15+ years of experience...",
          "pictureUrl": "https://media.licdn.com/profile/janesmith.jpg"
        },
        "baseProviderId": "ark_person_789012",
        "bullhornId": null,
        "crmId": null,
        "leadOwnerId": null,
        "consentStatus": "UNKNOWN",
        "consentSource": null,
        "consentUpdatedAt": null,
        "deletedAt": null
      }
    ],
    "totalElements": 156,
    "totalPages": 7,
    "page": 0,
    "size": 25
  }
  ```

  ```json Empty Response theme={null}
  {
    "content": [],
    "totalElements": 0,
    "totalPages": 0,
    "page": 0,
    "size": 25
  }
  ```
</ResponseExample>

## Error Responses

<ResponseField name="404 Not Found">
  Returned when the specified company does not exist in the database.

  ```json theme={null}
  {
    "error": {
      "code": "NOT_FOUND",
      "message": "Company 550e8400-e29b-41d4-a716-446655440000 not found"
    }
  }
  ```
</ResponseField>

<ResponseField name="400 Bad Request">
  Returned when the company exists but lacks sufficient data for searching (missing LinkedIn URL, domain, and company name).

  ```json theme={null}
  {
    "error": {
      "code": "VALIDATION_ERROR",
      "message": "Company cannot be searched in our database: missing LinkedIn URL, domain, and name"
    }
  }
  ```
</ResponseField>

## Search Strategy

The endpoint uses a prioritized search strategy to find people at a company:

1. **LinkedIn URL** (most reliable): If the company has a LinkedIn company page URL, it is used as the primary filter.

2. **Domain** (good fallback): If no LinkedIn URL is available, the company's domain is used to match people.

3. **Company Name** (last resort): If neither LinkedIn URL nor domain is available, the company name is used. This may have more false positives as company names are not unique.

<Info>
  Results are automatically upserted to the database. Existing person records
  are updated with new data, and new persons are created with fresh UUIDs.
</Info>

## Performance Notes

This endpoint is optimized for performance:

* Batch fetches existing persons in a single database query
* Uses synchronous mapping instead of N+1 database lookups
* Bulk upserts all persons in one operation

For large result sets, use pagination to avoid memory issues and improve response times.
