{
  "openapi": "3.0.1",
  "info": {
    "title": "US Building Permit Leads (15 City Open Data APIs)",
    "description": "New building permits from 15 US cities and counties, read from each city's official open data API. One clean table with job value, trade, contractor, address and coordinates. Filter by value, trade, ZIP or contractor, and get only new permits on scheduled runs.",
    "version": "0.0",
    "x-build-id": "FggtmyHqUDJg65M7A"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/benenjoyscoding~building-permit-leads/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-benenjoyscoding-building-permit-leads",
        "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/benenjoyscoding~building-permit-leads/runs": {
      "post": {
        "operationId": "runs-sync-benenjoyscoding-building-permit-leads",
        "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/benenjoyscoding~building-permit-leads/run-sync": {
      "post": {
        "operationId": "run-sync-benenjoyscoding-building-permit-leads",
        "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": {
          "sources": {
            "title": "Cities",
            "type": "array",
            "description": "Which cities and counties to read. Leave empty for all of them.",
            "items": {
              "type": "string",
              "enum": [
                "chicago",
                "new-york",
                "los-angeles",
                "seattle",
                "austin",
                "baton-rouge",
                "cincinnati",
                "montgomery-county-md-residential",
                "montgomery-county-md-commercial",
                "mesa",
                "new-orleans",
                "norfolk",
                "marin-county",
                "orlando",
                "corona"
              ],
              "enumTitles": [
                "Chicago, IL",
                "New York, NY",
                "Los Angeles, CA",
                "Seattle, WA",
                "Austin, TX",
                "Baton Rouge, LA",
                "Cincinnati, OH",
                "Montgomery County, MD (residential)",
                "Montgomery County, MD (commercial)",
                "Mesa, AZ",
                "New Orleans, LA",
                "Norfolk, VA",
                "Marin County, CA",
                "Orlando, FL",
                "Corona, CA"
              ]
            }
          },
          "daysBack": {
            "title": "Days back",
            "minimum": 1,
            "maximum": 3650,
            "type": "integer",
            "description": "Permits issued in the last this many days, counting today. Ignored when you set an issued-from date.",
            "default": 7
          },
          "issuedFrom": {
            "title": "Issued from (YYYY-MM-DD)",
            "type": "string",
            "description": "Optional. Start of a fixed date range, inclusive."
          },
          "issuedTo": {
            "title": "Issued to (YYYY-MM-DD)",
            "type": "string",
            "description": "Optional. End of a fixed date range, inclusive. Defaults to today."
          },
          "minValuation": {
            "title": "Minimum job value ($)",
            "minimum": 0,
            "type": "integer",
            "description": "Skip permits whose declared job value is below this. Permits with no value listed are skipped too when this is set."
          },
          "trades": {
            "title": "Trades",
            "type": "array",
            "description": "Keep permits that match any of these trades. Trades are tagged from the permit type and work description.",
            "items": {
              "type": "string",
              "enum": [
                "new-construction",
                "addition",
                "remodel",
                "roofing",
                "solar",
                "hvac",
                "electrical",
                "plumbing",
                "pool",
                "demolition",
                "fence",
                "windows-doors",
                "foundation",
                "fire-protection",
                "sign",
                "scaffolding",
                "sitework",
                "other"
              ]
            }
          },
          "keywords": {
            "title": "Keywords",
            "type": "array",
            "description": "Keep permits whose type or description contains any of these words (case does not matter).",
            "items": {
              "type": "string"
            }
          },
          "contractorContains": {
            "title": "Contractor name contains",
            "type": "array",
            "description": "Keep permits whose contractor name contains any of these words. Useful for tracking competitors.",
            "items": {
              "type": "string"
            }
          },
          "zipCodes": {
            "title": "ZIP codes",
            "type": "array",
            "description": "Keep permits in these 5-digit ZIP codes. Permits without a ZIP are skipped when this is set.",
            "items": {
              "type": "string"
            }
          },
          "requireContractor": {
            "title": "Only permits with a contractor named",
            "type": "boolean",
            "description": "Skip permits that list no contractor.",
            "default": false
          },
          "onlyNew": {
            "title": "Only new permits (for scheduled runs)",
            "type": "boolean",
            "description": "Remember which permits earlier runs delivered and skip them. Turn this on for a daily or weekly schedule so you only pay for fresh leads.",
            "default": false
          },
          "stateStoreName": {
            "title": "Memory name for only-new mode",
            "type": "string",
            "description": "Use a different name per saved task if you run several schedules with different filters.",
            "default": "building-permit-leads-state"
          },
          "maxResults": {
            "title": "Max permits per run",
            "minimum": 1,
            "type": "integer",
            "description": "Stop after this many permits in total. You pay per permit.",
            "default": 5000
          },
          "maxResultsPerSource": {
            "title": "Max permits per city",
            "minimum": 1,
            "type": "integer",
            "description": "Stop reading a city after this many permits.",
            "default": 1000
          },
          "socrataAppToken": {
            "title": "Socrata app token (optional)",
            "type": "string",
            "description": "A free app token from any Socrata open data portal raises the request rate. Not needed for normal runs."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}