# Trade License Change Leads (CA CSLB + TX TDLR) (`nanoteki/trade-license-change-leads`) Actor

Delivers daily change signals for newly issued, renewed, expired, and status-changed contractor and trade licenses in California (CSLB) and Texas (TDLR). Output is a clean, validated dataset of lead events ready for enrichment.

- **URL**: https://apify.com/nanoteki/trade-license-change-leads.md
- **Developed by:** [Nano](https://apify.com/nanoteki) (community)
- **Categories:**
- **Stats:** 2 total users, 1 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

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

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
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.
Actors are written with capital "A".

## 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.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Trade License Change Leads (CA CSLB + TX TDLR)

An Apify Actor that delivers **daily change signals** for contractor and trade licenses in
**California (CSLB)** and **Texas (TDLR)**. Every run produces a clean, validated dataset of lead
events covering:

- `newly_issued` — a license that appeared for the first time
- `renewed` — a license whose expiration moved forward
- `status_change` — a license whose status, trade, or business name changed
- `expired` — a license whose expiration fell inside the look-back window

Use it to feed CRMs, enrichment pipelines, and lead-routing workflows for commercial insurers,
bonding agents, construction suppliers, recruiters, and B2B field-service teams.

***

### Input

| Field                | Type                                                      | Default                                                                  | Description                                                                                  |
| -------------------- | --------------------------------------------------------- | ------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------- |
| `states`             | `["CA"\|"TX"]`                                            | `["CA","TX"]`                                                            | States to scan.                                                                              |
| `eventTypes`         | `["newly_issued"\|"renewed"\|"expired"\|"status_change"]` | all four                                                                 | Which event types to emit.                                                                   |
| `daysBack`           | integer                                                   | `1`                                                                      | Look-back window in days for expiration/newly-issued signals.                                |
| `maxItems`           | integer                                                   | *(none)*                                                                 | Optional cap on records returned per state. Useful for smaller test runs.                    |
| `emitBaselineEvents` | boolean                                                   | `false`                                                                  | When `false`, the first run establishes a baseline instead of emitting every license as new. |
| `maxRetries`         | integer                                                   | `4`                                                                      | Maximum retry attempts for failed source requests.                                           |

#### Minimal example

```json
{
  "states": ["TX"],
  "eventTypes": ["newly_issued", "status_change"],
  "daysBack": 1,
  "maxItems": 1000
}
```

#### Full two-state run

```json
{
  "states": ["CA", "TX"],
  "daysBack": 2
}
```

***

### Output

Each dataset item is a validated lead event:

```json
{
  "state": "CA",
  "source": "CSLB",
  "licenseId": "1098452",
  "businessName": "Apex Electrical Solutions LLC",
  "trade": "C-10 Electrical",
  "status": "Active",
  "eventType": "newly_issued",
  "issueDate": "2026-08-11",
  "expirationDate": "2028-08-31",
  "city": "Sacramento",
  "sourceUrl": "https://www.cslb.ca.gov/",
  "observedAt": "2026-08-12T17:34:38Z"
}
```

| Field            | Notes                                                         |
| ---------------- | ------------------------------------------------------------- |
| `state`          | `CA` or `TX`.                                                 |
| `source`         | `CSLB` or `TDLR`.                                             |
| `licenseId`      | Public license number / ID.                                   |
| `businessName`   | Business or licensee name.                                    |
| `trade`          | License type / classification.                                |
| `status`         | License status from the source.                               |
| `eventType`      | One of `newly_issued`, `renewed`, `expired`, `status_change`. |
| `issueDate`      | ISO `YYYY-MM-DD` when available.                              |
| `expirationDate` | ISO `YYYY-MM-DD` when available.                              |
| `city`           | City when available.                                          |
| `sourceUrl`      | Canonical public source URL.                                  |
| `observedAt`     | ISO 8601 UTC timestamp when the run observed the event.       |

***

### Notes

- Public license data can change at any time. Always verify critical decisions against the official
  CSLB or TDLR source.
- This Actor is an independent tool and is not affiliated with, endorsed by, or operated by CSLB,
  TDLR, or the States of California or Texas.
- Use responsibly and in accordance with applicable laws and the source sites’ terms of use.

# Actor input Schema

## `states` (type: `array`):

States to scan. Select one or both.

## `eventTypes` (type: `array`):

Which change events to emit.

## `daysBack` (type: `integer`):

Look-back window in days for expiration-window and newly-issued signals.

## `maxItems` (type: `integer`):

Optional cap on the number of source records fetched per state. Use for bounded dry runs.

## `emitBaselineEvents` (type: `boolean`):

When false, the first snapshot for a state baselines quietly instead of emitting every existing license as newly\_issued.

## `maxRetries` (type: `integer`):

Maximum number of retry attempts for failed source HTTP requests.

## Actor input object example

```json
{
  "states": [
    "CA",
    "TX"
  ],
  "eventTypes": [
    "newly_issued",
    "renewed",
    "expired",
    "status_change"
  ],
  "daysBack": 1,
  "emitBaselineEvents": false,
  "maxRetries": 4
}
```

# Actor output Schema

## `leads` (type: `string`):

Default dataset items containing validated license change events.

# 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("nanoteki/trade-license-change-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("nanoteki/trade-license-change-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 nanoteki/trade-license-change-leads --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,nanoteki/trade-license-change-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/oOhba5bQ8JTt13N87/builds/4ALlUGoa2wQciuPgz/openapi.json
