{
  "openapi": "3.0.1",
  "info": {
    "title": "US Commercial Fire Permit & Inspection Leads Scraper",
    "description": "Commercial fire-protection permits, failed inspections and code violations from official city sources — open-data APIs (Socrata, ArcGIS, CKAN, Carto) and permit portals (Accela, Tyler EnerGov) — normalized, deduplicated, scored 0-100, ready for fire-protection sales teams.",
    "version": "0.1",
    "x-build-id": "YgcAzX1Jv8i05D7i6"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/scrapelabmax~us-fire-permit-leads-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-scrapelabmax-us-fire-permit-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/scrapelabmax~us-fire-permit-leads-scraper/runs": {
      "post": {
        "operationId": "runs-sync-scrapelabmax-us-fire-permit-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/scrapelabmax~us-fire-permit-leads-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-scrapelabmax-us-fire-permit-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",
        "required": [
          "maxResults"
        ],
        "properties": {
          "cities": {
            "title": "Cities",
            "type": "array",
            "description": "Cities as 'City, ST' (e.g. 'Seattle, WA'). See README for the supported list; unsupported cities are reported with a reason, never silently dropped.",
            "items": {
              "type": "string"
            }
          },
          "counties": {
            "title": "Counties",
            "type": "array",
            "description": "Counties as 'County, ST' (e.g. 'Mecklenburg, NC').",
            "items": {
              "type": "string"
            }
          },
          "states": {
            "title": "States",
            "type": "array",
            "description": "State codes or names (e.g. 'CA', 'Texas'). Expands to every supported jurisdiction in the state.",
            "items": {
              "type": "string"
            }
          },
          "zipCodes": {
            "title": "ZIP codes",
            "type": "array",
            "description": "5-digit ZIP codes; matched to supported jurisdictions by prefix.",
            "items": {
              "type": "string"
            }
          },
          "permitTypes": {
            "title": "Fire system types",
            "type": "array",
            "description": "Restrict to specific fire-protection categories. Empty = all.",
            "items": {
              "type": "string",
              "enum": [
                "fire_alarm",
                "fire_sprinkler",
                "fire_pump",
                "standpipe",
                "kitchen_suppression",
                "special_suppression",
                "inspection",
                "fire_code_violation",
                "certificate_of_occupancy",
                "other_fire_protection"
              ]
            }
          },
          "keywords": {
            "title": "Keywords",
            "type": "array",
            "description": "Case-insensitive keywords the record description must contain (e.g. 'NFPA 13').",
            "items": {
              "type": "string"
            }
          },
          "startDate": {
            "title": "Start date",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "type": "string",
            "description": "Earliest record date (YYYY-MM-DD). Default: 'Lookback days' before the run, or 90 days if that is not set."
          },
          "endDate": {
            "title": "End date",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "type": "string",
            "description": "Latest record date (YYYY-MM-DD). Default: today."
          },
          "lookbackDays": {
            "title": "Lookback days",
            "minimum": 1,
            "maximum": 365,
            "type": "integer",
            "description": "How many days back to read when no start date is given. Default: 90. For a daily schedule with 'Only new/changed records' on, 7 to 14 keeps each run short; a start date, if set, wins."
          },
          "includeInspections": {
            "title": "Include inspections",
            "type": "boolean",
            "description": "Include fire inspection records (failed inspections are high-value leads).",
            "default": true
          },
          "includeViolations": {
            "title": "Include violations",
            "type": "boolean",
            "description": "Include fire-code violation records.",
            "default": true
          },
          "includeExpiredOrExpiring": {
            "title": "Include expiring permits",
            "type": "boolean",
            "description": "Include records whose permits/certifications are expired or expiring soon.",
            "default": true
          },
          "includeResidential": {
            "title": "Include residential",
            "type": "boolean",
            "description": "Include single-family residential records (off by default — this is a commercial lead product).",
            "default": false
          },
          "onlyNewRecords": {
            "title": "Only new/changed records",
            "type": "boolean",
            "description": "Return only records that are new or changed since your last run (per-account state). Run daily for a fresh-leads feed.",
            "default": false
          },
          "maxResults": {
            "title": "Max results",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Hard cap on returned leads — you pay per result. Every requested source is read; if more leads match than the cap allows, the sources share it equally and each gives its best-scored leads."
          },
          "minimumLeadScore": {
            "title": "Minimum lead score",
            "minimum": 0,
            "maximum": 100,
            "type": "integer",
            "description": "Only return leads scoring at least this (0–100). 60+ = strong signals only.",
            "default": 0
          },
          "includeRawData": {
            "title": "Include raw source data",
            "type": "boolean",
            "description": "Attach the original source record under rawData.",
            "default": false
          },
          "includeContactDetails": {
            "title": "Include contact details",
            "type": "boolean",
            "description": "Add the phone number and email address that a permit record itself publishes for its contractor, applicant or owner. Off by default: both fields are then null on every record. Filled only where the city's own record carries them (today Raleigh, Austin and Mesa), copied as published, never looked up anywhere else. With Include raw source data on, rawData is the portal's row as published and holds whatever contact columns the portal publishes, whatever this setting says.",
            "default": false
          },
          "includeSourceMetadata": {
            "title": "Include source metadata",
            "type": "boolean",
            "description": "Include merged-source provenance details. The primary source URL is always included.",
            "default": true
          },
          "socrataAppToken": {
            "title": "Socrata app token (optional)",
            "type": "string",
            "description": "Optional token from any Socrata portal — raises rate limits for heavy use."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}