{
  "openapi": "3.0.1",
  "info": {
    "title": "Building Permit Leads Scraper (US) - AI Scored",
    "description": "Fresh building permits from 26 US cities as scored sales leads: roofing, solar, HVAC, pool, remodel and new construction. Owner, contractor, value, address. Optional AI sales insights.",
    "version": "1.0",
    "x-build-id": "vDsve53Yd2tipfIgR"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/datamint~us-building-permit-leads/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-datamint-us-building-permit-leads",
        "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/datamint~us-building-permit-leads/runs": {
      "post": {
        "operationId": "runs-sync-datamint-us-building-permit-leads",
        "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/datamint~us-building-permit-leads/run-sync": {
      "post": {
        "operationId": "run-sync-datamint-us-building-permit-leads",
        "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": "Which US cities/counties to pull permits from (26 available). Leave empty for all.",
            "items": {
              "type": "string",
              "enum": [
                "austin",
                "baton_rouge",
                "boston",
                "chicago",
                "cincinnati",
                "cleveland",
                "collin_county_tx",
                "columbus",
                "dallas",
                "denver",
                "detroit",
                "los_angeles",
                "marin_county",
                "mesa",
                "miami_dade",
                "montgomery_md",
                "nashville",
                "new_orleans",
                "new_york",
                "norfolk",
                "orlando",
                "philadelphia",
                "raleigh",
                "san_diego_county",
                "san_francisco",
                "seattle"
              ],
              "enumTitles": [
                "Austin, TX",
                "Baton Rouge, LA",
                "Boston, MA",
                "Chicago, IL",
                "Cincinnati, OH",
                "Cleveland, OH",
                "Collin County, TX (Plano, Frisco, McKinney, Allen...)",
                "Columbus, OH",
                "Dallas, TX",
                "Denver, CO (residential)",
                "Detroit, MI",
                "Los Angeles, CA",
                "Marin County, CA",
                "Mesa, AZ",
                "Miami-Dade County, FL",
                "Montgomery County, MD",
                "Nashville, TN",
                "New Orleans, LA",
                "New York City, NY",
                "Norfolk, VA",
                "Orlando, FL",
                "Philadelphia, PA",
                "Raleigh, NC",
                "San Diego County (unincorporated), CA",
                "San Francisco, CA",
                "Seattle, WA"
              ]
            }
          },
          "daysBack": {
            "title": "Permits issued in the last N days",
            "minimum": 1,
            "maximum": 90,
            "type": "integer",
            "description": "How far back to look. 7 is a good weekly run; schedule the Actor to get new leads automatically.",
            "default": 7
          },
          "categories": {
            "title": "Project types",
            "type": "array",
            "description": "Only keep these project types. Leave empty for all.",
            "items": {
              "type": "string",
              "enum": [
                "roofing",
                "solar",
                "pool",
                "hvac",
                "electrical",
                "plumbing",
                "new_construction",
                "addition",
                "remodel",
                "concrete_paving",
                "garage_shed",
                "demolition",
                "windows_doors",
                "fence_deck_patio",
                "foundation_structural",
                "fire_protection",
                "signage",
                "other"
              ],
              "enumTitles": [
                "Roofing",
                "Solar / battery",
                "Pool / spa",
                "HVAC",
                "Electrical",
                "Plumbing / gas",
                "New construction",
                "Addition / ADU",
                "Remodel / renovation",
                "Concrete / driveway / paving",
                "Garage / shed / carport",
                "Demolition",
                "Windows & doors",
                "Fence / deck / patio",
                "Foundation / structural",
                "Fire protection",
                "Signage",
                "Other"
              ]
            }
          },
          "minProjectValue": {
            "title": "Minimum project value ($)",
            "minimum": 0,
            "type": "integer",
            "description": "Skip permits with a declared value below this. Permits with no value listed are skipped when this is above 0.",
            "default": 0
          },
          "residentialOnly": {
            "title": "Residential only",
            "type": "boolean",
            "description": "Keep only permits identified as residential (homeowners).",
            "default": false
          },
          "onlyWithoutContractor": {
            "title": "Only permits with no contractor listed",
            "type": "boolean",
            "description": "Owner-pulled permits or projects where no contractor is named yet are often still hiring.",
            "default": false
          },
          "keywords": {
            "title": "Keywords",
            "type": "array",
            "description": "Keep only permits whose type/description contains any of these words (e.g. 'kitchen', 'heat pump').",
            "items": {
              "type": "string"
            }
          },
          "zipCodes": {
            "title": "ZIP codes",
            "type": "array",
            "description": "Keep only permits in these ZIP codes (where the city publishes ZIPs).",
            "items": {
              "type": "string"
            }
          },
          "minLeadScore": {
            "title": "Minimum lead score (0-100)",
            "minimum": 0,
            "maximum": 100,
            "type": "integer",
            "description": "Hot leads score 70+, warm 45+.",
            "default": 0
          },
          "maxLeads": {
            "title": "Max leads to return",
            "minimum": 1,
            "type": "integer",
            "description": "Best-scoring leads are returned first.",
            "default": 500
          },
          "maxPermitsPerCity": {
            "title": "Max permits to scan per city",
            "minimum": 10,
            "maximum": 50000,
            "type": "integer",
            "description": "Upper limit of permits fetched from each city before filtering. Raise it for long date ranges in busy cities like NYC or Dallas.",
            "default": 3000
          },
          "useAi": {
            "title": "Add AI sales insights",
            "type": "boolean",
            "description": "Adds a plain-English summary, the trades the property will likely need next, a tailored opening line and a fit score. Needs a free Google Gemini API key.",
            "default": false
          },
          "targetTrade": {
            "title": "Your business / trade",
            "type": "string",
            "description": "Used to tailor the AI sales angle and fit score, e.g. 'roofing company', 'solar installer', 'kitchen remodeler', 'home insurance agent'.",
            "default": "home-service contractors"
          },
          "geminiApiKey": {
            "title": "Google Gemini API key",
            "type": "string",
            "description": "Free from https://aistudio.google.com/apikey. Stored encrypted."
          },
          "aiMaxLeads": {
            "title": "Max leads to enrich with AI",
            "minimum": 1,
            "maximum": 2000,
            "type": "integer",
            "description": "Only the best-scored leads get AI insights, up to this number. Keeps runs fast and within your Gemini free tier.",
            "default": 100
          },
          "geminiModel": {
            "title": "Gemini model",
            "type": "string",
            "description": "Google Gemini model used for AI insights. Leave the default unless Google retires it.",
            "default": "gemini-2.5-flash"
          },
          "socrataAppToken": {
            "title": "Socrata app token (optional)",
            "type": "string",
            "description": "Only needed for very large or frequent runs to avoid open-data rate limits."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}