{
  "openapi": "3.0.1",
  "info": {
    "title": "Building Permits Scraper - Socrata Open Data (Multi-City)",
    "description": "Scrape building and construction permits from any Socrata open-data portal (NYC, SF, Chicago, LA, and hundreds more). Pull issue date, permit and work type, status, address, contractor, owner, coordinates and every column the dataset exposes. HTTP-first, multi-city in one run.",
    "version": "1.2",
    "x-build-id": "snWgWTnXCW0zEml69"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/bujhmml~building-permits-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-bujhmml-building-permits-scraper",
        "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/bujhmml~building-permits-scraper/runs": {
      "post": {
        "operationId": "runs-sync-bujhmml-building-permits-scraper",
        "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/bujhmml~building-permits-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-bujhmml-building-permits-scraper",
        "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": {
          "domain": {
            "title": "Socrata domain",
            "type": "string",
            "description": "Open-data host, e.g. data.cityofnewyork.us, data.sfgov.org, data.cityofchicago.org. Leave empty if you use the Datasets list below."
          },
          "datasetId": {
            "title": "Dataset id (4x4)",
            "pattern": "^[a-z0-9]{4}-[a-z0-9]{4}$",
            "type": "string",
            "description": "Socrata dataset identifier, the 4x4 code from the dataset URL (e.g. ipu4-2q9a for NYC DOB Permit Issuance)."
          },
          "searchQuery": {
            "title": "Keyword search",
            "maxLength": 2000,
            "type": "string",
            "description": "Full-text search across all text columns, e.g. solar, roofing, HVAC, demolition. Matches any permit whose text mentions the keyword. Applied to every dataset in the run."
          },
          "dateField": {
            "title": "Date column",
            "type": "string",
            "description": "Column to filter by date, e.g. issuance_date, issued_date, status_date. Required if you set Date from / Date to. Column names differ per dataset — check the dataset's columns."
          },
          "dateFrom": {
            "title": "Date from",
            "type": "string",
            "description": "Keep permits with Date column on or after this date. Format YYYY-MM-DD (e.g. 2024-01-01). Needs Date column set."
          },
          "dateTo": {
            "title": "Date to",
            "type": "string",
            "description": "Keep permits with Date column on or before this date. Format YYYY-MM-DD (e.g. 2024-12-31). Needs Date column set."
          },
          "whereClause": {
            "title": "Filter (SoQL $where)",
            "maxLength": 2000,
            "type": "string",
            "description": "Optional raw SoQL filter, e.g. borough='MANHATTAN' or estimated_cost > 50000. AND-merged with the date filter above. Leave empty for everything."
          },
          "select": {
            "title": "Columns to keep (SoQL $select)",
            "maxLength": 2000,
            "type": "string",
            "description": "Comma-separated columns to return, e.g. issuance_date, permit_type, address. Slims output and lowers cost. Leave empty for all columns. :id is added automatically for deduplication on column projections. Raw SoQL scoped to this single public dataset; aggregates like count(*) or borough, count(*) as n with a GROUP BY are passed through as-is (no :id injection, no dedup)."
          },
          "datasets": {
            "title": "Datasets (multi-city)",
            "type": "array",
            "description": "Scrape several cities/datasets in one run. Each item: { \"domain\": \"data.sfgov.org\", \"datasetId\": \"i98e-djp9\", \"whereClause\": \"...\", \"dateField\": \"...\", \"dateFrom\": \"...\", \"dateTo\": \"...\" }. Per-item filters override the global ones; if omitted, the global values apply. Runs in addition to the single domain/datasetId above."
          },
          "maxItems": {
            "title": "Max results",
            "minimum": 0,
            "maximum": 10000000,
            "type": "integer",
            "description": "Stop after this many permit records across all datasets. 0 = no limit.",
            "default": 100
          },
          "order": {
            "title": "Sort order (SoQL $order)",
            "maxLength": 2000,
            "type": "string",
            "description": "Column(s) to sort by, e.g. issuance_date DESC for newest first. :id is always appended to keep pagination stable. Defaults to :id."
          },
          "appToken": {
            "title": "Socrata app token",
            "type": "string",
            "description": "Optional X-App-Token. Not required for moderate volume; raises Socrata's per-IP rate limits if you have one. A wrong token makes every request fail with 403."
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Apify Proxy. The Socrata API has no anti-bot, so proxies are optional; datacenter is plenty if you want one.",
            "default": {
              "useApifyProxy": false
            }
          }
        }
      },
      "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}