{
  "openapi": "3.0.1",
  "info": {
    "title": "Nashville Building Permits (Enriched)",
    "description": "Davidson County TN permits and applications, joined to the licensed contractor, property owner, sub-trade permits, and inspection stage. Pay per record.",
    "version": "0.1",
    "x-build-id": "h3AzlC1sd9XfTB3b9"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/perchpermits~nashville-building-permits/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-perchpermits-nashville-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/perchpermits~nashville-building-permits/runs": {
      "post": {
        "operationId": "runs-sync-perchpermits-nashville-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/perchpermits~nashville-building-permits/run-sync": {
      "post": {
        "operationId": "run-sync-perchpermits-nashville-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": {
          "mode": {
            "title": "Mode",
            "enum": [
              "search",
              "contractors"
            ],
            "type": "string",
            "description": "`search` returns one row per permit. `contractors` returns one row per contractor, ranked by permit count and valuation across the matching permits.",
            "default": "search"
          },
          "datasets": {
            "title": "Datasets",
            "enum": [
              "both",
              "issued",
              "applications"
            ],
            "type": "string",
            "description": "`issued` = permits already issued (date filter applies to issue date). `applications` = filed but not yet issued, an early signal (date filter applies to filing date). `both` merges them.",
            "default": "both"
          },
          "dateFrom": {
            "title": "Date from",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "type": "string",
            "description": "ISO date (YYYY-MM-DD). Defaults to 90 days ago when no other narrowing filter is given."
          },
          "dateTo": {
            "title": "Date to",
            "pattern": "^\\d{4}-\\d{2}-\\d{2}$",
            "type": "string",
            "description": "ISO date (YYYY-MM-DD), inclusive. Defaults to today."
          },
          "scope": {
            "title": "Scope of work",
            "enum": [
              "any",
              "kitchen",
              "bathroom",
              "interior_remodel",
              "addition",
              "new_construction",
              "adu",
              "roofing",
              "pool",
              "fence",
              "deck",
              "garage",
              "demolition",
              "solar",
              "hvac",
              "electrical",
              "plumbing",
              "foundation",
              "windows_doors",
              "commercial",
              "multifamily",
              "short_term_rental",
              "sign"
            ],
            "type": "string",
            "description": "Preset classifier applied to the permit type, subtype, and description. Presets strip boilerplate (for example 'not to add a second kitchen') before matching.",
            "default": "any"
          },
          "keyword": {
            "title": "Keyword in description",
            "type": "string",
            "description": "Free-text substring matched against the permit description on the server (case-insensitive). Combine with a scope or use alone."
          },
          "address": {
            "title": "Address contains",
            "type": "string",
            "description": "Substring of the street address, e.g. `1234 WOODLAND ST`. Metro stores addresses upper-case without unit numbers."
          },
          "parcel": {
            "title": "Parcel ID",
            "type": "string",
            "description": "Exact Davidson County parcel ID, e.g. `08309024300`."
          },
          "zips": {
            "title": "ZIP codes",
            "type": "array",
            "description": "Restrict to these ZIP codes.",
            "items": {
              "type": "string"
            }
          },
          "applicant": {
            "title": "Applicant contains",
            "type": "string",
            "description": "Substring of the applicant / contact on the open dataset (the paperwork filer, often the contractor)."
          },
          "permitNumber": {
            "title": "Permit number",
            "type": "string",
            "description": "Exact permit number, e.g. `2026045225`. Use with `enrich` for a full case lookup."
          },
          "permitType": {
            "title": "Permit type contains",
            "type": "string",
            "description": "Substring of Metro's permit type or subtype description, e.g. `Residential - Rehab`, `Swimming Pool`, `Demolition`."
          },
          "minValuation": {
            "title": "Minimum declared cost (USD)",
            "minimum": 0,
            "type": "integer",
            "description": "Only permits with a declared construction cost at or above this amount."
          },
          "maxValuation": {
            "title": "Maximum declared cost (USD)",
            "minimum": 0,
            "type": "integer",
            "description": "Only permits with a declared construction cost at or below this amount."
          },
          "residentialOnly": {
            "title": "Residential only",
            "type": "boolean",
            "description": "Drop permits whose type or description reads as commercial.",
            "default": false
          },
          "maxRecords": {
            "title": "Max records",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Cap on rows returned (permits in search mode, contractors in contractors mode).",
            "default": 200
          },
          "enrich": {
            "title": "Enrich from ePermits",
            "type": "boolean",
            "description": "Join each permit to Metro ePermits: licensed contractor (name, license, phone), property owner, required sub-trade permits with satisfied/outstanding status, and inspection stage. About one second per permit, politely rate-limited. Billed as `enriched-permit` instead of `permit`.",
            "default": false
          },
          "enrichMaxAgeDays": {
            "title": "Reuse cached enrichment younger than (days)",
            "minimum": 0,
            "maximum": 90,
            "type": "integer",
            "description": "Enrichment fetched more recently than this is served from cache instead of re-querying ePermits. Set 0 to always refetch.",
            "default": 7
          },
          "maxPermitsScanned": {
            "title": "Max permits to rank over",
            "minimum": 10,
            "maximum": 20000,
            "type": "integer",
            "description": "Contractors mode only: how many matching permits (newest first) feed the ranking. Not billed; only the contractor rows are.",
            "default": 2000
          },
          "minPermits": {
            "title": "Min permits per contractor",
            "minimum": 1,
            "type": "integer",
            "description": "Contractors mode only: hide contractors with fewer matching permits than this.",
            "default": 1
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}