{
  "openapi": "3.0.1",
  "info": {
    "title": "SF Building Permit Scraper",
    "description": "Scrape the official San Francisco Department of Building Inspection permit dataset. Search/filter by permit type, status, neighborhood, district, zip, use, construction type, cost, or date; lookup by permit number, property address, or assessor block/lot. Free Socrata API, no login.",
    "version": "1.0",
    "x-build-id": "uEsiTcau6by9qvmKT"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/crawlerbros~sf-building-permit-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-crawlerbros-sf-building-permit-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/crawlerbros~sf-building-permit-scraper/runs": {
      "post": {
        "operationId": "runs-sync-crawlerbros-sf-building-permit-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/crawlerbros~sf-building-permit-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-crawlerbros-sf-building-permit-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",
        "required": [
          "mode"
        ],
        "properties": {
          "mode": {
            "title": "Mode",
            "enum": [
              "search",
              "byPermitNumber",
              "byAddress",
              "byBlockLot"
            ],
            "type": "string",
            "description": "What to fetch.",
            "default": "search"
          },
          "searchQuery": {
            "title": "Full-text search",
            "type": "string",
            "description": "Free-text search across permit description, address, and other text fields (mode=search). Leave blank to browse without a text query."
          },
          "descriptionKeyword": {
            "title": "Description contains",
            "type": "string",
            "description": "Case-insensitive substring match on the permit's work description. Example: `kitchen remodel`."
          },
          "permitNumbers": {
            "title": "Permit numbers (mode=byPermitNumber)",
            "type": "array",
            "description": "Exact SF DBI permit numbers to fetch. Example: `201903226060`.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "streetNumber": {
            "title": "Street number (mode=byAddress)",
            "type": "string",
            "description": "Building street number. Example: `760`."
          },
          "streetName": {
            "title": "Street name (mode=byAddress)",
            "type": "string",
            "description": "Street name, without the suffix (St/Ave/Blvd). Example: `Market`."
          },
          "streetSuffix": {
            "title": "Street suffix (mode=byAddress, optional)",
            "type": "string",
            "description": "Optional street suffix to narrow the address match. Example: `St`."
          },
          "unit": {
            "title": "Unit number (mode=byAddress, optional)",
            "type": "string",
            "description": "Optional unit/suite number to narrow the address match."
          },
          "block": {
            "title": "Assessor block (mode=byBlockLot)",
            "type": "string",
            "description": "Assessor's block number. Example: `3537`."
          },
          "lot": {
            "title": "Assessor lot (mode=byBlockLot)",
            "type": "string",
            "description": "Assessor's lot number. Example: `027`."
          },
          "permitType": {
            "title": "Permit type",
            "enum": [
              "",
              "1",
              "2",
              "3",
              "4",
              "5",
              "6",
              "7",
              "8",
              "9"
            ],
            "type": "string",
            "description": "Filter to a single DBI permit type.",
            "default": ""
          },
          "status": {
            "title": "Status",
            "enum": [
              "",
              "complete",
              "issued",
              "expired",
              "cancelled",
              "filed",
              "withdrawn",
              "reinstated",
              "approved",
              "filing",
              "suspend",
              "disapproved",
              "triage",
              "revoked",
              "plancheck",
              "appeal",
              "issuing",
              "denied",
              "inspection",
              "incomplete",
              "unknown",
              "upheld",
              "granted",
              "overruled"
            ],
            "type": "string",
            "description": "Filter to a single current permit status.",
            "default": ""
          },
          "neighborhood": {
            "title": "Neighborhood",
            "enum": [
              "",
              "Bayview Hunters Point",
              "Bernal Heights",
              "Castro/Upper Market",
              "Chinatown",
              "Excelsior",
              "Financial District/South Beach",
              "Glen Park",
              "Golden Gate Park",
              "Haight Ashbury",
              "Hayes Valley",
              "Inner Richmond",
              "Inner Sunset",
              "Japantown",
              "Lakeshore",
              "Lincoln Park",
              "Lone Mountain/USF",
              "Marina",
              "McLaren Park",
              "Mission",
              "Mission Bay",
              "Nob Hill",
              "Noe Valley",
              "North Beach",
              "Oceanview/Merced/Ingleside",
              "Outer Mission",
              "Outer Richmond",
              "Pacific Heights",
              "Portola",
              "Potrero Hill",
              "Presidio",
              "Presidio Heights",
              "Russian Hill",
              "Seacliff",
              "South of Market",
              "Sunset/Parkside",
              "Tenderloin",
              "Treasure Island",
              "Twin Peaks",
              "Visitacion Valley",
              "Western Addition",
              "West of Twin Peaks"
            ],
            "type": "string",
            "description": "Filter to a single SF analysis neighborhood.",
            "default": ""
          },
          "supervisorDistrict": {
            "title": "Supervisor district",
            "enum": [
              "",
              "1",
              "2",
              "3",
              "4",
              "5",
              "6",
              "7",
              "8",
              "9",
              "10",
              "11"
            ],
            "type": "string",
            "description": "Filter to a single SF Board of Supervisors district (1-11).",
            "default": ""
          },
          "zipcode": {
            "title": "Zip code",
            "enum": [
              "",
              "94080",
              "94102",
              "94103",
              "94104",
              "94105",
              "94107",
              "94108",
              "94109",
              "94110",
              "94111",
              "94112",
              "94114",
              "94115",
              "94116",
              "94117",
              "94118",
              "94121",
              "94122",
              "94123",
              "94124",
              "94126",
              "94127",
              "94129",
              "94130",
              "94131",
              "94132",
              "94133",
              "94134",
              "94158",
              "94965"
            ],
            "type": "string",
            "description": "Filter to a single SF zip code.",
            "default": ""
          },
          "existingUse": {
            "title": "Existing use",
            "enum": [
              "",
              "1 family dwelling",
              "2 family dwelling",
              "accessory cottage",
              "adult entertainment",
              "ambulance service",
              "amusement center",
              "animal sale or care",
              "antenna",
              "apartments",
              "aquarium",
              "artist live/work",
              "auto repairs",
              "automobile sales",
              "barber/beauty salon",
              "bath house",
              "building materials",
              "car wash",
              "chemical processing",
              "child care",
              "christmas tree lot",
              "church",
              "clinics-medic/dental",
              "club",
              "consulate",
              "convalescent home",
              "dairies/dairy equip.",
              "dance hall",
              "day care center",
              "day care home 7 - 12",
              "day care home gt 12",
              "day care home lt 7",
              "day care, non-res",
              "dry cleaners",
              "explosives handling",
              "fence/retaining wall",
              "filling/service stn",
              "food/beverage hndlng",
              "garment shops",
              "greenhouse",
              "health studios & gym",
              "hospital",
              "jail",
              "laundry/laundromat",
              "lending institution",
              "library",
              "manufacturing",
              "massage parlor",
              "meat/produce marts",
              "misc group residns.",
              "mortuary",
              "moving & storage",
              "muni carbarn",
              "muni driver restroom",
              "museum",
              "newspaper/magazine",
              "nite club",
              "not applicable",
              "nursery(floral)",
              "nursing home gt 6",
              "nursing home lte 6",
              "nursing home non amb",
              "office",
              "orphanage",
              "paint store",
              "parking lot",
              "phone xchnge/equip",
              "power plant",
              "printing plant",
              "prkng garage/private",
              "prkng garage/public",
              "prson'l svc tutor",
              "public assmbly other",
              "r-3(dwg) nursing",
              "radio & tv stations",
              "recreation bldg",
              "residential hotel",
              "retail sales",
              "roofing materials",
              "school",
              "sewage plant",
              "sfpd or sffd station",
              "sign",
              "social care facility",
              "sound studio",
              "stadium",
              "stock exchange",
              "storage shed",
              "storage tanks",
              "swimming pool",
              "temple",
              "theater",
              "tourist hotel/motel",
              "tower",
              "vacant lot",
              "warehouse, furniture",
              "warehouse,no frnitur",
              "wholesale sales",
              "workshop commercial",
              "workshop residential"
            ],
            "type": "string",
            "description": "Filter by the property's existing (pre-permit) use category.",
            "default": ""
          },
          "proposedUse": {
            "title": "Proposed use",
            "enum": [
              "",
              "1 family dwelling",
              "2 family dwelling",
              "accessory cottage",
              "adult entertainment",
              "ambulance service",
              "amusement center",
              "animal sale or care",
              "antenna",
              "apartments",
              "aquarium",
              "artist live/work",
              "auto repairs",
              "automobile sales",
              "barber/beauty salon",
              "bath house",
              "building materials",
              "car wash",
              "chemical processing",
              "child care",
              "christmas tree lot",
              "church",
              "clinics-medic/dental",
              "club",
              "consulate",
              "convalescent home",
              "dairies/dairy equip.",
              "dance hall",
              "day care center",
              "day care home 7 - 12",
              "day care home gt 12",
              "day care home lt 7",
              "day care, non-res",
              "dry cleaners",
              "explosives handling",
              "fence/retaining wall",
              "filling/service stn",
              "food/beverage hndlng",
              "garment shops",
              "greenhouse",
              "health studios & gym",
              "hospital",
              "jail",
              "laundry/laundromat",
              "lending institution",
              "library",
              "manufacturing",
              "massage parlor",
              "meat/produce marts",
              "misc group residns.",
              "mortuary",
              "moving & storage",
              "muni carbarn",
              "muni driver restroom",
              "museum",
              "newspaper/magazine",
              "nite club",
              "not applicable",
              "nursery(floral)",
              "nursing home gt 6",
              "nursing home lte 6",
              "nursing home non amb",
              "office",
              "orphanage",
              "paint store",
              "parking lot",
              "phone xchnge/equip",
              "power plant",
              "printing plant",
              "prkng garage/private",
              "prkng garage/public",
              "prson'l svc tutor",
              "public assmbly other",
              "r-3(dwg) nursing",
              "radio & tv stations",
              "recreation bldg",
              "residential hotel",
              "retail sales",
              "roofing materials",
              "school",
              "sewage plant",
              "sfpd or sffd station",
              "sign",
              "social care facility",
              "sound studio",
              "stadium",
              "stock exchange",
              "storage shed",
              "storage tanks",
              "swimming pool",
              "temple",
              "theater",
              "tourist hotel/motel",
              "tower",
              "vacant lot",
              "warehouse, furniture",
              "warehouse,no frnitur",
              "wholesale sales",
              "workshop commercial",
              "workshop residential"
            ],
            "type": "string",
            "description": "Filter by the property's proposed (post-permit) use category.",
            "default": ""
          },
          "existingConstructionType": {
            "title": "Existing construction type",
            "enum": [
              "",
              "1",
              "2",
              "3",
              "4",
              "5",
              "B",
              "F",
              "H",
              "I",
              "III",
              "V"
            ],
            "type": "string",
            "description": "Filter by the building's existing construction type code.",
            "default": ""
          },
          "proposedConstructionType": {
            "title": "Proposed construction type",
            "enum": [
              "",
              "1",
              "2",
              "3",
              "4",
              "5",
              "B",
              "F",
              "H",
              "I",
              "III",
              "V"
            ],
            "type": "string",
            "description": "Filter by the building's proposed construction type code.",
            "default": ""
          },
          "filedDateFrom": {
            "title": "Filed date from (YYYY-MM-DD)",
            "type": "string",
            "description": "Drop permits filed before this date."
          },
          "filedDateTo": {
            "title": "Filed date to (YYYY-MM-DD)",
            "type": "string",
            "description": "Drop permits filed after this date."
          },
          "issuedDateFrom": {
            "title": "Issued date from (YYYY-MM-DD)",
            "type": "string",
            "description": "Drop permits issued before this date."
          },
          "issuedDateTo": {
            "title": "Issued date to (YYYY-MM-DD)",
            "type": "string",
            "description": "Drop permits issued after this date."
          },
          "minEstimatedCost": {
            "title": "Min estimated cost (USD)",
            "minimum": 0,
            "maximum": 1000000000,
            "type": "number",
            "description": "Drop permits with a lower estimated construction cost than this."
          },
          "maxEstimatedCost": {
            "title": "Max estimated cost (USD)",
            "minimum": 0,
            "maximum": 1000000000,
            "type": "number",
            "description": "Drop permits with a higher estimated construction cost than this."
          },
          "nearLatitude": {
            "title": "Near latitude (mode=search)",
            "minimum": -90,
            "maximum": 90,
            "type": "number",
            "description": "Only include permits within `nearRadiusMeters` of this latitude/longitude point. Must be combined with Near longitude. Example: `37.7749` (SF Civic Center area)."
          },
          "nearLongitude": {
            "title": "Near longitude (mode=search)",
            "minimum": -180,
            "maximum": 180,
            "type": "number",
            "description": "Longitude for the geographic radius filter. Must be combined with Near latitude. Example: `-122.4194`."
          },
          "nearRadiusMeters": {
            "title": "Near radius (meters)",
            "minimum": 1,
            "maximum": 5000,
            "type": "number",
            "description": "Radius in meters around the Near latitude/longitude point. Only applies when both are set.",
            "default": 500
          },
          "aduOnly": {
            "title": "Only ADU permits",
            "type": "boolean",
            "description": "Only include permits for Accessory Dwelling Units.",
            "default": false
          },
          "fireOnlyPermitOnly": {
            "title": "Only fire-only permits",
            "type": "boolean",
            "description": "Only include permits flagged as fire-department-only permits.",
            "default": false
          },
          "sitePermitOnly": {
            "title": "Only site permits",
            "type": "boolean",
            "description": "Only include permits flagged as site permits (large multi-phase projects).",
            "default": false
          },
          "structuralNotificationOnly": {
            "title": "Only permits with a structural notification",
            "type": "boolean",
            "description": "Only include permits that carry a structural notification flag.",
            "default": false
          },
          "voluntarySoftStoryRetrofitOnly": {
            "title": "Only voluntary soft-story retrofit permits",
            "type": "boolean",
            "description": "Only include permits flagged as voluntary soft-story seismic retrofits.",
            "default": false
          },
          "reroofOnly": {
            "title": "Only reroofing permits",
            "type": "boolean",
            "description": "Only include permits flagged as reroofing work.",
            "default": false
          },
          "sortBy": {
            "title": "Sort by",
            "enum": [
              "filedDateDesc",
              "filedDateAsc",
              "issuedDateDesc",
              "issuedDateAsc",
              "statusDateDesc",
              "statusDateAsc",
              "estimatedCostDesc",
              "estimatedCostAsc"
            ],
            "type": "string",
            "description": "Sort order for results.",
            "default": "filedDateDesc"
          },
          "appToken": {
            "title": "Socrata app token (optional)",
            "type": "string",
            "description": "Optional free Socrata app token to raise API rate limits. Get one at https://data.sfgov.org/profile/app_tokens. Not required — the actor works without it."
          },
          "maxItems": {
            "title": "Max items",
            "minimum": 1,
            "maximum": 10000,
            "type": "integer",
            "description": "Hard cap on emitted records.",
            "default": 50
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}