> ## 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 Person Metadata

> Retrieve aggregated metadata statistics about persons, including counts by job title, seniority, and other attributes

Provides metadata statistics. This endpoint returns aggregated counts of persons grouped by various attributes such as job titles, seniority levels, and other person-related classifications. Useful for understanding the composition of your lead database and building analytics dashboards.

## Authentication

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

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

## Request

<ParamField query="size" type="integer" default="25">
  Number of metadata items to return per page.
</ParamField>

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

## Response

Returns an array of metadata items, each containing a key-value pair representing an attribute and its count.

<ResponseField name="response" type="PersonMetadataItem[]">
  Array of metadata key-value pairs.

  <Expandable title="PersonMetadataItem properties">
    <ResponseField name="key" type="string" required>
      The metadata attribute name (e.g., job title, seniority level, department).
    </ResponseField>

    <ResponseField name="value" type="integer" required>
      The count of persons matching this attribute.
    </ResponseField>
  </Expandable>
</ResponseField>

## Response Examples

<ResponseExample>
  ```json 200 - Metadata statistics theme={null}
  [
    {
      "key": "Software Engineer",
      "value": 1542
    },
    {
      "key": "Product Manager",
      "value": 987
    },
    {
      "key": "Data Scientist",
      "value": 654
    },
    {
      "key": "Engineering Manager",
      "value": 432
    },
    {
      "key": "VP of Engineering",
      "value": 156
    }
  ]
  ```

  ```json 200 - Empty results theme={null}
  []
  ```

  ```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

### Get default metadata

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

### Get first page with custom size

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

### Paginate through metadata

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

## Notes

* Results are cached for 7 days to improve performance. The cache is shared across all users in the organization.
* Unlike other autocomplete endpoints that return paginated objects with `content`, this endpoint returns a flat array of key-value pairs.
* Use this endpoint to build analytics dashboards or to understand the distribution of persons by various attributes in your database.
