{
  "openapi": "3.0.1",
  "info": {
    "title": "Building Permits Leads: Contractor & Construction Data",
    "description": "Newly issued building permits from official city open-data portals in NYC, Chicago, Austin, Seattle and San Francisco. Filter by permit type, valuation and date. Records include address, permit type, valuation and contractor business name where published. Ready for contractors and suppliers.",
    "version": "0.1",
    "x-build-id": "o4iV54T5E7L77s7ne"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/ledgerstar~building-permits/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-ledgerstar-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/ledgerstar~building-permits/runs": {
      "post": {
        "operationId": "runs-sync-ledgerstar-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/ledgerstar~building-permits/run-sync": {
      "post": {
        "operationId": "run-sync-ledgerstar-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": "Leave empty for all supported cities.",
            "items": {
              "type": "string",
              "enum": [
                "nyc",
                "chicago",
                "austin",
                "seattle",
                "sf"
              ],
              "enumTitles": [
                "New York City",
                "Chicago",
                "Austin",
                "Seattle",
                "San Francisco"
              ]
            },
            "default": []
          },
          "daysBack": {
            "title": "Permits issued in the last N days",
            "minimum": 1,
            "maximum": 3650,
            "type": "integer",
            "description": "Look back this many days from today. Ignored when 'Issued on or after' is set.",
            "default": 30
          },
          "issuedFrom": {
            "title": "Issued on or after (optional)",
            "type": "string",
            "description": "Exact start date (YYYY-MM-DD). Overrides 'last N days'."
          },
          "newSince": {
            "title": "Only new since (optional, for scheduled runs)",
            "type": "string",
            "description": "Set to \"lastRun\" on a schedule to fetch only permits new since the previous run; a permit already delivered is never charged for twice. Or set an exact date (YYYY-MM-DD). Leave empty for a normal one-off run."
          },
          "permitTypes": {
            "title": "Permit / work type (optional)",
            "type": "array",
            "description": "Leave empty for all types.",
            "items": {
              "type": "string",
              "enum": [
                "new_construction",
                "addition_alteration",
                "demolition",
                "electrical",
                "plumbing",
                "mechanical",
                "other"
              ],
              "enumTitles": [
                "New construction",
                "Addition / alteration",
                "Demolition",
                "Electrical",
                "Plumbing",
                "Mechanical",
                "Other"
              ]
            },
            "default": []
          },
          "minValuation": {
            "title": "Minimum job valuation (USD, optional)",
            "minimum": 0,
            "type": "integer",
            "description": "Only permits with a published valuation at or above this amount. Not every city publishes a valuation; leave empty to include all."
          },
          "zipPrefixes": {
            "title": "ZIP codes or ZIP prefixes (optional)",
            "type": "array",
            "description": "e.g. 78701 for one ZIP, or 787 for a whole region. Chicago's dataset does not publish a site ZIP code and is unaffected by this filter.",
            "items": {
              "type": "string"
            }
          },
          "maxItems": {
            "title": "Maximum results",
            "minimum": 1,
            "maximum": 200000,
            "type": "integer",
            "description": "Stop after this many results. You are charged per result.",
            "default": 20
          },
          "maxRowsScanned": {
            "title": "Maximum source rows to scan",
            "minimum": 100,
            "maximum": 1000000,
            "type": "integer",
            "description": "Safety limit on how many raw rows are read while filtering, across all selected cities combined.",
            "default": 20000
          },
          "requestDelaySecs": {
            "title": "Seconds between requests to the same city",
            "minimum": 1,
            "maximum": 60,
            "type": "integer",
            "description": "Minimum delay between requests to the same source. Never less than 1 second.",
            "default": 1
          },
          "alertLookbackDays": {
            "title": "Alert-mode lookback (days)",
            "minimum": 1,
            "maximum": 30,
            "type": "integer",
            "description": "Only used with \"Only new since\" = lastRun. A safety margin re-checked on every scheduled run to cover late-posted records; already-delivered permits are never charged twice.",
            "default": 7
          },
          "appToken": {
            "title": "Socrata app token (optional)",
            "type": "string",
            "description": "Optional free app token from any of these cities' open data portals. Gives higher rate limits for very large pulls. Not needed for normal use."
          },
          "alertStateKey": {
            "title": "Alert mode: stable state name (optional)",
            "pattern": "^[a-z0-9-]{1,30}$",
            "type": "string",
            "description": "Only used with alert mode (newSince above). Give this a fixed name such as austin nightly so this schedule always uses the same saved last run date, even if you change other filters. Letters, numbers and hyphens only, up to 30 characters. Leave empty to have one chosen automatically based on your filters."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}