{
  "openapi": "3.0.1",
  "info": {
    "title": "US Building Permits - Contractor Leads with Delta Mode",
    "description": "Building permits from 9 US cities via official open-data APIs: contractor name, licence and phone, job value, GPS, trade tagged (roofing, solar, HVAC, electrical, plumbing) and a lead score. Delta mode delivers and charges only the permits that are new since your last run.",
    "version": "1.0",
    "x-build-id": "GH6V1h5owQCe99P8A"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/wellbuilt_zythem~us-building-permits/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-wellbuilt_zythem-us-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/wellbuilt_zythem~us-building-permits/runs": {
      "post": {
        "operationId": "runs-sync-wellbuilt_zythem-us-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/wellbuilt_zythem~us-building-permits/run-sync": {
      "post": {
        "operationId": "run-sync-wellbuilt_zythem-us-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 nine. Each city comes from its own official open-data API, so it never breaks because a website changed its layout.",
            "items": {
              "type": "string",
              "enum": [
                "orlando",
                "austin",
                "new_orleans",
                "seattle",
                "cincinnati",
                "baton_rouge",
                "marin_county",
                "new_york",
                "chicago"
              ],
              "enumTitles": [
                "Orlando, FL (contractor + phone, ~2,300 permits/month)",
                "Austin, TX (contractor + phone + trade, ~5,000/month)",
                "New Orleans, LA (contractor + licence, ~1,600/month)",
                "Seattle, WA (contractor on trade permits, ~1,900/month)",
                "Cincinnati, OH (contractor, ~800/month)",
                "Baton Rouge, LA (contractor, ~600/month)",
                "Marin County, CA (contractor + licence, ~360/month)",
                "New York City (DOB NOW: business + licence + job cost)",
                "Chicago, IL (contractor contacts, ~2,900/month)"
              ]
            }
          },
          "trades": {
            "title": "Trades",
            "type": "array",
            "description": "Keep only permits for these trades, classified from the permit type and description. Leave empty for all.",
            "items": {
              "type": "string",
              "enum": [
                "roofing",
                "solar",
                "hvac",
                "electrical",
                "plumbing",
                "remodel",
                "new_construction",
                "demolition",
                "pool",
                "fence",
                "other"
              ],
              "enumTitles": [
                "Roofing",
                "Solar / PV / battery",
                "HVAC / mechanical",
                "Electrical",
                "Plumbing / sewer / water heater",
                "Remodel / alteration / addition",
                "New construction",
                "Demolition",
                "Pool / spa",
                "Fence",
                "Other"
              ]
            }
          },
          "lastNDays": {
            "title": "Issued in the last N days",
            "minimum": 1,
            "maximum": 3650,
            "type": "integer",
            "description": "Permits issued in this many days before today. Ignored when \"Issued from\" is set, and in delta mode once a first run has stored its watermark.",
            "default": 7
          },
          "dateFrom": {
            "title": "Issued from (YYYY-MM-DD)",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "type": "string",
            "description": "Optional exact start date, overrides \"last N days\"."
          },
          "dateTo": {
            "title": "Issued to (YYYY-MM-DD)",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "type": "string",
            "description": "Optional exact end date, inclusive."
          },
          "onlyWithContractor": {
            "title": "Only permits with a contractor name",
            "type": "boolean",
            "description": "Drop permits pulled by the owner or with no contractor on file. Filtered-out rows cost nothing.",
            "default": true
          },
          "minValuation": {
            "title": "Minimum job value (USD)",
            "minimum": 0,
            "type": "integer",
            "description": "Keep permits with a declared job value at or above this. 0 keeps everything, including permits with no value declared.",
            "default": 0
          },
          "keyword": {
            "title": "Keyword in description",
            "type": "string",
            "description": "Case-insensitive match on the permit description, type or work class, e.g. \"re-roof\" or \"generator\"."
          },
          "onlyNew": {
            "title": "Delta mode: only permits not delivered before",
            "type": "boolean",
            "description": "Remembers what each run delivered (per city, in a key-value store on your account) and next time returns only new permits. Schedule the actor daily and you get a clean feed of fresh leads, paying only for the new ones. Keep the filters below stable while a feed runs: a permit skipped by a filter is not remembered, so widening the filters later will not bring back permits older than the feed's current position. To change filters, use a new store name or tick \"Reset delta state\".",
            "default": false
          },
          "stateStoreName": {
            "title": "Delta state store name",
            "type": "string",
            "description": "Name of the key-value store that keeps the delta watermark. Use different names to run independent feeds (one per client, one per trade).",
            "default": "us-permits-seen"
          },
          "resetState": {
            "title": "Reset delta state",
            "type": "boolean",
            "description": "Forget what was delivered before and start the feed again from \"last N days\".",
            "default": false
          },
          "maxResults": {
            "title": "Max results",
            "minimum": 0,
            "type": "integer",
            "description": "Stop after this many permits across all cities. 0 = no limit.",
            "default": 0
          },
          "socrataAppToken": {
            "title": "Socrata app token (optional)",
            "type": "string",
            "description": "Free token from any Socrata portal. Without it the run shares the public rate limit; with it you get your own. Only needed for very large pulls."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}