{
  "openapi": "3.0.1",
  "info": {
    "title": "Contractor Permit Signals: New & Busy Contractors",
    "description": "Building permits from city open data (Mesa, Austin, Chicago, Cincinnati, New Orleans): new and busy contractors, expired and expiring home permits, and an optional free property file.",
    "version": "0.1",
    "x-build-id": "wx5oaijrEfnUj8g1m"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/sullivan-ventures~contractor-permit-signals/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-sullivan-ventures-contractor-permit-signals",
        "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/sullivan-ventures~contractor-permit-signals/runs": {
      "post": {
        "operationId": "runs-sync-sullivan-ventures-contractor-permit-signals",
        "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/sullivan-ventures~contractor-permit-signals/run-sync": {
      "post": {
        "operationId": "run-sync-sullivan-ventures-contractor-permit-signals",
        "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": [
              "signals",
              "stalled"
            ],
            "type": "string",
            "description": "Stalled mode lists permits that expired, expire soon, or sit open with no final inspection. Austin, Cincinnati, New Orleans and Mesa only (Chicago has no address field here). Addresses only: no owner names, no phone numbers.",
            "default": "signals"
          },
          "stalledTypes": {
            "title": "Stalled types (stalled mode)",
            "type": "array",
            "description": "Which stalled signals to include. Default: all three.",
            "items": {
              "type": "string",
              "enum": [
                "expired",
                "expiring_soon",
                "open_no_final"
              ],
              "enumTitles": [
                "Expired",
                "Expiring soon",
                "Open with no final"
              ]
            },
            "default": [
              "expired",
              "expiring_soon",
              "open_no_final"
            ]
          },
          "stalledPermitClass": {
            "title": "Permit class (stalled mode)",
            "enum": [
              "residential",
              "commercial",
              "all"
            ],
            "type": "string",
            "description": "Stalled mode lists homes by default.",
            "default": "residential"
          },
          "expiringWithinDays": {
            "title": "Expiring within (days, stalled mode)",
            "minimum": 7,
            "maximum": 90,
            "type": "integer",
            "description": "Active permits whose expiration date falls in the next N days (Austin, Cincinnati).",
            "default": 30
          },
          "openNoFinalDays": {
            "title": "Open with no final after (days, stalled mode)",
            "minimum": 90,
            "maximum": 1095,
            "type": "integer",
            "description": "Issued at least this long ago and still not finaled (Mesa, New Orleans).",
            "default": 365
          },
          "issuedWithinDays": {
            "title": "Issued within (days, stalled mode)",
            "minimum": 90,
            "maximum": 1095,
            "type": "integer",
            "description": "Only look at permits issued in the last N days.",
            "default": 730
          },
          "includePropertyFile": {
            "title": "Add the free property file",
            "type": "boolean",
            "description": "Adds to each permit: owner name from the public assessor roll and owner type, absentee-owner flag (mailing address elsewhere), value, year built and home age, years owned, code cases in the last 5 years, census-tract income, home value and owner share, and FEMA flood zone. Austin, Chicago and Cincinnati. Mesa and New Orleans are not covered (see README). Marketing use only: not for credit, insurance, employment or housing decisions (FCRA). No phones or emails. You handle your own TCPA / Do Not Call compliance.",
            "default": false
          },
          "propertyFileMaxRows": {
            "title": "Property file: max rows to enrich",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Enrichment makes 2 map lookups per row, so large runs take longer. Rows past the cap are kept but marked over_row_cap.",
            "default": 500
          },
          "cities": {
            "title": "Cities",
            "type": "array",
            "description": "Official city permit datasets to read. Mesa is in the Phoenix metro and can be joined with the Construction Distress Feed.",
            "items": {
              "type": "string",
              "enum": [
                "mesa_az",
                "austin_tx",
                "chicago_il",
                "cincinnati_oh",
                "new_orleans_la"
              ],
              "enumTitles": [
                "Mesa, AZ (Phoenix metro)",
                "Austin, TX",
                "Chicago, IL",
                "Cincinnati, OH",
                "New Orleans, LA"
              ]
            },
            "default": [
              "mesa_az"
            ]
          },
          "lastNDays": {
            "title": "Last N days",
            "minimum": 1,
            "maximum": 92,
            "type": "integer",
            "description": "Permits issued in the last N days, ending yesterday. Ignored if Start date is set.",
            "default": 7
          },
          "startDate": {
            "title": "Start date",
            "pattern": "^(\\d{4}-\\d{2}-\\d{2})?$",
            "type": "string",
            "description": "Optional, YYYY-MM-DD (issue date)."
          },
          "endDate": {
            "title": "End date",
            "pattern": "^(\\d{4}-\\d{2}-\\d{2})?$",
            "type": "string",
            "description": "Optional, YYYY-MM-DD. Defaults to yesterday."
          },
          "lookbackDays": {
            "title": "History lookback (days)",
            "minimum": 30,
            "maximum": 730,
            "type": "integer",
            "description": "A contractor is 'new' if it pulled no permit in that city during this many days before the window.",
            "default": 365
          },
          "busyThreshold": {
            "title": "Busy threshold",
            "minimum": 2,
            "type": "integer",
            "description": "Permits in the window that mark a contractor as busy.",
            "default": 3
          },
          "onlySignals": {
            "title": "Only permits with a signal",
            "type": "boolean",
            "description": "Output only permits with a new or busy contractor (or a Maricopa lien match). You pay only for rows output.",
            "default": false
          },
          "permitClass": {
            "title": "Permit class",
            "enum": [
              "all",
              "commercial",
              "residential"
            ],
            "type": "string",
            "description": "Chicago has no class field; its permits are dropped when you pick commercial or residential.",
            "default": "all"
          },
          "minValuation": {
            "title": "Minimum job value (USD)",
            "minimum": 0,
            "type": "integer",
            "description": "Skip permits below this declared job value. 0 = keep all.",
            "default": 0
          },
          "maxRecords": {
            "title": "Max permits",
            "minimum": 1,
            "type": "integer",
            "description": "Upper limit on permit rows output (each row is one charge).",
            "default": 5000
          },
          "joinDistressFeed": {
            "title": "Join with Construction Distress Feed",
            "type": "boolean",
            "description": "If you also run the Construction Distress Feed (Maricopa liens and lis pendens) in this account, flag Mesa contractors that appear in its company history.",
            "default": true
          },
          "distressStateStoreName": {
            "title": "Distress feed state store",
            "type": "string",
            "description": "Named key-value store used by the Construction Distress Feed.",
            "default": "construction-distress-state"
          },
          "stateStoreName": {
            "title": "State store name",
            "type": "string",
            "description": "Named key-value store that remembers permits and contractors from your earlier runs (for is_new_permit and seen_in_prior_runs).",
            "default": "contractor-permit-state"
          },
          "updateState": {
            "title": "Update state",
            "type": "boolean",
            "description": "Save this run's permits and contractors to the state store.",
            "default": true
          },
          "socrataAppToken": {
            "title": "Socrata app token (optional)",
            "type": "string",
            "description": "Optional free token from the city portal. Only needed if you run very large ranges often."
          },
          "requestDelayMs": {
            "title": "Delay between requests (ms)",
            "minimum": 150,
            "type": "integer",
            "description": "Pause between API calls to the city portal. Keep the default to stay polite.",
            "default": 250
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}