# Connecticut Contractor License Leads (`yanairon/connecticut-contractor-leads`) Actor

Connecticut licensed contractor lead lists from the official state registry: home improvement, new home construction, electrical, plumbing, HVAC and more, with business name, address and licence expiry. Filter by credential type, city or expiry. Business records only. No phone or email in source.

- **URL**: https://apify.com/yanairon/connecticut-contractor-leads.md
- **Developed by:** [Yanai Ron](https://apify.com/yanairon) (community)
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$5.00 / 1,000 contractor licence records

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Connecticut Contractor License Leads

Apify Actor that turns Connecticut's **official state eLicense credential registry** into clean contractor lead lists.

- **Source:** [State Licenses and Credentials](https://data.ct.gov/d/ngch-56tr) (public Socrata open dataset on data.ct.gov, updated daily - no login, no HTML scraping).
- **Who it's for:** insurance agents, warranty providers, suppliers, software vendors and service businesses that sell to licensed contractors.

### What it does

1. Pulls contractor-level credentials only (home improvement, new home construction, major, demolition, electrical, plumbing, heating/piping/cooling, sheet metal, fire protection, pool builders, glass, elevator, solar thermal, medical gas) with current statuses (`ACTIVE`, `ACTIVE IN RENEWAL`).
2. Filters by credential type, city, state and expiry window; drops credentials whose expiry date has passed (switch on `includeExpired` to keep them).
3. Classifies each record as a **business** (LLC, corporation, partnership) or an **individual** (sole proprietor).
4. Cleans and dedupes: one record per credential number, ISO dates, formatted ZIP.
5. **Privacy:** sole-proprietor records have name and street address removed; only the trade name (dba), city, state and ZIP remain.
6. Filters by licence expiry date to find licences expiring soon.

### Input

| Field | Type | Default | Notes |
| --- | --- | --- | --- |
| `credentials` | array | all contractor credentials | e.g. HOME IMPROVEMENT CONTRACTOR |
| `businessOnly` | boolean | `true` | Exclude sole proprietors |
| `includeExpired` | boolean | `false` | Keep credentials past their expiry date |
| `expiringWithinDays` | integer | - | Only credentials expiring within N days |
| `city` / `state` | string | - | Case-insensitive exact match |
| `mode` | `full` / `delta` | `full` | Experimental: change tracking needs persistent storage and currently treats all records as new |
| `deltaDays` | integer | `30` | Expiry window used in delta mode |
| `maxRecords` | integer | `0` (no cap) | |

### Output

One dataset item per credential: `licenceNumber`, `businessName`, `registrantName`, `dba`, `recordType`, `registrantType`, `credential`, `status`, `issueDate`, `expirationDate`, `daysUntilExpiration`, `city`, `state`, `zip`, `address`, `isNewSinceLastRun`, `sourceDataset`. `address` is present on business records only.

### Data quirks

- The dataset has no phone or email.
- Many credential holders are out of state (about 1 in 10 business records); use the `state` filter for CT addresses only.
- About 24k business records are current; roughly 18.6k are home improvement contractors.

### Run locally

```bash
npm install
node src/run-local.js --credentials "HOME IMPROVEMENT CONTRACTOR" --city HARTFORD --max 25
npm test
```

CI runs the unit tests on every push and a live source smoke check every Monday.

# Actor input Schema

## `credentials` (type: `array`):

Limit to these contractor credentials. Leave empty for all contractor credentials.

## `businessOnly` (type: `boolean`):

Keep only business entities (LLCs, corporations, partnerships). Sole-proprietor credentials are excluded and their name/address are never output. Recommended for lead generation.

## `includeExpired` (type: `boolean`):

Include credentials whose expiry date has passed. Off by default: only unexpired credentials are returned.

## `expiringWithinDays` (type: `integer`):

Keep only licences expiring within this many days from today. Leave empty for all active licences.

## `city` (type: `string`):

Filter by city (case-insensitive exact match, e.g. HARTFORD). Optional.

## `state` (type: `string`):

Filter by registrant state (2-letter code). Many CT credential holders are out of state; use CT for Connecticut addresses.

## `mode` (type: `string`):

Experimental: change tracking needs persistent storage and currently treats all records as new.

## `deltaDays` (type: `integer`):

Experimental: change tracking needs persistent storage and currently treats all records as new. Expiry window used in delta mode.

## `maxRecords` (type: `integer`):

Cap the number of output records. 0 = no cap. The example input is 25 so a first test run is quick; set 0 for the full list.

## Actor input object example

```json
{
  "credentials": [],
  "businessOnly": true,
  "includeExpired": false,
  "expiringWithinDays": null,
  "city": "",
  "state": "",
  "mode": "full",
  "deltaDays": 30,
  "maxRecords": 25
}
```

# Actor output Schema

## `records` (type: `string`):

Cleaned licence records matching the input filters, one item per licence.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "maxRecords": 25
};

// Run the Actor and wait for it to finish
const run = await client.actor("yanairon/connecticut-contractor-leads").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "maxRecords": 25 }

# Run the Actor and wait for it to finish
run = client.actor("yanairon/connecticut-contractor-leads").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "maxRecords": 25
}' |
apify call yanairon/connecticut-contractor-leads --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,yanairon/connecticut-contractor-leads"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/1zV61EnfCNDi6gb5h/builds/sn3JGUfzCqlB9o8rk/openapi.json
