{
  "openapi": "3.0.1",
  "info": {
    "title": "Commercial Building Permit Opportunity Feed",
    "description": "Qualify commercial building permits from official city open data for one trade and sales stage, group amendments into one project, and emit only new or changed opportunities.",
    "version": "1.0",
    "x-build-id": "ZqBgLmzhE9Xf3rRnI"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/plusonets~commercial-permit-opportunity-feed/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-plusonets-commercial-permit-opportunity-feed",
        "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/plusonets~commercial-permit-opportunity-feed/runs": {
      "post": {
        "operationId": "runs-sync-plusonets-commercial-permit-opportunity-feed",
        "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/plusonets~commercial-permit-opportunity-feed/run-sync": {
      "post": {
        "operationId": "run-sync-plusonets-commercial-permit-opportunity-feed",
        "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",
            "uniqueItems": true,
            "type": "array",
            "description": "Official open-data portals to read.",
            "items": {
              "type": "string",
              "enum": [
                "chicago",
                "new-york",
                "san-francisco",
                "austin",
                "seattle",
                "los-angeles"
              ],
              "enumTitles": [
                "Chicago",
                "New York City",
                "San Francisco",
                "Austin",
                "Seattle",
                "Los Angeles"
              ]
            },
            "default": [
              "chicago"
            ]
          },
          "trades": {
            "title": "Trades",
            "uniqueItems": true,
            "type": "array",
            "description": "Service categories. Electrical defaults to the application stage only, because an issued electrical permit is often late for a design-stage pitch.",
            "items": {
              "type": "string",
              "enum": [
                "hvac",
                "fire-life-safety",
                "electrical",
                "plumbing",
                "roofing",
                "restaurant-fit-out",
                "signage",
                "demolition-waste",
                "solar",
                "custom"
              ],
              "enumTitles": [
                "HVAC",
                "Fire and life safety",
                "Electrical",
                "Plumbing",
                "Roofing",
                "Restaurant fit-out",
                "Signage",
                "Demolition and waste",
                "Solar",
                "Custom keywords"
              ]
            },
            "default": [
              "hvac"
            ]
          },
          "customKeywords": {
            "title": "Custom keywords",
            "type": "array",
            "description": "Extra scope phrases. Required when Custom keywords is selected. Letters, numbers, spaces, and &./+- only.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "lookbackDays": {
            "title": "Lookback days",
            "minimum": 1,
            "maximum": 3650,
            "type": "integer",
            "description": "How far back to read filing, issue, and status dates.",
            "default": 14
          },
          "stages": {
            "title": "Stages that qualify",
            "uniqueItems": true,
            "type": "array",
            "description": "Leave empty to use each trade's default sales window. Add renewal, inspection, or completed only when you want those later stages.",
            "items": {
              "type": "string",
              "enum": [
                "application",
                "issued",
                "renewal",
                "inspection",
                "completed"
              ],
              "enumTitles": [
                "Application",
                "Issued",
                "Renewal",
                "Inspection",
                "Completed"
              ]
            }
          },
          "excludeResidential": {
            "title": "Drop residential",
            "type": "boolean",
            "description": "Skip single-family, duplex, townhouse, and apartment filings when the city publishes that occupancy, and skip residential wording when it does not.",
            "default": true
          },
          "onlyChanges": {
            "title": "Only new or changed projects",
            "type": "boolean",
            "description": "On later runs of the same monitor, emit a project only when its stage, scope, valuation, or contractor changed.",
            "default": true
          },
          "minValuation": {
            "title": "Minimum valuation (USD)",
            "minimum": 0,
            "type": "integer",
            "description": "Optional. Projects with a missing valuation are skipped when this is set."
          },
          "maxRecords": {
            "title": "Max source records per city",
            "minimum": 1,
            "maximum": 20000,
            "type": "integer",
            "description": "Cap on source rows normalized in each city. Each successfully normalized row can incur a record-normalized charge.",
            "default": 300
          },
          "maxProjects": {
            "title": "Max qualified projects",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Cap on new or changed projects emitted this run. The rest stay unsent and can be emitted on the next run.",
            "default": 25
          },
          "includeNormalizedRecords": {
            "title": "Also emit normalized source rows",
            "type": "boolean",
            "description": "Adds one flat row per trade-matching source filing, in addition to the qualified project.",
            "default": false
          },
          "monitorId": {
            "title": "Monitor id",
            "type": "string",
            "description": "Isolates saved state. Leave blank to derive one from the cities, trades, stages, and residential filter."
          },
          "socrataAppToken": {
            "title": "Socrata app token",
            "type": "string",
            "description": "Optional. Your own Socrata application token, sent only as a header. The actor runs without one."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}