{
  "openapi": "3.0.1",
  "info": {
    "title": "US Building Permits Monitor: Daily Construction Leads by Trade",
    "description": "New building permits as roofing, solar, HVAC and construction leads from NYC, LA, SF, Seattle, Austin and 4 more official city and county portals. Filter by trade, value, ZIP. New-only monitor mode. $1.50/1k. Not affiliated with or endorsed by any government agency.",
    "version": "1.0",
    "x-build-id": "LgpaQOgc9msHI1xdQ"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/optimistprime~us-building-permits-monitor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-optimistprime-us-building-permits-monitor",
        "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/optimistprime~us-building-permits-monitor/runs": {
      "post": {
        "operationId": "runs-sync-optimistprime-us-building-permits-monitor",
        "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/optimistprime~us-building-permits-monitor/run-sync": {
      "post": {
        "operationId": "run-sync-optimistprime-us-building-permits-monitor",
        "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": {
          "sources": {
            "title": "Cities / counties",
            "type": "array",
            "description": "Leave empty for all 9 (Chicago excluded from v1). Official open-data portals only.",
            "items": {
              "type": "string",
              "enum": [
                "nyc",
                "la",
                "sf",
                "seattle",
                "austin",
                "cincinnati",
                "baton-rouge",
                "new-orleans",
                "montgomery-md"
              ],
              "enumTitles": [
                "New York City, NY",
                "Los Angeles, CA",
                "San Francisco, CA",
                "Seattle, WA",
                "Austin, TX",
                "Cincinnati, OH",
                "Baton Rouge, LA",
                "New Orleans, LA",
                "Montgomery County, MD"
              ]
            }
          },
          "issuedWithinDays": {
            "title": "Issued within the last N days",
            "minimum": 1,
            "maximum": 90,
            "type": "integer",
            "description": "Only return permits with issuedDate on or after today minus N days (America/Chicago). In monitor mode the first run uses 'First monitor run: days back' instead.",
            "default": 7
          },
          "tradeTags": {
            "title": "Trades",
            "type": "array",
            "description": "Match any. Tags are approximate keyword heuristics; see README.",
            "items": {
              "type": "string",
              "enum": [
                "solar",
                "roofing",
                "hvac",
                "electrical",
                "plumbing",
                "ev-charger",
                "pool",
                "demolition",
                "new-construction",
                "adu",
                "addition-alteration",
                "signage",
                "windows-doors"
              ]
            }
          },
          "newConstructionOnly": {
            "title": "New construction only",
            "type": "boolean",
            "description": "Keep only permits tagged new-construction (approximate keyword tag).",
            "default": false
          },
          "minValuationUsd": {
            "title": "Minimum declared valuation (USD)",
            "minimum": 0,
            "type": "integer",
            "description": "Permits without a reported value are excluded when set. Austin publishes no valuation and is skipped (with a warning)."
          },
          "zipCodes": {
            "title": "ZIP codes",
            "type": "array",
            "description": "5-digit ZIPs. Empty = all.",
            "items": {
              "type": "string"
            }
          },
          "keywords": {
            "title": "Keywords (any)",
            "type": "array",
            "description": "Matched case-insensitively in permit type, work class and description.",
            "items": {
              "type": "string"
            }
          },
          "excludeKeywords": {
            "title": "Exclude keywords",
            "type": "array",
            "description": "Drop rows whose type, work class or description contains any of these (case-insensitive).",
            "items": {
              "type": "string"
            }
          },
          "monitorMode": {
            "title": "Monitor mode (only new permits since the last run)",
            "type": "boolean",
            "description": "Return only permits not seen since the last run for this monitorId (plus updates if enabled).",
            "default": false
          },
          "monitorId": {
            "title": "Monitor ID",
            "pattern": "^[a-zA-Z0-9-]{1,40}$",
            "type": "string",
            "description": "Namespace for monitor state in the building-permits-monitor KV store.",
            "default": "default"
          },
          "includeUpdates": {
            "title": "Monitor: also return permits whose status, value or contractors changed",
            "type": "boolean",
            "description": "In monitor mode, also return permits whose status, valuation, type, work class or contractors changed.",
            "default": true
          },
          "lookbackDays": {
            "title": "Monitor lookback (days)",
            "minimum": 3,
            "maximum": 30,
            "type": "integer",
            "description": "Monitor re-runs re-check this many days so late-published permits are caught (NYC publishes ~3 days behind). Never reaches back before the monitor's first run.",
            "default": 14
          },
          "firstRunLookbackDays": {
            "title": "First monitor run: days back",
            "minimum": 1,
            "maximum": 30,
            "type": "integer",
            "description": "Monitor mode only. How many days of permits the first run of a new monitorId loads (default 3). Later runs return only permits new since the previous run.",
            "default": 3
          },
          "maxItems": {
            "title": "Max permits",
            "minimum": 0,
            "type": "integer",
            "description": "0 = no limit. Prefilled 11 so a first try costs under $0.02.",
            "default": 50
          },
          "timeBudgetSeconds": {
            "title": "Time budget (s)",
            "minimum": 0,
            "maximum": 3000,
            "type": "integer",
            "description": "0 = no limit. Partial results are returned with truncated=true.",
            "default": 120
          },
          "socrataAppToken": {
            "title": "Socrata app token (optional)",
            "type": "string",
            "description": "Optional. Raises Socrata rate limits if you run very large jobs. 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
                  },
                  "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}