{
  "openapi": "3.0.1",
  "info": {
    "title": "California Contractor License Search (CSLB)",
    "description": "California contractor licenses from the Contractors State License Board: 245 927 rows with business phone (99.8%), county (96.6%), trade classification (100%), plus status, dates, bonds and workers-comp coverage. Filter by county, trade class, status or last update. No proxy, no key, no login.",
    "version": "0.9",
    "x-build-id": "SDIKec0XdAfhdKvx2"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/ai-lead-gen-tools~us-ca-cslb/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-ai-lead-gen-tools-us-ca-cslb",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/ai-lead-gen-tools~us-ca-cslb/runs": {
      "post": {
        "operationId": "runs-sync-ai-lead-gen-tools-us-ca-cslb",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/ai-lead-gen-tools~us-ca-cslb/run-sync": {
      "post": {
        "operationId": "run-sync-ai-lead-gen-tools-us-ca-cslb",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "licenseScope": {
            "title": "Export scope",
            "enum": [
              "all",
              "master",
              "personnel"
            ],
            "type": "string",
            "description": "\"all\" is the complete export — 245 927 licenses. \"master\" is the shorter list the portal's own UI leads you to (142 422) and it is MISSING 42% of the active licenses, so it is only useful if you specifically want the same slice the CSLB website offers. \"personnel\" is 155 031 rows. Measured 2026-11-01: master ⊂ personnel ⊂ all.",
            "default": "all"
          },
          "counties": {
            "title": "Counties",
            "type": "array",
            "description": "California counties to keep, e.g. [\"Los Angeles\", \"Orange\"]. Matched case-insensitively against the published county name. 96.6% of records have one. Leave empty for the whole state.",
            "items": {
              "type": "string",
              "minLength": 2,
              "maxLength": 40
            }
          },
          "classifications": {
            "title": "Trade classifications",
            "type": "array",
            "description": "License classes by trade, e.g. [\"B\", \"C10\", \"C36\"]. A record matches when ANY of the classes you list is on its license. Common values: B general building 46 605 records, C10 electrical 11 339, C33 painting 7 295, C36 plumbing 7 180, C27 landscaping 5 456, C20 HVAC 4 833, A general engineering 3 136. Leave empty for all trades.",
            "items": {
              "type": "string",
              "minLength": 1,
              "maxLength": 20
            }
          },
          "activeOnly": {
            "title": "Only licenses in good standing",
            "type": "boolean",
            "description": "Keep only records whose status is CLEAR — 234 021 of 245 927 when measured. Turn this off to get suspended licenses too, or set the status filter explicitly below.",
            "default": true
          },
          "statuses": {
            "title": "License statuses (optional)",
            "type": "array",
            "description": "Exact statuses to keep, overriding the switch above. Published values: CLEAR 234 021, Contr Bond Susp, Work Comp Susp, Liab Ins Susp, Family Sup Susp, Susp - No Qualifier, SOS Suspension, EMP/WK Bnd Susp. Leave empty to let the switch decide.",
            "items": {
              "type": "string",
              "minLength": 3,
              "maxLength": 30
            }
          },
          "businessTypes": {
            "title": "Business types (optional)",
            "type": "array",
            "description": "Published entity types: \"Corporation\" 70 763, \"Sole Owner\" 56 934, \"Limited Liability\" 12 720, \"Partnership\" 1 614, \"JointVenture\" 388. Useful for cutting sole proprietors out of a corporate lead list.",
            "items": {
              "type": "string",
              "minLength": 3,
              "maxLength": 30
            }
          },
          "requiresPhone": {
            "title": "Only records with a phone number",
            "type": "boolean",
            "description": "Skip licenses with no business phone. 99.8% of records have one, so this removes about 240 of 245 927 — worth enabling for a pure calling list.",
            "default": false
          },
          "licenseNumbers": {
            "title": "License numbers (optional)",
            "type": "array",
            "description": "Exact license numbers, e.g. [\"334699\"]. The export is still streamed and rows are matched as they pass, so this is a filter, not a lookup — for a handful of known licenses it is faster than a county sweep, but it does not avoid the download.",
            "items": {
              "type": "string",
              "pattern": "^[0-9A-Za-z]{1,10}$"
            }
          },
          "updatedSinceDays": {
            "title": "Changed in the last N days (optional)",
            "minimum": 0,
            "maximum": 3650,
            "type": "integer",
            "description": "Keep licenses whose LastUpdate date falls inside this window. This is the field to use for a recurring \"what changed\" feed: CSLB stamps it on every row. 0 disables the filter.",
            "default": 0
          },
          "incremental": {
            "title": "Only licences not returned by an earlier run (optional)",
            "type": "boolean",
            "description": "Leave this off to get the same first N matches every time — re-running an identical input is then reproducible, and a repeated test run returns the same licences. Turn it on for a schedule: the actor remembers which licence numbers it already delivered for this exact query and skips them, so each run continues further down the export instead of re-billing records you already have. This is the switch to pair with updatedSinceDays for a change feed.",
            "default": false
          },
          "maxResults": {
            "title": "Max results",
            "minimum": 1,
            "maximum": 250000,
            "type": "integer",
            "description": "Hard cap on the number of records saved to the dataset, and therefore on what you are charged. The download stops as soon as this many matching licenses have been collected, so a small cap also makes the run fast.",
            "default": 500
          },
          "maxScanRows": {
            "title": "Max rows to scan (optional)",
            "minimum": 0,
            "maximum": 500000,
            "type": "integer",
            "description": "Stop reading the export after this many rows even if maxResults is not reached. 0 means no limit. Useful for a cheap sample run against a narrow filter that is rare in the file.",
            "default": 0
          },
          "includeRaw": {
            "title": "Include raw source row",
            "type": "boolean",
            "description": "Attach the untouched CSV row to every record under `raw`, with CSLB's original column names (BUS-NAME-2, Classifications(s), NAME-TP-2, ...). Useful for auditing the parse.",
            "default": false
          },
          "downloadTimeoutSecs": {
            "title": "Download timeout (seconds)",
            "minimum": 30,
            "maximum": 3600,
            "type": "integer",
            "description": "How long the 78 MB export may take to stream. Measured 2026-11-02: the full 77.7 MB file arrived in 49 seconds. The stream also stops by itself after 240 seconds and returns the records selected so far, so a run never hangs past 5 minutes. Lowering this below the real transfer time fails the run.",
            "default": 900
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}