# Oregon Contractor License Leads (`yanairon/oregon-contractor-license-leads`) Actor

Oregon contractor business licence data from the official state registry. Filter by trade, city, county or expiry date, including licences expiring soon. No phone or email data.

- **URL**: https://apify.com/yanairon/oregon-contractor-license-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

## Oregon Contractor License Leads

Apify Actor that turns the **official Oregon Building Codes Division contractor licence registry** into clean, ready-to-use **contractor leads** (lead generation lists with trade names, DBAs, business addresses and licence expiry dates).

- **Source:** [Building Codes Division - Active Contractor/Individual Licenses](https://data.oregon.gov/business/Building-Codes-Division-Active-Contractor-Individu/vhbr-cuaq) (public Socrata open dataset, ~45k active licences, updated by the state - no login, no scraping of HTML).
- **Who it's for:** insurance agents, warranty providers, tool/material suppliers, software vendors and service businesses that sell to licensed contractors.

### What it does

1. Pulls the live registry through Oregon's Socrata API (`lic_status = Active`).
2. Filters by trade, city, county, state and licence expiry window.
3. Classifies each record as a **business** or **individual** licence.
4. Cleans and dedupes: one record per licence number, DBA preferred as the business name, expiry normalized to ISO date with a computed `daysUntilExpiration`.
5. **Privacy:** individual records (journeymen, inspectors, trainees) have their street address removed; business records keep the published business address.
6. Filters by licence expiry date to find licences expiring soon.

### Input

| Field | Type | Default | Notes |
| --- | --- | --- | --- |
| `professions` | array | all | Electrical, Plumbing, Boiler, Certification, RV & Manufactured Dwellings, Prefab, Combo License, Elevator |
| `businessOnly` | boolean | `true` | Exclude individual certifications |
| `expiringWithinDays` | integer | - | Only licences expiring within N days |
| `city` / `county` / `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 licence:

```json
{
  "licenceNumber": "1875PB",
  "businessName": "ACME ROOTER",
  "registrantName": "ACME PLUMBING INC",
  "dba": "ACME ROOTER",
  "trade": "Plumbing",
  "licenceType": "PB-Plumbing Contractor",
  "recordType": "business",
  "status": "Active",
  "expirationDate": "2026-12-01",
  "daysUntilExpiration": 53,
  "address": "123 MAIN ST",
  "city": "PORTLAND",
  "state": "OR",
  "zip": "97201",
  "county": "MULTNOMAH",
  "isNewSinceLastRun": false,
  "sourceDataset": "Oregon Building Codes Division - Active Contractor/Individual Licenses"
}
```

`address` is present on business records only.

### Data quirks worth knowing

- `lic_status` is `Active` for every row - the registry only lists active licences, so "status" filtering is really about the expiry window.
- `expiration_date` is a text field (`M/D/YYYY`); ~8,400 rows have none. Date filtering happens in the Actor, not in SoQL.
- The registry includes out-of-state licensees (~35k of ~45k rows are OR addresses). Use the `state` filter if you only want Oregon addresses.
- \~1,000 of 45k rows carry a DBA; when present it becomes `businessName`.
- No phone/email in this dataset - the registry doesn't publish them.

### Run locally

```bash
npm install
node src/run-local.js --professions Plumbing --state OR --expiring 90 --max 25
npm test
```

### Delta details

Delta mode is experimental. Change tracking needs persistent storage and currently treats all records as new under the Actor's default permissions. Filter by licence expiry date to find licences expiring soon.

### Keywords

Oregon contractor leads, contractor lead generation, licensed contractor list, contractor license database, electrical contractor leads, plumbing contractor leads, trade names (DBA), Oregon Building Codes Division, CCB-style contractor lists, B2B leads for the construction trades.

# Actor input Schema

## `professions` (type: `array`):

Limit results to these trades. Leave empty for all trades.

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

Keep only business licences (contractors, companies). Individual certifications (journeymen, inspectors, trainees) 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. PORTLAND). Optional.

## `county` (type: `string`):

Filter by county (case-insensitive exact match, e.g. MULTNOMAH). Optional.

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

Filter by the licensee's state (2-letter code). The registry includes out-of-state licensees; leave empty for all, use OR for Oregon 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.

## Actor input object example

```json
{
  "professions": [],
  "businessOnly": true,
  "expiringWithinDays": null,
  "city": "",
  "county": "",
  "state": "",
  "mode": "full",
  "deltaDays": 30,
  "maxRecords": 0
}
```

# 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 = {};

// Run the Actor and wait for it to finish
const run = await client.actor("yanairon/oregon-contractor-license-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 = {}

# Run the Actor and wait for it to finish
run = client.actor("yanairon/oregon-contractor-license-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 '{}' |
apify call yanairon/oregon-contractor-license-leads --silent --output-dataset

```

## MCP server setup

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