> ## 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 enrichment count

## GET /api/v1/public/lead-lists/:id/enrichment/count/

Get the count of prospects that need email or phone enrichment, along with cost estimates and available credits.

Auth: `X-API-Key`

### Path Parameters

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

### Query Parameters

| Parameter         | Type   | Required | Default      | Description                                                               |
| ----------------- | ------ | -------- | ------------ | ------------------------------------------------------------------------- |
| `enrichment_type` | string | No       | `FIND_EMAIL` | Type of enrichment: `FIND_EMAIL`, `FIND_EMAIL_WATERFALL`, or `FIND_PHONE` |
| `sort_field`      | string | No       | `id`         | Field to sort by                                                          |
| `sort_direction`  | string | No       | `asc`        | Sort direction (`asc` or `desc`)                                          |

You can also add filter parameters as query strings.

### Enrichment Types and Costs

| Type                   | Description                                    | Cost per Lead |
| ---------------------- | ---------------------------------------------- | ------------- |
| `FIND_EMAIL`           | Basic email finding                            | 3 credits     |
| `FIND_EMAIL_WATERFALL` | Advanced email finding with multiple providers | 6 credits     |
| `FIND_PHONE`           | Phone number finding                           | 30 credits    |

### Response

```json theme={null}
{
  "success": true,
  "enrichment_type": "FIND_EMAIL",
  "unenriched_count": 150,
  "cost_per_lead": 3,
  "total_cost": 450,
  "available_credits": 1000,
  "has_enough_credits": true
}
```

### Response Fields

| Field                | Type    | Description                                       |
| -------------------- | ------- | ------------------------------------------------- |
| `success`            | boolean | Whether the request was successful                |
| `enrichment_type`    | string  | The enrichment type requested                     |
| `unenriched_count`   | integer | Number of prospects that need enrichment          |
| `cost_per_lead`      | integer | Credits cost per prospect                         |
| `total_cost`         | integer | Total credits needed to enrich all prospects      |
| `available_credits`  | integer | Your current credit balance                       |
| `has_enough_credits` | boolean | Whether you have enough credits for all prospects |

### Notes

* **PEOPLE Lists Only**: Email/phone enrichment is only available for people lists (not company lists)
* **Automatic Filtering**: The endpoint automatically excludes prospects that already have valid emails/phones
* **Credit Check**: Use this endpoint before enriching to ensure you have enough credits

### Error Responses

#### 400 Bad Request

```json theme={null}
{
  "error": "Email/phone enrichment is only available for people lists"
}
```

```json theme={null}
{
  "error": "enrichment_type must be FIND_EMAIL, FIND_EMAIL_WATERFALL, or FIND_PHONE"
}
```

#### 404 Not Found

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

### Example Usage

```bash theme={null}
# Check how many prospects need email enrichment
curl -X GET "https://api.seleqt.ai/api/v1/public/lead-lists/123/enrichment/count/?enrichment_type=FIND_EMAIL" \
  -H "X-API-Key: <your-api-key>"

# Check phone enrichment cost
curl -X GET "https://api.seleqt.ai/api/v1/public/lead-lists/123/enrichment/count/?enrichment_type=FIND_PHONE" \
  -H "X-API-Key: <your-api-key>"
```

```python theme={null}
import requests

API_KEY = "<your-api-key>"
BASE_URL = "https://api.seleqt.ai/api/v1"

# Check email enrichment count and cost
response = requests.get(
    f"{BASE_URL}/public/lead-lists/123/enrichment/count/",
    headers={"X-API-Key": API_KEY},
    params={"enrichment_type": "FIND_EMAIL"}
)

data = response.json()
print(f"Prospects needing enrichment: {data['unenriched_count']}")
print(f"Total cost: {data['total_cost']} credits")
print(f"Available credits: {data['available_credits']}")

if data['has_enough_credits']:
    print("✓ You have enough credits to proceed")
else:
    print("✗ Insufficient credits")

# Check phone enrichment cost
phone_response = requests.get(
    f"{BASE_URL}/public/lead-lists/123/enrichment/count/",
    headers={"X-API-Key": API_KEY},
    params={"enrichment_type": "FIND_PHONE"}
)

phone_data = phone_response.json()
print(f"Phone enrichment would cost: {phone_data['total_cost']} credits")
```

### Workflow Example

```python theme={null}
# Step 1: Check cost before enriching
count_response = requests.get(
    f"{BASE_URL}/public/lead-lists/123/enrichment/count/",
    headers={"X-API-Key": API_KEY},
    params={"enrichment_type": "FIND_EMAIL"}
)

count_data = count_response.json()

# Step 2: Decide whether to proceed based on cost and available credits
if count_data['has_enough_credits']:
    # Step 3: Proceed with enrichment
    enrich_response = requests.post(
        f"{BASE_URL}/public/lead-lists/123/enrichment/",
        headers={"X-API-Key": API_KEY},
        json={
            "enrichment_type": "FIND_EMAIL",
            "prospect_limit": count_data['unenriched_count']
        }
    )

    if enrich_response.json()['success']:
        print(f"Enriching {count_data['unenriched_count']} prospects...")
else:
    print(f"Need {count_data['total_cost']} credits, but only have {count_data['available_credits']}")
    print("Please purchase more credits to continue")
```
