{
  "openapi": "3.0.1",
  "info": {
    "title": "US Contractor License Scraper - Builder & Trade Leads",
    "description": "Scrape licensed-contractor leads from US state boards (California CSLB, Washington L&I, Oregon BCD): business name, license number, trade, status, bond & insurance carriers, owner, phone & address. Filter by city, trade & date; monitor only-new licenses. Keyless, no browser.",
    "version": "0.1",
    "x-build-id": "m2Buf9D0ok2Oc3Uq5"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/scrapesage~us-contractor-license-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-scrapesage-us-contractor-license-scraper",
        "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/scrapesage~us-contractor-license-scraper/runs": {
      "post": {
        "operationId": "runs-sync-scrapesage-us-contractor-license-scraper",
        "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/scrapesage~us-contractor-license-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-scrapesage-us-contractor-license-scraper",
        "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": {
          "states": {
            "title": "States (only these 3 are supported)",
            "type": "array",
            "description": "Pick any subset of the supported state licensing boards: California (CSLB), Washington (L&I) and Oregon (BCD). These are the only US states with a clean, reliably scrapeable contractor-license source — so there are no empty runs. Washington & Oregon support city/trade bulk discovery; California supports targeted business-name and license-number lookups. Leave empty to use all three. More states added on request.",
            "items": {
              "type": "string",
              "enum": [
                "California",
                "Washington",
                "Oregon"
              ]
            },
            "default": [
              "California",
              "Washington",
              "Oregon"
            ]
          },
          "cities": {
            "title": "Cities (Washington & Oregon)",
            "type": "array",
            "description": "Cities to pull all contractors from — e.g. \"Seattle, WA\", \"Portland, OR\", or just \"Tacoma\". Used for Washington & Oregon bulk discovery (California has no public city browse — use Business names / License numbers for CA). Add a state suffix to target one state; a bare city runs against every selected WA/OR state.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "businessNames": {
            "title": "Business names",
            "type": "array",
            "description": "Company names (or partial names) to search. In California this runs a CSLB name search and pulls the full license detail for every match; in Washington & Oregon it filters the registry by name. Example: \"Pacific Plumbing\", \"ABC Construction\".",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "licenseNumbers": {
            "title": "License numbers",
            "type": "array",
            "description": "Look up specific licenses directly. Numeric values (e.g. 1000000) are treated as California (CSLB); alphanumeric values (e.g. ALLYEEL740KR, BB319) are looked up in Washington & Oregon.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "trades": {
            "title": "Trades / classifications",
            "type": "array",
            "description": "Keep only contractors in these trades (matched flexibly across each state's wording). Leave empty for all trades.",
            "items": {
              "type": "string",
              "enum": [
                "General Building / Construction",
                "Electrical",
                "Plumbing",
                "HVAC / Mechanical",
                "Roofing",
                "Elevator",
                "Boiler",
                "Other"
              ]
            },
            "default": []
          },
          "activeOnly": {
            "title": "Active licenses only",
            "type": "boolean",
            "description": "Drop licenses that are clearly inactive (expired, revoked, suspended, cancelled, out of business…). Keeps active and unknown-status records.",
            "default": false
          },
          "issuedAfter": {
            "title": "Issued after (YYYY-MM-DD)",
            "type": "string",
            "description": "Only return licenses issued/effective on or after this date — the key to fresh, high-intent leads (newly licensed contractors). Applies to California & Washington (Oregon does not publish an issue date). Example: 2026-01-01."
          },
          "expiringBefore": {
            "title": "Expiring before (YYYY-MM-DD)",
            "type": "string",
            "description": "Only return licenses that expire on or before this date — perfect for renewal-intent campaigns (insurance, bonds, software). Example: 2026-12-31."
          },
          "includeBondAndInsurance": {
            "title": "Include bond & insurance (Washington)",
            "type": "boolean",
            "description": "For Washington, join the official surety-bond, liability-insurance and principal/owner datasets onto each contractor — the richest contractor lead record published anywhere. California always returns bond + workers' comp from the license detail. Turn off for a faster, leaner Washington pull.",
            "default": true
          },
          "withPhoneOnly": {
            "title": "With phone only",
            "type": "boolean",
            "description": "Only keep contractors that have a phone number (California & Washington expose phones; Oregon does not).",
            "default": false
          },
          "maxResultsPerState": {
            "title": "Max results per state",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Cap the number of contractor records collected per state.",
            "default": 1000
          },
          "maxResults": {
            "title": "Max results (whole run)",
            "minimum": 1,
            "maximum": 500000,
            "type": "integer",
            "description": "Global cap on the total number of contractor records emitted in this run, across all states.",
            "default": 2000
          },
          "deduplicateResults": {
            "title": "Deduplicate results",
            "type": "boolean",
            "description": "Emit each contractor only once per run (keyed by state + license number).",
            "default": true
          },
          "monitorMode": {
            "title": "Monitoring mode — only new licenses",
            "type": "boolean",
            "description": "Remember licenses already returned and emit ONLY contractors not seen in previous runs (newly issued / newly listed). Pairs with Apify Schedules to capture fresh contractor leads automatically.",
            "default": false
          },
          "monitorStoreName": {
            "title": "Monitor store name",
            "type": "string",
            "description": "Named key-value store holding the 'already seen' license ids for monitoring mode. Use a different name per tracked scope (e.g. one per city or trade).",
            "default": "contractor-license-monitor"
          },
          "socrataAppToken": {
            "title": "Socrata app token (optional)",
            "type": "string",
            "description": "Optional Socrata app token to raise the open-data API throttling limit on very large Washington/Oregon runs. Not required for normal use."
          },
          "maxConcurrency": {
            "title": "Max concurrency",
            "minimum": 1,
            "maximum": 20,
            "type": "integer",
            "description": "Maximum parallel requests.",
            "default": 5
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Proxy settings. The state open-data APIs are clean on the default Apify proxy; California (CSLB) automatically uses US residential for reliability.",
            "default": {
              "useApifyProxy": true
            }
          }
        }
      },
      "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}