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

# Search Prospects (Legacy)

> Search for prospects — legacy endpoint. Prefer /v1/prospector/search for full filter support.

<Warning>
  This is a **legacy endpoint**. It accepts the old `query` format but internally forwards to [`/v1/prospector/search`](/api-reference/prospector/search). We recommend using `/v1/prospector/search` directly for access to all 15+ filter types.
</Warning>

## Request

### Headers

```
Authorization: Bearer wbk_your_api_key_here
Content-Type: application/json
```

### Body Parameters

This endpoint accepts either the **new format** (recommended) or the **legacy format**.

#### New Format (recommended)

Uses the same parameters as [`/v1/prospector/search`](/api-reference/prospector/search):

<ParamField body="titles" type="array">
  Job titles to search for (e.g., `["CEO", "General Counsel"]`)
</ParamField>

<ParamField body="location" type="array">
  Person locations (e.g., `["United States", "United Kingdom"]`)
</ParamField>

<ParamField body="industry" type="array">
  Industry filters (e.g., `["Legal Services", "Technology"]`)
</ParamField>

<ParamField body="headcount" type="array">
  Company size ranges (e.g., `["51-200", "201-500"]`)
</ParamField>

<ParamField body="page" type="integer" default="1">
  Page number for pagination
</ParamField>

See [`/v1/prospector/search`](/api-reference/prospector/search) for all available filters including seniority, departments, funding, revenue, company domains, and more.

#### Legacy Format (deprecated)

<ParamField body="query" type="string">
  A search string — will be treated as a job title search.
</ParamField>

<ParamField body="jobTitles" type="array">
  Job titles — mapped to `titles` internally.
</ParamField>

## Response

Same response format as [`/v1/prospector/search`](/api-reference/prospector/search).

<ResponseField name="data" type="object">
  <Expandable title="properties">
    <ResponseField name="results" type="array">
      <Expandable title="Prospect object">
        <ResponseField name="full_name" type="string">Full name</ResponseField>
        <ResponseField name="first_name" type="string">First name</ResponseField>
        <ResponseField name="last_name" type="string">Last name</ResponseField>
        <ResponseField name="job_title" type="string">Job title</ResponseField>
        <ResponseField name="linkedin_url" type="string">LinkedIn URL</ResponseField>
        <ResponseField name="location" type="string">Location</ResponseField>
        <ResponseField name="email_available" type="boolean">Whether email can be revealed</ResponseField>
        <ResponseField name="phone_available" type="boolean">Whether phone can be revealed</ResponseField>
        <ResponseField name="company" type="string">Company name</ResponseField>
        <ResponseField name="company_domain" type="string">Company domain</ResponseField>
        <ResponseField name="company_size" type="string">Company size range</ResponseField>
        <ResponseField name="company_industry" type="string">Company industry</ResponseField>
        <ResponseField name="member_id" type="string">Member ID (use for reveal)</ResponseField>
        <ResponseField name="company_id" type="string">Company ID (use for reveal)</ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="pagination" type="object">
      <Expandable title="properties">
        <ResponseField name="page" type="integer">Current page</ResponseField>
        <ResponseField name="per_page" type="integer">Results per page</ResponseField>
        <ResponseField name="total" type="integer">Total results</ResponseField>
        <ResponseField name="total_pages" type="integer">Total pages</ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

<CodeGroup>
  ```bash cURL (new format) theme={null}
  curl -X POST https://data.leadlex.com/functions/v1/api-gateway/v1/prospects/search \
    -H "Authorization: Bearer wbk_your_api_key_here" \
    -H "Content-Type: application/json" \
    -d '{
      "titles": ["CEO", "Chief Executive Officer"],
      "industry": ["Legal Services"],
      "location": ["United States"],
      "headcount": ["11-50", "51-200"]
    }'
  ```

  ```bash cURL (legacy format) theme={null}
  curl -X POST https://data.leadlex.com/functions/v1/api-gateway/v1/prospects/search \
    -H "Authorization: Bearer wbk_your_api_key_here" \
    -H "Content-Type: application/json" \
    -d '{
      "jobTitles": ["CEO", "Chief Executive Officer"]
    }'
  ```

  ```python Python theme={null}
  import requests

  API_KEY = "wbk_your_api_key_here"
  BASE_URL = "https://data.leadlex.com/functions/v1/api-gateway"

  response = requests.post(f"{BASE_URL}/v1/prospects/search", 
      headers={"Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"},
      json={
          "titles": ["CEO", "General Counsel"],
          "industry": ["Legal Services"],
          "location": ["United States"]
      }
  )
  data = response.json()["data"]
  print(f"Found {data['pagination']['total']} prospects")
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch(
    'https://data.leadlex.com/functions/v1/api-gateway/v1/prospects/search',
    {
      method: 'POST',
      headers: {
        'Authorization': 'Bearer wbk_your_api_key_here',
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        titles: ['CEO', 'General Counsel'],
        industry: ['Legal Services'],
        location: ['United States']
      })
    }
  );
  const { data } = await response.json();
  console.log(`Found ${data.pagination.total} prospects`);
  ```
</CodeGroup>

## Notes

<Tip>
  We recommend migrating to [`/v1/prospector/search`](/api-reference/prospector/search) for full filter support including seniority, departments, company domains, funding stage, and revenue filters.
</Tip>

## Errors

| Status | Code                       | Description                         |
| ------ | -------------------------- | ----------------------------------- |
| 400    | `validation_error`         | No search filters provided          |
| 401    | `invalid_key`              | Invalid API key                     |
| 403    | `insufficient_permissions` | Missing `prospects:read` permission |
| 503    | `service_unavailable`      | Prospector service not configured   |
