{
  "openapi": "3.0.1",
  "info": {
    "title": "NYC Building Permit Feed, unofficial",
    "description": "Unofficial NYC building permit feed from NYC Open Data. Filter by borough, ZIP, work type and cost. Scheduled runs send permits published since the last run.",
    "version": "0.2",
    "x-build-id": "P5wnsonSeEo992b1i"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/amplelabs~nyc-building-permit-feed/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-amplelabs-nyc-building-permit-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/amplelabs~nyc-building-permit-feed/runs": {
      "post": {
        "operationId": "runs-sync-amplelabs-nyc-building-permit-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/amplelabs~nyc-building-permit-feed/run-sync": {
      "post": {
        "operationId": "run-sync-amplelabs-nyc-building-permit-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",
        "required": [
          "datasets"
        ],
        "properties": {
          "datasets": {
            "title": "Datasets",
            "minItems": 1,
            "type": "array",
            "description": "nyc_dob_now = NYC DOB NOW approved permits (rbx6-tga4); nyc_bis = NYC legacy BIS permit issuance (ipu4-2q9a). The Console form starts with nyc_dob_now only. A call that omits this field still uses both datasets. An unknown value, for example chicago, is rejected with HTTP 400 only by this schema when a run is started through the Apify API. The Console blocks it in the form. Anywhere else the run fails with an unknown dataset error.",
            "items": {
              "type": "string",
              "enum": [
                "nyc_dob_now",
                "nyc_bis"
              ],
              "enumTitles": [
                "NYC – DOB NOW",
                "NYC – legacy BIS"
              ]
            },
            "default": [
              "nyc_dob_now",
              "nyc_bis"
            ]
          },
          "dateFrom": {
            "title": "Issued on or after (first run / backfill)",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "type": "string",
            "description": "YYYY-MM-DD, interpreted in the city's local date. Used only when there is no saved cursor, or when resetState is true. Default: yesterday. Clamped to at most maxBackfillDays before today."
          },
          "dateTo": {
            "title": "Issued on or before",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "type": "string",
            "description": "YYYY-MM-DD. Default: today. If set, the run is a one-off window and does not advance the saved cursor."
          },
          "maxBackfillDays": {
            "title": "Max days of history per run",
            "minimum": 1,
            "maximum": 90,
            "type": "integer",
            "description": "Days beyond the first are charged day-scanned ($0.003 each).",
            "default": 1
          },
          "boroughs": {
            "title": "NYC boroughs",
            "type": "array",
            "description": "Empty = all. NYC datasets only.",
            "items": {
              "type": "string",
              "enum": [
                "MANHATTAN",
                "BRONX",
                "BROOKLYN",
                "QUEENS",
                "STATEN ISLAND"
              ]
            },
            "default": []
          },
          "zipCodes": {
            "title": "NYC ZIP codes",
            "type": "array",
            "description": "Empty = all.",
            "items": {
              "type": "string",
              "pattern": "^\\d{5}$"
            },
            "default": []
          },
          "permitTypeContains": {
            "title": "Permit or work type contains (any of)",
            "type": "array",
            "description": "Case-insensitive substring match on normalized permit_type OR work_type, e.g. 'NEW CONSTRUCTION', 'Plumbing', 'NB'.",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "minEstimatedCost": {
            "title": "Minimum estimated cost (USD)",
            "minimum": 0,
            "type": "integer",
            "description": "Applies to nyc_dob_now. nyc_bis has no cost field; its records are dropped when this is set unless includeUnknownCost is true."
          },
          "includeUnknownCost": {
            "title": "Keep records with no cost when a minimum is set",
            "type": "boolean",
            "description": "Keep records with no cost when a minimum is set. BIS has no cost field, so it is dropped when a minimum is set unless this is true.",
            "default": false
          },
          "includeFreeText": {
            "title": "Include free-text descriptions (opt-in)",
            "type": "boolean",
            "description": "Adds the DOB NOW job_description as description. Off by default. Emails and phone numbers are redacted, but people's names written in the text can remain.",
            "default": false
          },
          "includeBusinessNames": {
            "title": "Include business names (opt-in)",
            "type": "boolean",
            "description": "Adds the 'optin' business-name fields from field_allowlists.json inside source. Note: a business name can be a person's name (sole proprietors, LLCs named after people).",
            "default": false
          },
          "maxResults": {
            "title": "Max records per run",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Stop after this many charged permits have been pushed. State is saved and the run can resume. The Console form starts at 10. A call that omits this field still uses 5000.",
            "default": 5000
          },
          "maxPermitAgeDays": {
            "title": "Ignore permits issued more than N days ago",
            "minimum": 1,
            "maximum": 3650,
            "type": "integer",
            "description": "Old permits that NYC publishes late in bulk (backlog dumps) are skipped and not charged. Raise this to receive them.",
            "default": 90
          },
          "resetState": {
            "title": "Forget saved cursor and seen keys",
            "type": "boolean",
            "description": "Forget the saved cursor and seen keys for this stateKey and treat this run as a first run. Turn it off again after that run.",
            "default": false
          },
          "stateKey": {
            "title": "State key",
            "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
            "minLength": 1,
            "maxLength": 28,
            "type": "string",
            "description": "Names the saved cursor. The store is multi-city-permit-feed-state-<stateKey>. Use one key per schedule or filter setup. Changing filters or includeFreeText on an existing key does not re-deliver days already charged; use a new stateKey for that. Lowercase letters, digits, and hyphens, 1 to 28 characters. Default is default.",
            "default": "default"
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}