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

# Autocomplete People

> Search and retrieve people suggestions for autocomplete functionality in lead search and filtering

Provides autocomplete suggestions for people/contacts. This endpoint powers the autocomplete functionality when searching for specific people, enabling type-ahead search with names, titles, and profile images.

## Authentication

This endpoint requires authentication. The user must be signed in to access autocomplete data.

<Note>
  This endpoint proxies requests to the people search metadata API. Results are
  cached for 7 days to improve performance.
</Note>

## Request

<ParamField query="search" type="string">
  Search query to filter people. Returns people whose names match this text.
  Leave empty to retrieve all people (paginated).
</ParamField>

<ParamField query="size" type="integer" default="10">
  Number of results to return per page.
</ParamField>

<ParamField query="page" type="integer" default="0">
  Zero-based page number for pagination.
</ParamField>

## Response

Returns a paginated list of people matching the search criteria.

<ResponseField name="content" type="PeopleMetadataItem[]">
  Array of people items matching the query.

  <Expandable title="PeopleMetadataItem properties">
    <ResponseField name="id" type="string" required>
      Unique identifier for the person.
    </ResponseField>

    <ResponseField name="name" type="string" required>
      Full name of the person.
    </ResponseField>

    <ResponseField name="title" type="string">
      Job title or professional headline. Can be null.
    </ResponseField>

    <ResponseField name="logo" type="string">
      URL to the person's profile image. Can be null.
    </ResponseField>

    <ResponseField name="url" type="string">
      URL to the person's profile (e.g., LinkedIn). Can be null.
    </ResponseField>
  </Expandable>
</ResponseField>

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

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

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

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

<ResponseField name="first" type="boolean">
  Whether this is the first page.
</ResponseField>

<ResponseField name="last" type="boolean">
  Whether this is the last page.
</ResponseField>

<ResponseField name="empty" type="boolean">
  Whether the result set is empty.
</ResponseField>

<ResponseField name="numberOfElements" type="integer">
  Number of elements in the current page.
</ResponseField>

## Response Examples

<ResponseExample>
  ```json 200 - People search theme={null}
  {
    "content": [
      {
        "id": "person_001",
        "name": "John Smith",
        "title": "Senior Software Engineer",
        "logo": "https://example.com/profiles/john-smith.jpg",
        "url": "https://linkedin.com/in/johnsmith"
      },
      {
        "id": "person_002",
        "name": "John Doe",
        "title": "Product Manager",
        "logo": "https://example.com/profiles/john-doe.jpg",
        "url": "https://linkedin.com/in/johndoe"
      },
      {
        "id": "person_003",
        "name": "Johnny Wilson",
        "title": "CTO",
        "logo": null,
        "url": "https://linkedin.com/in/johnnywilson"
      }
    ],
    "totalElements": 156,
    "totalPages": 16,
    "size": 10,
    "number": 0,
    "first": true,
    "last": false,
    "empty": false,
    "numberOfElements": 10
  }
  ```

  ```json 200 - Single result theme={null}
  {
    "content": [
      {
        "id": "person_042",
        "name": "Sarah Johnson",
        "title": "VP of Sales",
        "logo": "https://example.com/profiles/sarah-johnson.jpg",
        "url": "https://linkedin.com/in/sarahjohnson"
      }
    ],
    "totalElements": 1,
    "totalPages": 1,
    "size": 10,
    "number": 0,
    "first": true,
    "last": true,
    "empty": false,
    "numberOfElements": 1
  }
  ```

  ```json 200 - Empty results theme={null}
  {
    "content": [],
    "totalElements": 0,
    "totalPages": 0,
    "size": 10,
    "number": 0,
    "first": true,
    "last": true,
    "empty": true,
    "numberOfElements": 0
  }
  ```

  ```json 401 - Unauthorized theme={null}
  {
    "error": {
      "code": "UNAUTHORIZED",
      "message": "Unauthorized"
    }
  }
  ```

  ```json 500 - Server Error theme={null}
  {
    "error": {
      "code": "INTERNAL_ERROR",
      "message": "An unexpected error occurred"
    }
  }
  ```
</ResponseExample>

## Usage Examples

### Search for people by name

```bash theme={null}
curl -X GET "https://api.lance.work/api/v1/operations/autocomplete/people?search=john&size=10" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

### Get all people (first page)

```bash theme={null}
curl -X GET "https://api.lance.work/api/v1/operations/autocomplete/people" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

### Paginate through results

```bash theme={null}
curl -X GET "https://api.lance.work/api/v1/operations/autocomplete/people?page=2&size=25" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

### Search with larger page size

```bash theme={null}
curl -X GET "https://api.lance.work/api/v1/operations/autocomplete/people?search=manager&size=50" \
  -H "Authorization: Bearer YOUR_TOKEN"
```

## Notes

* Results are cached for 7 days to improve performance. The cache is shared across all users.
* Use the `search` parameter for type-ahead/autocomplete functionality - it filters results by name.
* The `logo` field may be null if the person doesn't have a profile image.
* The `url` field typically contains a LinkedIn profile URL but may be null or contain other profile URLs.
* For best autocomplete UX, use a small `size` (10-20) and debounce requests as users type.
