{
  "openapi": "3.0.1",
  "info": {
    "title": "City Building Permits: Chicago, NYC, Austin, Seattle, LA",
    "description": "Building permits issued in Chicago, New York, Austin, Seattle and Los Angeles, from each city's official open data: work type, cost, contractor company, address, coordinates. Filter by category, cost, ZIP or keyword, and track only new permits.",
    "version": "0.1",
    "x-build-id": "gFmsLh0BXwnDZbd9J"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/yzy001~city-building-permits/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-yzy001-city-building-permits",
        "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/yzy001~city-building-permits/runs": {
      "post": {
        "operationId": "runs-sync-yzy001-city-building-permits",
        "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/yzy001~city-building-permits/run-sync": {
      "post": {
        "operationId": "run-sync-yzy001-city-building-permits",
        "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",
            "type": "array",
            "description": "Which cities to read. Each comes from that city's official open-data portal.",
            "items": {
              "type": "string",
              "enum": [
                "CHICAGO",
                "NEW_YORK",
                "AUSTIN",
                "SEATTLE",
                "LOS_ANGELES"
              ],
              "enumTitles": [
                "Chicago",
                "New York (DOB NOW)",
                "Austin",
                "Seattle",
                "Los Angeles (weekly)"
              ]
            },
            "default": [
              "CHICAGO",
              "NEW_YORK",
              "AUSTIN",
              "SEATTLE",
              "LOS_ANGELES"
            ]
          },
          "daysBack": {
            "title": "Days back",
            "minimum": 1,
            "maximum": 31,
            "type": "integer",
            "description": "The latest N days of permits each city has published (1-31), counted back from that city's newest issue date, so a city whose portal is a few days behind still returns its latest days. For daily monitoring use 31 with change tracking. Ignored when a from date is set.",
            "default": 7
          },
          "fromDate": {
            "title": "From date",
            "type": "string",
            "description": "Optional. First issue date to include (YYYY-MM-DD), the same for every city. The range can cover at most 31 days."
          },
          "toDate": {
            "title": "To date",
            "type": "string",
            "description": "Optional. Last issue date to include. Defaults to today."
          },
          "categories": {
            "title": "Categories",
            "type": "array",
            "description": "Keep permits in any of these categories, mapped from each city's own permit and work types. Empty = all.",
            "items": {
              "type": "string",
              "enum": [
                "NEW_CONSTRUCTION",
                "ALTERATION_ADDITION",
                "DEMOLITION",
                "ELECTRICAL",
                "PLUMBING",
                "MECHANICAL",
                "SIGN",
                "SITE_SAFETY",
                "OTHER"
              ],
              "enumTitles": [
                "New construction",
                "Alteration / addition / repair",
                "Demolition",
                "Electrical (incl. solar)",
                "Plumbing (incl. sprinklers)",
                "Mechanical / HVAC / boilers",
                "Sign",
                "Site safety (sidewalk shed, scaffold, fence)",
                "Other"
              ]
            },
            "default": []
          },
          "minEstimatedCost": {
            "title": "Minimum estimated cost (USD)",
            "minimum": 0,
            "type": "integer",
            "description": "Optional. Keep permits whose estimated cost is at least this. Permits without a cost are left out (most Austin trade permits and new buildings carry none)."
          },
          "zipPrefixes": {
            "title": "ZIP code prefixes",
            "type": "array",
            "description": "Optional. Keep permits whose address ZIP starts with any of these, for example 10011 or 787. Chicago publishes no ZIP for the permit address, so remove Chicago from cities when you use this.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "keywords": {
            "title": "Keywords",
            "type": "array",
            "description": "Optional. Keep permits whose description, permit type or work type contains any of these words (case-insensitive), for example solar, roof, accessory dwelling, restaurant.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "contractorKeywords": {
            "title": "Contractor name contains",
            "type": "array",
            "description": "Optional. Keep permits whose contractor company name contains any of these. Los Angeles publishes no contractor, so remove Los Angeles from cities when you use this.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "includeRenewals": {
            "title": "Include New York renewals",
            "type": "boolean",
            "description": "New York reissues a permit when it is renewed. Off = only initial permits.",
            "default": false
          },
          "trackChanges": {
            "title": "Track changes between runs",
            "type": "boolean",
            "description": "Remember which permits were returned before (in your own key-value store) and mark each row NEW, SEEN or FIRST_RUN.",
            "default": false
          },
          "onlyNew": {
            "title": "Only new permits",
            "type": "boolean",
            "description": "With tracking on, return only permits not returned by an earlier run.",
            "default": false
          },
          "allowPartial": {
            "title": "Allow partial results",
            "type": "boolean",
            "description": "If a city's portal fails, return the other cities and name the failed one. Off = the run fails.",
            "default": true
          },
          "maxItems": {
            "title": "Max permits",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Upper limit on rows. Rows alternate between the cities, newest first within each city, so a limit gives every city an equal share.",
            "default": 5000
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}