{
  "openapi": "3.0.1",
  "info": {
    "title": "Code Violations Scraper - Distressed & Motivated Seller Leads",
    "description": "Motivated-seller leads from city code violations: owner name + mailing address, absentee-owner, tax-delinquency & foreclosure flags, 0-100 distress score. 15 verified sources (Chicago, NYC, Philly, Detroit +11) checked daily. Source-direct government data from $3/1,000.",
    "version": "0.1",
    "x-build-id": "qeJ2o4ZD5kM7z9OlN"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/permitdata~us-code-violations-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-permitdata-us-code-violations-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/permitdata~us-code-violations-scraper/runs": {
      "post": {
        "operationId": "runs-sync-permitdata-us-code-violations-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/permitdata~us-code-violations-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-permitdata-us-code-violations-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": {
          "mode": {
            "title": "Mode",
            "enum": [
              "scrape",
              "monitor",
              "canary"
            ],
            "type": "string",
            "description": "scrape = pull a date range once. monitor = only NEW cases since your last run (stateful, deduped - ideal for schedules/webhooks). canary = coverage self-test, no charges.",
            "default": "scrape"
          },
          "sources": {
            "title": "Cities",
            "type": "array",
            "description": "Which verified sources to pull. Leave empty for ALL verified cities.",
            "items": {
              "type": "string",
              "enum": [
                "detroit",
                "philadelphia",
                "chicago",
                "nyc_hpd",
                "los_angeles",
                "san_francisco",
                "seattle",
                "boston",
                "austin",
                "baltimore",
                "new_orleans",
                "cincinnati",
                "cleveland",
                "cleveland_condemned",
                "columbus"
              ],
              "enumTitles": [
                "Detroit, MI (blight + owner names)",
                "Philadelphia, PA (L&I + owner names)",
                "Chicago, IL",
                "New York City, NY (HPD)",
                "Los Angeles, CA",
                "San Francisco, CA",
                "Seattle, WA",
                "Boston, MA (+ owner names)",
                "Austin, TX",
                "Baltimore, MD (vacant buildings + owner names)",
                "New Orleans, LA",
                "Cincinnati, OH",
                "Cleveland, OH (violation notices + owner names)",
                "Cleveland, OH (active condemnations + owner names)",
                "Columbus, OH (code enforcement cases)"
              ]
            },
            "default": []
          },
          "categories": {
            "title": "Violation category filter",
            "type": "array",
            "description": "Only return cases in these categories. Empty = all. High-distress categories (best RE-investor leads) are demolition, unsafe_structure, vacant_abandoned.",
            "items": {
              "type": "string",
              "enum": [
                "demolition",
                "unsafe_structure",
                "vacant_abandoned",
                "fire",
                "health_safety",
                "vehicles",
                "vegetation",
                "junk_debris",
                "zoning",
                "occupancy",
                "property_maintenance",
                "other"
              ],
              "enumTitles": [
                "Demolition",
                "Unsafe structure",
                "Vacant / abandoned",
                "Fire",
                "Health & safety",
                "Vehicles",
                "Vegetation / weeds",
                "Junk / debris",
                "Zoning",
                "Occupancy / no-permit",
                "Property maintenance",
                "Other"
              ]
            },
            "default": []
          },
          "statuses": {
            "title": "Status filter",
            "type": "array",
            "description": "Only return cases with these normalized statuses. Empty = all. 'open' = active/unresolved (best leads).",
            "items": {
              "type": "string",
              "enum": [
                "open",
                "closed",
                "other",
                "unknown"
              ],
              "enumTitles": [
                "Open / active",
                "Closed / resolved",
                "Other",
                "Unknown"
              ]
            },
            "default": []
          },
          "minDistressScore": {
            "title": "Minimum distress score (0-100)",
            "minimum": 0,
            "maximum": 100,
            "type": "integer",
            "description": "Only return cases at or above this distress score. 0 = all. Try 60+ for hot motivated-seller leads.",
            "default": 0
          },
          "sinceDays": {
            "title": "Look-back window (days)",
            "minimum": 1,
            "maximum": 3650,
            "type": "integer",
            "description": "Scrape mode: how many days back from today. Ignored if 'Since date' is set.",
            "default": 14
          },
          "sinceDate": {
            "title": "Since date (YYYY-MM-DD)",
            "type": "string",
            "description": "Scrape mode: explicit start date. Overrides look-back window."
          },
          "untilDate": {
            "title": "Until date (YYYY-MM-DD)",
            "type": "string",
            "description": "Scrape mode: explicit end date (inclusive). Default: today."
          },
          "maxResultsPerSource": {
            "title": "Max results per city",
            "minimum": 1,
            "maximum": 200000,
            "type": "integer",
            "description": "Safety cap per source per run.",
            "default": 5000
          },
          "distressScoring": {
            "title": "Distress scoring (billing mode)",
            "type": "boolean",
            "description": "Every row always includes distress_score + distress_reasons. Turning this ON bills items as 'scored lead' events instead of raw 'violation' events - use it when you're pulling scored leads (see pricing).",
            "default": false
          },
          "enrichOwners": {
            "title": "Owner + tax-delinquency enrichment",
            "type": "boolean",
            "description": "For supported cities (currently Cleveland), join the county assessor's public parcel records to add owner name, owner mailing address (absentee-owner flag), and tax-delinquency / foreclosure signals. Adds a little latency; leave on for the richest leads. No extra charge.",
            "default": true
          },
          "monitorStateName": {
            "title": "Monitor state namespace",
            "type": "string",
            "description": "Monitor mode: name of the key-value store holding watermarks. Change it to run independent monitors (e.g. one per client).",
            "default": "code-violations-monitor"
          },
          "includeUnverified": {
            "title": "Include unverified sources (testing)",
            "type": "boolean",
            "description": "Also run sources still marked pending verification. Off by default.",
            "default": false
          },
          "discordWebhookUrl": {
            "title": "Discord webhook (canary alerts)",
            "type": "string",
            "description": "Canary mode: post the health summary to this Discord webhook."
          },
          "socrataAppToken": {
            "title": "Socrata app token (optional)",
            "type": "string",
            "description": "Raises Socrata rate limits for very large backfills. Not needed for normal 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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}