# Washington Contractor License Leads (`yanairon/washington-contractor-leads`) Actor

Washington licensed contractor lead lists from the L\&I registry: construction, electrical, plumbing and elevator contractors with specialties, address, phone and licence expiry. Filter by city, ZIP, status or expiry. Business records only; sole proprietors' personal details removed. Pay per record.

- **URL**: https://apify.com/yanairon/washington-contractor-leads.md
- **Developed by:** [Yanai Ron](https://apify.com/yanairon) (community)
- **Features:** Limited permissions
- **Stats:** 3 total users, 2 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

## Washington Contractor License Leads

Apify Actor that turns the **official Washington State Labor & Industries (L\&I) contractor licence registry** into clean, ready-to-use lead lists.

- **Source:** [L\&I Contractor License Data - General](https://data.wa.gov/d/m8qx-ubtq) (public Socrata open dataset, public domain licence, updated by the state three times a day - no login, no HTML scraping).
- **Who it's for:** insurance agents, warranty providers, tool and material suppliers, software vendors and service businesses that sell to licensed contractors.

### What it does

1. Pulls the live registry through Washington's Socrata API (default: `ACTIVE` licences).
2. Filters by licence type, status, city, ZIP prefix, state and licence expiry window.
3. Classifies each record as a **business** (corporation, LLC, partnership) or an **individual** (sole proprietor).
4. Cleans and dedupes: one record per licence number, ISO dates, computed `daysUntilExpiration`, trade specialties as a list.
5. **Privacy:** sole-proprietor records have address, phone and name removed (they may be residential). Business entities keep their registered address, phone and principal.
6. Filters by licence expiry date to find licences expiring soon.

### Input

| Field | Type | Default | Notes |
| --- | --- | --- | --- |
| `contractorTypes` | array | all | Construction, Electrical, Plumbing, Elevator |
| `statuses` | array | `ACTIVE` | Also EXPIRED, SUSPENDED, RE-LICENSED, OUT OF BUSINESS, INACTIVE |
| `businessOnly` | boolean | `true` | Exclude sole-proprietor registrations |
| `expiringWithinDays` | integer | - | Only licences expiring within N days |
| `city` / `zip` / `state` | string | - | City exact match, ZIP prefix, 2-letter state |
| `mode` | `full` / `delta` | `full` | Experimental: change tracking needs persistent storage and currently treats all matching records as new |
| `deltaDays` | integer | `30` | Expiry window used in delta mode; change tracking is experimental and treats all matching records as new |
| `maxRecords` | integer | `0` (no cap) | |

### Output

One dataset item per licence: `licenceNumber`, `businessName`, `recordType`, `businessType`, `licenceType`, `specialties`, `status`, `effectiveDate`, `expirationDate`, `daysUntilExpiration`, `ubi`, `city`, `state`, `zip`, `address`, `phone`, `principalName`, `isNewSinceLastRun`, `sourceDataset`. Change tracking is experimental and currently treats all matching records as new. `address`, `phone` and `principalName` are present on business records only.

### Run locally

```bash
npm install
node src/run-local.js --types "ELECTRICAL CONTRACTOR" --city SEATTLE --expiring 90 --max 25
npm test
```

### Notes

- About 76k active licences; about 66k are business entities.
- CI runs the unit tests on every push and a live source smoke check every Monday.

# Actor input Schema

## `contractorTypes` (type: `array`):

Limit to these L\&I contractor licence types. Leave empty for all.

## `statuses` (type: `array`):

Licence statuses to include. Default is ACTIVE only.

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

Keep only business entities (corporations, LLCs, partnerships). Sole-proprietor 'Individual' registrations are excluded. Recommended for lead generation.

## `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. SEATTLE). Optional.

## `zip` (type: `string`):

Filter by ZIP code prefix (e.g. 980 or 98101). Optional.

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

Filter by the licensee's state (2-letter code). Many WA licensees are out of state; leave empty for all, use WA for Washington 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
{
  "contractorTypes": [],
  "statuses": [
    "ACTIVE"
  ],
  "businessOnly": true,
  "expiringWithinDays": null,
  "city": "",
  "zip": "",
  "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/washington-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/washington-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/washington-contractor-leads --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,yanairon/washington-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/DxkTnRy4zPjpBl1TA/builds/IdssQD6GFirTYfkmm/openapi.json
