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

# Lead lists get leads

## GET /api/v1/public/lead-lists/:id/leads/

Retrieve leads from a specific lead list with optional filtering, sorting, and pagination. Returns prospects for PEOPLE lists or companies for COMPANY lists.

Auth: `X-API-Key`

### Path Parameters

* `id` (integer, required): Lead list ID

### Query Parameters

| Parameter        | Type    | Required | Default | Description                      |
| ---------------- | ------- | -------- | ------- | -------------------------------- |
| `page`           | integer | No       | `1`     | Page number for pagination       |
| `page_size`      | integer | No       | `25`    | Number of results per page       |
| `sort_field`     | string  | No       | `id`    | Field to sort by                 |
| `sort_direction` | string  | No       | `asc`   | Sort direction (`asc` or `desc`) |

You can also add any filter parameters as query strings (e.g., `?job_title=CEO&location=US`).

### Response (People List)

```json theme={null}
{
  "success": true,
  "search_type": "PEOPLE",
  "total_count": 150,
  "page": 1,
  "page_size": 25,
  "prospects": [
    {
      "id": 12345,
      "first_name": "John",
      "last_name": "Doe",
      "email": "john.doe@company.com",
      "phone_number": "+1234567890",
      "linkedin_profile_url": "https://linkedin.com/in/johndoe",
      "job_title": "CEO",
      "location": "San Francisco, CA",
      "headline": "CEO at Tech Company",
      "company": {
        "id": 678,
        "name": "Tech Company",
        "website_url": "https://techcompany.com",
        "linkedin_url": "https://linkedin.com/company/techcompany",
        "industry": "Technology",
        "location": "San Francisco, CA",
        "amount_of_employees": "51-200"
      }
    }
  ]
}
```

### Response (Company List)

```json theme={null}
{
  "success": true,
  "search_type": "COMPANY",
  "total_count": 75,
  "page": 1,
  "page_size": 25,
  "companies": [
    {
      "id": 678,
      "name": "Tech Company",
      "website_url": "https://techcompany.com",
      "linkedin_url": "https://linkedin.com/company/techcompany",
      "logo_url": "https://logo.clearbit.com/techcompany.com",
      "industry": "Technology",
      "location": "San Francisco, CA",
      "amount_of_employees": "51-200",
      "revenue": "$10M-$50M"
    }
  ]
}
```

### Sortable Fields

#### For People Lists

* `id` - Prospect ID
* `first_name` - First name
* `last_name` - Last name
* `job_title` - Job title
* `location` - Location
* `created_at` - Date added to list

#### For Company Lists

* `id` - Company ID
* `name` - Company name
* `industry` - Industry
* `location` - Location
* `amount_of_employees` - Company size
* `revenue` - Revenue

### Error Responses

#### 404 Not Found

```json theme={null}
{
  "error": "Lead list not found"
}
```

### Example Usage

```bash theme={null}
# Get all prospects from a lead list
curl -X GET "https://api.seleqt.ai/api/v1/public/lead-lists/123/leads/?page=1&page_size=25" \
  -H "X-API-Key: <your-api-key>"

# Get prospects with filters and sorting
curl -X GET "https://api.seleqt.ai/api/v1/public/lead-lists/123/leads/?job_title=CEO&sort_field=last_name&sort_direction=asc" \
  -H "X-API-Key: <your-api-key>"

# Get companies from a company list
curl -X GET "https://api.seleqt.ai/api/v1/public/lead-lists/456/leads/?page=1" \
  -H "X-API-Key: <your-api-key>"
```

```python theme={null}
import requests

# Get all leads from a lead list with pagination
response = requests.get(
    "https://api.seleqt.ai/api/v1/public/lead-lists/123/leads/",
    headers={"X-API-Key": "<your-api-key>"},
    params={
        "page": 1,
        "page_size": 50,
        "sort_field": "last_name",
        "sort_direction": "asc"
    }
)

data = response.json()
print(f"Total leads: {data['total_count']}")
print(f"Retrieved {len(data['prospects'])} leads on page {data['page']}")

# Iterate through all pages
all_prospects = []
page = 1
while True:
    response = requests.get(
        f"https://api.seleqt.ai/api/v1/public/lead-lists/123/leads/",
        headers={"X-API-Key": "<your-api-key>"},
        params={"page": page, "page_size": 100}
    )
    data = response.json()
    all_prospects.extend(data["prospects"])

    if len(data["prospects"]) < 100:
        break
    page += 1

print(f"Retrieved all {len(all_prospects)} prospects")
```
