# Washington Contractor License Lookup — L\&I Change Alerts (`themartygriffin/pnw-contractor-compliance-monitor`) Actor

Washington contractor license lookup and verification from L\&I open data — new licences, status changes and lapse alerts, plus Oregon.

- **URL**: https://apify.com/themartygriffin/pnw-contractor-compliance-monitor.md
- **Developed by:** [Marty Griffin](https://apify.com/themartygriffin) (community)
- **Categories:** Real estate, Business
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $20.00 / 1,000 licence changes

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

## WA + OR Contractor Licence Changes and Lapse Alerts

Washington and Oregon contractor licences, joined with insurance and bond data, reporting **what changed** and **whose cover is about to lapse**. You store a baseline snapshot, then each `check` returns one record per change since that baseline: a new licence, a status change, an expiry, or insurance or a bond that has newly come within your warning window (or has gone). Unchanged licences are never returned and never charged.

Useful if you vet subcontractors, manage a property portfolio, or broker insurance and surety bonds and want to know who is about to fall out of compliance before a job, a claim or a renewal call makes it obvious.

There is also a plain `lookup` mode for the "is this licence good?" use case: give it licence numbers, get current status, insurer, bond and lapse risk.

> **The valuable signal is the change, not the raw dump.** Both states already publish the full tables for free. What this Actor adds is the join of three Washington tables into one record, a stored baseline, and a diff. If you want a one-off spreadsheet of every licence, download the source datasets directly.

### Modes

| Mode | What it does | Charged |
|---|---|---|
| `refresh` | Downloads the current data for the chosen state(s) and stores it in a **named** key-value store (`pnw-licence-state`; a default store is wiped between runs). Returns one summary record per state. | No |
| `check` | Compares today's data with the stored baseline. One record per change. | `licence-change`, once per changed record |
| `lookup` | Current status and lapse risk for the licence numbers you list. | `licence-lookup`, once per record returned |

Typical schedule: `check` daily (or weekly). A `check` with no stored baseline creates one from today's data and reports the cover already at risk, so no separate `refresh` is needed first. Re-run `refresh` now and then to move the baseline forward, or turn on `advance_snapshot` so each complete check does it for you.

#### Change types

- `new-licence`: in the source today, not in the baseline.
- `status-change`: status differs (for example ACTIVE to SUSPENDED), or a licence that was active has left the source list.
- `expired`: the licence expired since the baseline (status EXPIRED, or its expiry date has passed).
- `lapse-risk`: a live licence's insurance or bond has **newly** entered your `days_to_lapse` window, has expired, has dropped off the record, or a bond has been flagged impaired. Reasons: `insurance_expiring`, `insurance_expired`, `no_insurance_on_file`, `bond_expiring`, `bond_expired`, `no_bond_on_file`, `bond_impaired`.

A lapse-risk record appears when cover **enters** the window, not on every run it stays inside it. A `check` that has to create the baseline is the one exception: it reports the cover already at risk in today's data. After that, an immediate `check` returns nothing even though thousands of licences are already inside the window; this Actor does not produce a standing list of everyone currently at risk. Use `lookup` for named licences.

### Input

`mode`, `states` (WA, OR or both), `licence_numbers` (lookup), `days_to_lapse` (1 to 365, default 30), `change_types`, `licence_types` (WA: CC, EC, PC, LC; OR: CGC1, CGC2, RGC, RSC, CSC1, CSC2, LBPR and others), `counties`, `include_already_reported`, `advance_snapshot`, `max_results`, `snapshot_name`.

Filters apply to `check`. `licence_types` and `counties` are ignored by `lookup`, which returns what you asked for.

### Pricing: what you are charged for

Pay per event:

- **`licence-change`: $0.02** per changed record, once.
- **`licence-lookup`: $0.004** per licence record returned, once for each distinct state of that record (see below).
- `refresh`, summary records, numbers not found and unchanged licences: free.

"Once" is enforced by an account-wide ledger kept in the named store, not by the form flags:

- A change you were already charged for is **never charged again**, whether it is returned again (`include_already_reported`), found again by a later `check` against the same old baseline, or reported under a different `snapshot_name`.
- `include_already_reported` changes the dataset, never the bill. The Start form is prefilled with `lookup` so Apify's automated test always gets records, and repeat runs with the same input are free.
- Ledger and state are saved after every batch, so a crash or migration after charging cannot cause the same record to be charged on retry.
- `max_results` (default 2000) caps **charged** records per run. A run stopped by the cap never advances the baseline, so the rest arrive next run.
- A lookup result is billed again only if the licence's facts changed (status, expiry dates, bond or insurance). Looking up an unchanged licence is free. An Oregon number reused across licence types returns one record per type (for example 100308 returns a CGC2 and an RSC), each billed once.
- If a source returns under half the licences in your baseline, the run stops with an error and charges nothing, rather than reporting thousands of "vanished" licences.

### Sources, licences and attribution

- **Washington:** Department of Labor & Industries contractor licence, insurance and bond datasets on data.wa.gov (`m8qx-ubtq`, `ciwg-agsx`, `bzff-4fmt`). The general and insurance tables are published under the Open Data Commons Public Domain Dedication and License (PDDL); the bond table carries no licence field on its metadata page. Attribution: "Washington State Department of Labor & Industries".
- **Oregon:** Construction Contractors Board "CCB Active Licenses" on data.oregon.gov (`g77e-6bhs`), licensed as Public Domain U.S. Government (terms: https://www.usa.gov/government-works). Attribution: "Oregon Construction Contractors Board".
- This Actor is not affiliated with either agency. Always confirm a licence with the agency before relying on it for a contract.
- No phone numbers, street addresses or individuals' names (principals, RMIs) are returned, only the business name, city and the licence facts.

### How the join works

**Washington:** the licence table has one row per licence number. The insurance table has one row per policy (77k rows for 71k licences) and the bond table one row per bond, including old cancelled ones (177k rows). The Actor groups both by licence number and keeps:

- insurance: the **latest end of cover** across the licence's policies (a cancel date ends a policy early), and the policy count;
- bond: the latest end across bonds (`Until Canceled` counts as no expiry), the count, and whether a still-running bond is flagged impaired.

Using the latest end avoids false alarms when an old and a renewed policy overlap. **Oregon:** one table has the licence, bond and insurance fields side by side. Oregon licence numbers are **not unique**: 1022 is a CGC2, an LBPR, an RGC and an OCHI licence. Records are keyed on number plus type.

### Limitations (read these)

- **Oregon dates are text.** `lic_exp_date`, `bond_exp_date` and `ins_exp_date` are `MM/DD/YYYY` strings, so they cannot be filtered server side. The Actor downloads the Oregon table and parses dates itself.
- **The Washington source has no county column.** A county filter therefore matches Oregon records only; Washington records are excluded while it is set.
- **Washington's insurance table appears to hold only unexpired or recently cancelled policies** (its earliest expiry on the day tested was that same day). So an expired Washington policy shows as `no_insurance_on_file`, not as `insurance_expired`. About 5,400 active Washington licences have no insurance row at all; some licence types may not need it. The Actor reports a *transition* to "none", never the standing state, in `check`.
- **Oregon's dataset lists active licences only.** A licence that leaves it could be expired, lapsed, suspended or revoked; the source does not say which. It is reported as a status change (or `expired` if its expiry date had passed).
- **Source refresh cadence.** The data.wa.gov metadata states the Washington tables are updated three times a day (about 7:30 a.m., 12:15 p.m. and 5:15 p.m.), and data.oregon.gov states "Daily". I read these claims; I did not measure the real update pattern over several days. Treat daily as the useful schedule.
- **Counts differ from raw source counts.** The Actor reports licences, not policy rows, and counts only live (active, unexpired) licences. On 2026-11-12, 3,299 active Washington licences had their latest insurance end inside 30 days, whereas 3,790 policy rows expire in the window (renewal overlaps and one-licence-many-policies account for the gap). 37 active Washington licences had a running, impaired bond; the source holds 314 impaired-bond rows in total, most historical or cancelled.
- A change is reported against the baseline, so a status that goes ACTIVE, SUSPENDED, ACTIVE between two checks may show nothing. A change that reverts and recurs reuses its billing key and is not charged twice.
- Two runs of the same account at the same time can both see a record as new before either saves. Not fixable without a platform lock.
- Insurance and bond fields describe what the agency has on file. They are not proof of current cover and are only as fresh as the agency's last update.

### Performance and memory

Measured locally on live data (2026-11-12): `refresh` of both states took 45 to 66 s; `check` took 42 to 62 s; Washington dominates (about 45 s, 8 page requests of up to 50,000 rows with only the needed columns, 0.3 s between pages). Peak memory was about 280 MB for `refresh` and 410 MB for `check` (baseline and current data are both held), so run it with at least 1024 MB. `lookup` of a handful of numbers takes under 10 s. Throttling (HTTP 429) is handled by waiting and retrying once, then failing with a clear message. Progress is already saved by then.

### Output example

See `sample-output.json`. Records from `check` carry `change_type`, `licence_id`, `state`, `licence_number`, `licence_type`, `business_name`, `status`, `previous_status`, the three expiry dates, `bond_impaired`, `lapse_reasons`, `days_to_lapse`, `detail`, `detected_on`, `baseline_taken_on` and `source`.

# Actor input Schema

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

'refresh' downloads the current Washington and/or Oregon licence, insurance and bond data and stores it as your baseline snapshot (free). 'check' compares today's data with that baseline and returns one record per change (charged). A 'check' with no stored baseline creates the baseline from today's data and returns the cover already at risk: expired insurance or bond, cover expiring within days_to_lapse, missing cover, impaired bond. 'lookup' returns the current status and lapse risk of the licence numbers you list.

## `states` (type: `string`):

Which state(s) to refresh, check or look up.

## `licence_numbers` (type: `array`):

Lookup mode only. Washington numbers look like CASCAAG870N8, Oregon numbers like 100308. An Oregon number can belong to several licence types (the same number is reused across types), and each is returned as its own record. Up to 500.

## `days_to_lapse` (type: `integer`):

Insurance or bond that ends within this many days of today counts as a lapse risk (1 to 365). In 'check' a lapse-risk record appears when cover newly enters this window, not on every run it stays inside it.

## `change_types` (type: `array`):

Check mode only. Any of: new-licence, status-change, expired, lapse-risk. Empty = all four.

## `licence_types` (type: `array`):

Check mode only. Exact type codes. Washington: CC (construction), EC (electrical), PC (plumbing), LC (elevator). Oregon: e.g. CGC1, CGC2, RGC, RSC, CSC1, CSC2, LBPR, RLC. Empty = all.

## `counties` (type: `array`):

Check mode only. Oregon county names, e.g. Multnomah, Lane. The Washington source has no county column, so a county filter returns no Washington records. Empty = all.

## `include_already_reported` (type: `boolean`):

Check mode only. Controls whether changes an earlier run already reported appear in the dataset again. Off (the default): they are left out. On: they are returned again. It never changes what you are charged: a change is billed once, the first time it is reported, and re-reported changes are free.

## `advance_snapshot` (type: `boolean`):

Check mode only. On: after a check that reported everything it found, today's data replaces the baseline. Off (the default): the baseline stays until you run 'refresh'. A run stopped by the maximum cap never advances the baseline.

## `max_results` (type: `integer`):

Safety cap on charged records (never reported before) per run. Unchanged records and records returned again for free do not count. Default 2000. A first check against a fresh snapshot has a large backlog of cover already at risk, so a low cap just defers it to later runs.

## `snapshot_name` (type: `string`):

Name of the saved baseline. Use a different name for each set of filters you schedule. Changes already reported are remembered per name for hiding, but billed once per account whatever the name.

## Actor input object example

```json
{
  "mode": "check",
  "states": "both",
  "licence_numbers": [
    "CASCAAG870N8",
    "CASCABC943L2",
    "100308"
  ],
  "days_to_lapse": 30,
  "include_already_reported": true,
  "advance_snapshot": false,
  "max_results": 2000,
  "snapshot_name": "default"
}
```

# Actor output Schema

## `results` (type: `string`):

No description

# 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 = {
    "mode": "check",
    "states": "both",
    "licence_numbers": [
        "CASCAAG870N8",
        "CASCABC943L2",
        "100308"
    ],
    "days_to_lapse": 30,
    "include_already_reported": true,
    "max_results": 2000,
    "snapshot_name": "default"
};

// Run the Actor and wait for it to finish
const run = await client.actor("themartygriffin/pnw-contractor-compliance-monitor").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 = {
    "mode": "check",
    "states": "both",
    "licence_numbers": [
        "CASCAAG870N8",
        "CASCABC943L2",
        "100308",
    ],
    "days_to_lapse": 30,
    "include_already_reported": True,
    "max_results": 2000,
    "snapshot_name": "default",
}

# Run the Actor and wait for it to finish
run = client.actor("themartygriffin/pnw-contractor-compliance-monitor").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 '{
  "mode": "check",
  "states": "both",
  "licence_numbers": [
    "CASCAAG870N8",
    "CASCABC943L2",
    "100308"
  ],
  "days_to_lapse": 30,
  "include_already_reported": true,
  "max_results": 2000,
  "snapshot_name": "default"
}' |
apify call themartygriffin/pnw-contractor-compliance-monitor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,themartygriffin/pnw-contractor-compliance-monitor"
        }
    }
}
```

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/362gyzfLuWgNGIyQ8/builds/3WLb1Hpkyl7BlFBoO/openapi.json
