# California CSLB Contractor Scraper (`codingfrontend/cslb-california-scraper`) Actor

Scrape public California Contractors State License Board records by license number or supplied CSLB result URLs.

- **URL**: https://apify.com/codingfrontend/cslb-california-scraper.md
- **Developed by:** [Coding Frontned](https://apify.com/codingfrontend) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 96.4% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $3.99 / 1,000 results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

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

### What this Actor does

This Actor looks up publicly available California contractor license records from the [Contractors State License Board (CSLB)](https://www.cslb.ca.gov/). Enter exact license numbers, supply public CSLB page URLs, or combine both. Each page can produce at most one contractor record; the Actor does not expand result lists or paginate city, ZIP code, or classification searches.

The records can help with contractor license checks, business directory updates, and licensing research. The Actor reads public pages and does not bypass access challenges, CAPTCHAs, or rate limits.

For an exact license lookup, the Actor submits CSLB's public search form and opens the resulting license detail page in the same session. It collects the business address and phone, entity type, license status and dates, classifications, bonding information, workers' compensation, and notices when shown. Bond and insurance history links are included when available; the linked history pages are not collected separately.

### How to run it

1. Open the Actor and select the **Input** tab.
2. Enter one or more license numbers, add public CSLB URLs, or use both fields. At least one valid lookup target is needed.
3. Adjust the optional limits if needed, then select **Start**.
4. When the run finishes, open **Results** for contractor records. Use **Output summary** to see the run status and saved-record count.
5. You can download the dataset in various formats such as JSON, HTML, CSV, or Excel.

### Input fields

The schema marks each field as optional. At run time, provide at least one license number or CSLB page URL; an empty input, or an input that produces no valid records, ends as a failed run.

#### Lookup targets

| Field | Type | Required? | Default | What it does |
| --- | --- | --- | --- | --- |
| `licenseNumbers` | Array of text | Optional; one source field is required at run time | `[]` | Exact California license numbers, each 1 to 8 digits. Repeated numbers are removed. |
| `startUrls` | Array of objects with a `url` field | Optional; one source field is required at run time | `[]` | Public HTTPS pages on `cslb.ca.gov` or `www.cslb.ca.gov`. Each URL is inspected as one page and may produce at most one record. |

When both fields are supplied, the Actor processes the URL list first and then the generated license-number lookups. Exact duplicate URLs are removed, and duplicate license records are saved once. A search results page is not expanded into every result.

#### Advanced settings (Developer Options)

| Field | Type | Required? | Default | What it does |
| --- | --- | --- | --- | --- |
| `maxItems` | Integer | Optional | `25` | Maximum number of lookup pages and records to process. Bounds: `1` to `250`. |
| `requestDelayMs` | Integer | Optional | `150` | Wait time between lookup pages in milliseconds. Bounds: `0` to `5000`. |
| `timeoutSecs` | Integer | Optional | `30` | Timeout for each CSLB request in seconds. Bounds: `5` to `120`. A license-number lookup can make more than one request. |
| `maxRetries` | Integer | Optional | `1` | Retries for transient timeouts or upstream server errors. Bounds: `0` to `3`. Access challenges and rate-limit responses are not retried. |

The Actor does not support business-name searches, custom filters, sorting, pagination controls, or alternate field names. If a lookup page is empty, blocked, or cannot be parsed, it does not create a placeholder row.

### Copyable input examples

#### Look up exact license numbers

```json
{
  "licenseNumbers": ["1234567", "7654321"],
  "maxItems": 2
}
```

#### Use multiple public CSLB URLs and an exact number

```json
{
  "startUrls": [
    { "url": "https://www.cslb.ca.gov/OnlineServices/CheckLicenseII/LicenseDetail.aspx?LicNum=1234567" },
    { "url": "https://www.cslb.ca.gov/OnlineServices/CheckLicenseII/LicenseDetail.aspx?LicNum=7654321" }
  ],
  "licenseNumbers": ["1234567"],
  "maxItems": 3
}
```

The repeated license may be requested through both input fields, but its business record is saved once.

#### Set request pacing and retry limits

```json
{
  "licenseNumbers": ["1234567"],
  "maxItems": 1,
  "requestDelayMs": 500,
  "timeoutSecs": 45,
  "maxRetries": 2
}
```

### Output fields

Each dataset item is a CSLB business record. Only the three identity fields below are required; other fields are omitted when the source does not provide a usable value.

| Field | Type | Required? | Meaning |
| --- | --- | --- | --- |
| `licenseNumber` | Text | Required | California contractor license number. |
| `businessName` | Text | Required | Business name listed on the CSLB record. |
| `address` | Object | Optional | Public address components: `line1`, `line2`, `city`, `state`, and `postalCode`. Each component is optional. |
| `businessPhone` | Text | Optional | Public business phone number. |
| `entityType` | Text | Optional | Business entity type displayed by CSLB. |
| `licenseStatus` | Text | Optional | License status displayed by CSLB. |
| `additionalStatus` | Array of text | Optional | Additional license status notices. |
| `classifications` | Array of objects | Optional | Classification entries with `code`, `name`, and official CSLB `url` when present. |
| `issueDate` | Date text | Optional | License issue date in `YYYY-MM-DD` format. |
| `expirationDate` | Date text | Optional | License expiration date in `YYYY-MM-DD` format. |
| `bonding` | Object | Optional | `contractor` bond details and `qualifyingIndividual` bond status or dates, when listed. |
| `workersCompensation` | Object | Optional | Status, effective/cancellation/expiration dates, non-date expiration text, and history URL when available. A date and non-date expiration value are alternatives. |
| `miscellaneousActions` | Array of text | Optional | Miscellaneous action notices on the license record. |
| `detailUrl` | URL text | Required | Official CSLB license detail page for the record. |
| `sourceCurrentAsOf` | Text | Optional | Current-as-of text shown by CSLB on the source record. This is source text, not the Actor's scrape time. |

Every nested field is optional. The `bonding.contractor` object can include `suretyName`, `bondNumber`, `amount`, `currency`, `effectiveDate`, `cancellationDate`, and `historyUrl`. The `bonding.qualifyingIndividual` object can include `status`, `effectiveDate`, and `cancellationDate`. Workers’ compensation expiration is returned as `expirationDate` when it parses as a date, or as `expirationStatus` when CSLB displays non-date text.

All date fields use `YYYY-MM-DD` text.

| Field | Type | Required? | Meaning |
| --- | --- | --- | --- |
| `address.line1` | Text | Optional | First address line. |
| `address.line2` | Text | Optional | Additional address line. |
| `address.city` | Text | Optional | City. |
| `address.state` | Text | Optional | State or territory abbreviation. |
| `address.postalCode` | Text | Optional | Postal code. |
| `classifications[].code` | Text | Optional | CSLB classification code. |
| `classifications[].name` | Text | Optional | Classification name. |
| `classifications[].url` | URL text | Optional | Official CSLB classification details link. |
| `bonding.contractor.suretyName` | Text | Optional | Contractor bond surety company. |
| `bonding.contractor.bondNumber` | Text | Optional | Contractor bond number. |
| `bonding.contractor.amount` | Number | Optional | Parsed bond amount. |
| `bonding.contractor.currency` | Text | Optional | Currency inferred from the amount symbol (`USD`, `EUR`, or `GBP`). |
| `bonding.contractor.effectiveDate` | Date text | Optional | Contractor bond effective date. |
| `bonding.contractor.cancellationDate` | Date text | Optional | Contractor bond cancellation date. |
| `bonding.contractor.historyUrl` | URL text | Optional | CSLB contractor bond history link. |
| `bonding.qualifyingIndividual.status` | Text | Optional | Qualifying individual bond status text. |
| `bonding.qualifyingIndividual.effectiveDate` | Date text | Optional | Qualifying individual bond effective date. |
| `bonding.qualifyingIndividual.cancellationDate` | Date text | Optional | Qualifying individual bond cancellation date. |
| `workersCompensation.status` | Text | Optional | Workers’ compensation status text. |
| `workersCompensation.effectiveDate` | Date text | Optional | Coverage effective date. |
| `workersCompensation.cancellationDate` | Date text | Optional | Coverage cancellation date. |
| `workersCompensation.expirationDate` | Date text | Optional | Expiration date when the source value is a date. |
| `workersCompensation.expirationStatus` | Text | Optional | Non-date expiration text, used instead of `expirationDate`. |
| `workersCompensation.historyUrl` | URL text | Optional | CSLB workers’ compensation history link. |

#### Illustrative dataset items

The values and links below are illustrative and are not verified live CSLB results. The second item shows the alternate non-date workers’ compensation expiration value; a real workers’ compensation object uses either `expirationDate` or `expirationStatus`. Optional fields may be absent from actual records.

```json
[
{
  "licenseNumber": "1234567",
  "businessName": "Example California Builders LLC",
  "address": {
    "line1": "100 Example Street",
    "line2": "Suite 200",
    "city": "Sacramento",
    "state": "CA",
    "postalCode": "95814"
  },
  "businessPhone": "(916) 555-0100",
  "entityType": "Limited Liability Company",
  "licenseStatus": "Active",
  "additionalStatus": ["Example status notice"],
  "classifications": [
    {
      "code": "B",
      "name": "General Building Contractor",
      "url": "https://www.cslb.ca.gov/About_Us/Library/Licensing_Classifications/Licensing_Classifications_Detail.aspx?Class=B"
    }
  ],
  "issueDate": "2024-01-15",
  "expirationDate": "2027-01-31",
  "bonding": {
    "contractor": {
      "suretyName": "Example Surety Company",
      "bondNumber": "EX-12345",
      "amount": 25000,
      "currency": "USD",
      "effectiveDate": "2025-01-01",
      "cancellationDate": "2026-01-01",
      "historyUrl": "https://www.cslb.ca.gov/OnlineServices/CheckLicenseII/BondingHistory.aspx?LicNum=1234567"
    },
    "qualifyingIndividual": {
      "status": "Example qualifying individual bond status",
      "effectiveDate": "2025-01-01",
      "cancellationDate": "2026-01-01"
    }
  },
  "workersCompensation": {
    "status": "Example coverage status",
    "effectiveDate": "2025-01-01",
    "cancellationDate": "2026-01-01",
    "expirationDate": "2026-12-31",
    "historyUrl": "https://www.cslb.ca.gov/OnlineServices/CheckLicenseII/WCHistory.aspx?LicNum=1234567"
  },
  "miscellaneousActions": ["Example action notice"],
  "detailUrl": "https://www.cslb.ca.gov/OnlineServices/CheckLicenseII/LicenseDetail.aspx?LicNum=1234567",
  "sourceCurrentAsOf": "October 7, 2026"
},
{
  "licenseNumber": "7654321",
  "businessName": "Example Electrical Services Inc",
  "workersCompensation": {
    "status": "Example coverage status",
    "expirationStatus": "No expiration date shown"
  },
  "detailUrl": "https://www.cslb.ca.gov/OnlineServices/CheckLicenseII/LicenseDetail.aspx?LicNum=7654321"
}
]
```

### Run status and output summary

- **Succeeded:** at least one valid contractor record was saved and collection completed normally.
- **Succeeded with limited results:** at least one record was saved, then a later lookup or dataset write failed.
- **Failed:** no real contractor record was saved, including empty, blocked, invalid, or diagnostic-only outcomes.

Reaching the requested `maxItems` limit is normal completion and does not make a run partial by itself.

The separate **Output summary** link opens `OUTPUT_SUMMARY` in the run’s default **Key-value store**. It contains only the status, count of acknowledged dataset writes, and whether collection was partial. It is not a contractor dataset item.

#### Illustrative completed-run summary

```json
{
  "status": "SUCCEEDED",
  "itemsStored": 25,
  "isPartial": false
}
```

| Field | Type | Required? | Meaning |
| --- | --- | --- | --- |
| `status` | Text | Required | `SUCCEEDED` when at least one real record was saved; otherwise `FAILED`. |
| `itemsStored` | Nonnegative integer | Required | Number of valid contractor records whose dataset writes completed. |
| `isPartial` | Boolean | Required | `true` when a later failure stopped collection after real records were saved. |

### Tips, access, cost, and support

- Use exact license numbers for direct lookups. A supplied page URL is treated as one page, so a general search page may not yield a contractor record.
- CSLB availability, page changes, access challenges, and rate limits can affect results. The Actor stops when access is blocked and does not attempt to bypass those controls.
- The Actor does not specify a per-record price. Charges depend on your Apify account plan and run resource use; check the current pricing shown in your Apify Console.
- Use the **API** tab for programmatic access and the Actor’s **Issues** tab for support or feedback.
- CSLB records are public business licensing information. Follow CSLB’s website terms and use the results only for an appropriate purpose.

# Actor input Schema

## `licenseNumbers` (type: `array`):

Exact California contractor license numbers to look up. Provide this field, startUrls, or both.

## `startUrls` (type: `array`):

Public CSLB HTTPS pages to inspect. Each URL is one page and may produce at most one license record; result pages are not expanded or paginated.

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

Maximum number of CSLB pages or records to process, whichever limit is reached first.

## `requestDelayMs` (type: `integer`):

Delay between CSLB page lookups.

## `timeoutSecs` (type: `integer`):

Timeout for each public CSLB request.

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

Maximum retries for transient public CSLB request failures.

## Actor input object example

```json
{
  "licenseNumbers": [],
  "startUrls": [],
  "maxItems": 25,
  "requestDelayMs": 150,
  "timeoutSecs": 30,
  "maxRetries": 1
}
```

# Actor output Schema

## `dataset` (type: `string`):

Business records returned from the CSLB license pages.

## `runSummary` (type: `string`):

Run status and acknowledged record count from the default key-value store.

# 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("codingfrontend/cslb-california-scraper").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("codingfrontend/cslb-california-scraper").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 codingfrontend/cslb-california-scraper --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,codingfrontend/cslb-california-scraper"
        }
    }
}
```

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/phmArlaxlTaoVA3Rn/builds/3UdK0PEmirn5hxPLq/openapi.json
