{
  "openapi": "3.0.1",
  "info": {
    "title": "Arizona ROC Contractor License Scraper",
    "description": "Scrape the Arizona Registrar of Contractors (AZ ROC) public license database. Search by license number, company name, qualifying party, or city. Returns license status, bond details, complaint history, and full contractor info. $4.00 per 1,000 results.",
    "version": "1.0",
    "x-build-id": "yMAf6drHeKkuhQkaR"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/ws_tony~az-roc-license-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-ws_tony-az-roc-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/ws_tony~az-roc-license-scraper/runs": {
      "post": {
        "operationId": "runs-sync-ws_tony-az-roc-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/ws_tony~az-roc-license-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-ws_tony-az-roc-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": {
          "licenseNumbers": {
            "title": "License numbers",
            "type": "array",
            "description": "AZ ROC license numbers to look up directly (fastest mode). Leading zeros are added automatically. Example: [\"333282\", \"12345\"]",
            "items": {
              "type": "string"
            }
          },
          "companyNames": {
            "title": "Company / business names",
            "type": "array",
            "description": "Business names to search. Partial matching is supported. Example: [\"Desert HVAC\", \"Acme Plumbing\"]",
            "items": {
              "type": "string"
            }
          },
          "qualifyingPartyNames": {
            "title": "Qualifying party names",
            "type": "array",
            "description": "Individual qualifying party names to search. Example: [\"John Smith\"]",
            "items": {
              "type": "string"
            }
          },
          "cities": {
            "title": "Arizona cities",
            "type": "array",
            "description": "Arizona city names to search. Large cities (Phoenix, Tucson) can yield thousands of results across many pages — use filters below to narrow. Example: [\"Scottsdale\", \"Mesa\"]",
            "items": {
              "type": "string"
            }
          },
          "licenseType": {
            "title": "License type filter",
            "enum": [
              "ALL",
              "RESIDENTIAL",
              "COMMERCIAL",
              "DUAL"
            ],
            "type": "string",
            "description": "Filter results by license type. Applied to all search jobs.",
            "default": "ALL"
          },
          "licenseStatus": {
            "title": "License status filter",
            "enum": [
              "ALL",
              "ACTIVE",
              "SUSPENDED",
              "EXPIRED",
              "REVOKED",
              "CANCELLED"
            ],
            "type": "string",
            "description": "Filter results by license status. Note: the AZ ROC portal uses a single text-search field, so this filter is applied post-scrape to the collected records rather than server-side. Results may include other statuses that are then filtered from the output.",
            "default": "ALL"
          },
          "licenseClassification": {
            "title": "Classification code filter",
            "type": "string",
            "description": "Filter by classification code (e.g. B-1, CR-39, C-37). Find all codes at https://roc.az.gov/license-classifications. Note: this filter is applied post-scrape — the portal's search is text-based and may return broader results, which are then narrowed in the output. Leave blank for all classifications.",
            "default": ""
          },
          "maxResultsPerSearch": {
            "title": "Max results per search",
            "minimum": 0,
            "maximum": 50000,
            "type": "integer",
            "description": "Maximum records to collect per search job. 0 = unlimited (paginates all pages — use with caution on city searches, which can return thousands of records and unexpected billing). Default 100 is a safe starting point.",
            "default": 100
          },
          "resultsPerPage": {
            "title": "Results per page",
            "minimum": 10,
            "maximum": 50,
            "type": "integer",
            "description": "Rows per page in the AZ ROC results table. Accepts 10, 20, or 50. Larger values mean fewer page-turn clicks — 50 is fastest.",
            "default": 50
          },
          "scrapeDetailPage": {
            "title": "Scrape detail page",
            "type": "boolean",
            "description": "Visit each contractor's detail page for full data: entity type, bond info, complaint history, all classifications, and personnel. Roughly doubles cost and runtime (~1–2 extra page loads per record). For large runs with detail pages enabled, set a longer Timeout in the Run options panel (recommended: 3600s). Recommended: start with false to preview data cheaply, then enable for your final run.",
            "default": true
          },
          "scrapeComplaints": {
            "title": "Include complaint history",
            "type": "boolean",
            "description": "Include the array of individual complaint records in output. Only applies when 'Scrape detail page' is enabled.",
            "default": true
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Residential proxies are strongly recommended for production runs. The AZ ROC portal uses Salesforce bot protection which can challenge datacenter IPs."
          },
          "maxConcurrency": {
            "title": "Max concurrency",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "Parallel browser tabs. Higher = faster but more likely to trigger rate limiting. Keep ≤ 5 for residential proxies.",
            "default": 3
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}