{
  "openapi": "3.0.1",
  "info": {
    "title": "Building Permit Leads Scraper: Contractor Phone & License",
    "description": "New building permits from US city and county records by trade and date: address, project value and the contractor's name, phone and licence number. Or list the most active contractors in a city.",
    "version": "0.0",
    "x-build-id": "iEjvuIAvAYP3E7HLb"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/scrapebench~building-permit-contractor-leads-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-scrapebench-building-permit-contractor-leads-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/scrapebench~building-permit-contractor-leads-scraper/runs": {
      "post": {
        "operationId": "runs-sync-scrapebench-building-permit-contractor-leads-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/scrapebench~building-permit-contractor-leads-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-scrapebench-building-permit-contractor-leads-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": {
          "cities": {
            "title": "Cities",
            "type": "array",
            "description": "The city and county permit records to search. Leave empty for all of them. Each city counts separately for 'Maximum results'.",
            "items": {
              "type": "string",
              "enum": [
                "Miami-Dade County, FL",
                "Austin, TX",
                "San Francisco, CA",
                "New Orleans, LA",
                "Philadelphia, PA",
                "Dallas, TX"
              ]
            }
          },
          "view": {
            "title": "Output",
            "enum": [
              "permits",
              "contractors"
            ],
            "type": "string",
            "description": "'permits': one row per permit. 'contractors': one row per distinct contractor in the same permits, with permit count, first and last permit date, total project value, permit types and ZIP codes, most active first.",
            "default": "permits"
          },
          "daysBack": {
            "title": "Issued within the last (days)",
            "minimum": 1,
            "maximum": 3650,
            "type": "integer",
            "description": "Permits issued in this many days up to today. Ignored when 'Issued on or after' is set.",
            "default": 30
          },
          "issuedAfter": {
            "title": "Issued on or after",
            "type": "string",
            "description": "YYYY-MM-DD, e.g. 2026-11-01."
          },
          "issuedBefore": {
            "title": "Issued on or before",
            "type": "string",
            "description": "YYYY-MM-DD. Default: today."
          },
          "trades": {
            "title": "Trades",
            "type": "array",
            "description": "Keep permits whose type or description mentions the trade (any of them). 'hvac' also matches mechanical permits.",
            "items": {
              "type": "string",
              "enum": [
                "roofing",
                "solar",
                "hvac",
                "plumbing",
                "electrical",
                "remodel",
                "new_construction",
                "pool",
                "demolition",
                "windows_doors",
                "fence"
              ]
            }
          },
          "keywords": {
            "title": "Keywords",
            "type": "array",
            "description": "Keep permits whose type, description or contractor name contains any of these words (any case), e.g. 'generator' or 'ADU'. With trades too, a permit must match both.",
            "items": {
              "type": "string"
            }
          },
          "permitTypes": {
            "title": "Permit types / work classes",
            "type": "array",
            "description": "Keep permits whose type, class or work class contains any of these words, as the city names them, e.g. 'Plumbing', 'Building', 'Repair', 'New'.",
            "items": {
              "type": "string"
            }
          },
          "minProjectValue": {
            "title": "Minimum project value ($)",
            "minimum": 0,
            "type": "integer",
            "description": "Only permits whose declared project value is at least this much. Philadelphia publishes no value, so it is skipped (a free row says so) when this is set."
          },
          "contractors": {
            "title": "Contractor names",
            "type": "array",
            "description": "Only permits of contractors whose name contains any of these, e.g. 'Tesla' or 'ABC Roofing'.",
            "items": {
              "type": "string"
            }
          },
          "licenseNumbers": {
            "title": "Contractor licence numbers",
            "type": "array",
            "description": "Only permits of these exact contractor licence numbers: Miami-Dade county licence (e.g. CGC1532033), California CSLB number for San Francisco, New Orleans licence number. Austin, Dallas and Philadelphia publish none.",
            "items": {
              "type": "string"
            }
          },
          "includeContacts": {
            "title": "Include contractor phone where the city prints none",
            "type": "boolean",
            "description": "Where the permit names a contractor business but no phone (San Francisco, New Orleans, Philadelphia, some others), add one (and its website) looked up by business name. Charged as a separate 'Contact details found' event only on a row that gets a phone. Owner-builders and people are never looked up.",
            "default": true
          },
          "maxResults": {
            "title": "Maximum results per city",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Cap on rows PER CITY (permits, or contractors in the contractors view), newest permits first.",
            "default": 100
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}