{
  "openapi": "3.1.0",
  "info": {
    "title": "US Public-Works Unit Price Bid Index & Commercial Infrastructure Siting API",
    "version": "1.0.0",
    "summary": "Math-verified US municipal civil contractor unit prices, material cost percentiles, and quantified Data Center, BESS, solar, and commercial zoning filings.",
    "description": "Provided by P4013 Ventures LLC across 156 US municipalities, counties, water/sewer districts, transit authorities, and port commissions. Every contractor unit price is penny-exact verified and paired with a 15-minute encrypted WebP scan of the source government page.",
    "termsOfService": "https://api.p4013.ventures/v1/terms",
    "contact": {
      "name": "P4013 Ventures LLC Support",
      "url": "https://p4013.ventures",
      "email": "support@p4013.ventures"
    }
  },
  "servers": [
    {
      "url": "https://api.p4013.ventures",
      "description": "Global Cloudflare Edge Gateway"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    },
    {
      "ApiKeyHeader": []
    }
  ],
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Direct P4013 API Key (`Authorization: Bearer p4013_...`)"
      },
      "ApiKeyHeader": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key",
        "description": "API Key via `X-API-Key` header"
      }
    }
  },
  "paths": {
    "/health": {
      "get": {
        "operationId": "getSystemHealth",
        "summary": "Live archive statistics and daily scraper heartbeat",
        "security": [],
        "responses": {
          "200": {
            "description": "Archive health and record counts"
          }
        }
      }
    },
    "/v1/sample": {
      "get": {
        "operationId": "getFreeSample",
        "summary": "Free unauthenticated preview (10 unit prices + 10 commercial siting filings)",
        "security": [],
        "responses": {
          "200": {
            "description": "Sample dataset preview"
          }
        }
      }
    },
    "/v1/jurisdictions": {
      "get": {
        "operationId": "getJurisdictionCoverage",
        "summary": "Aggregated state coverage counts, or masked jurisdiction list for a specific 2-letter state",
        "parameters": [
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Optional 2-letter US state code (e.g. TX, CA, FL, OH). Requires authentication."
          }
        ],
        "responses": {
          "200": {
            "description": "Jurisdiction coverage summary"
          }
        }
      }
    },
    "/v1/bids": {
      "get": {
        "operationId": "searchContractorUnitPrices",
        "summary": "Search penny-exact verified public-works contractor unit prices",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Material or civil item keyword (e.g. `ductile pipe`, `asphalt`, `curb`, `manhole`)"
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "2-letter US state code"
          },
          {
            "name": "unit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Canonical unit (`LF`, `SY`, `CY`, `SF`, `TON`, `EA`, `LS`, `HR`, `DAY`, `GAL`)"
          },
          {
            "name": "jurisdiction_code",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Public jurisdiction code (e.g. `US-TX-001`)"
          },
          {
            "name": "jurisdiction",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "City, county, or district name substring"
          },
          {
            "name": "bidder",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Contractor company name substring"
          },
          {
            "name": "date_from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 15,
              "maximum": 15
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 0,
              "maximum": 150
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Verified contractor unit price rows with 15-minute encrypted proof image URLs"
          }
        }
      }
    },
    "/v1/benchmarks": {
      "get": {
        "operationId": "getUnitPriceBenchmarks",
        "summary": "Compute min, P25, median, P75, P90, and average unit prices by state and material",
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Dynamic civil item keyword (e.g. `asphalt`, `hydrant`, `curb`)"
          },
          {
            "name": "material_family",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "DUCTILE_IRON_PIPE",
                "DUCTILE_IRON_FITTINGS",
                "PVC_HDPE_PIPE",
                "PVC_HDPE_FITTINGS",
                "REINFORCED_CONCRETE_PIPE",
                "ASPHALT_PAVING",
                "PAVEMENT_MILLING_REMOVAL",
                "CONCRETE_CURB_AND_GUTTER",
                "CONCRETE_SIDEWALK_RAMP",
                "AGGREGATE_BASE_COURSE",
                "MANHOLE_STRUCTURES",
                "VALVES_AND_HYDRANTS",
                "EXCAVATION_EARTHWORK",
                "PAVEMENT_STRIPING",
                "SEWER_CCTV_AND_CLEANING"
              ]
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "unit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Aggregated statistical unit-cost percentiles"
          }
        }
      }
    },
    "/v1/siting": {
      "get": {
        "operationId": "searchInfrastructureSiting",
        "summary": "Search Data Center, BESS battery, utility solar/substation, logistics, rezoning, and CIP filings",
        "parameters": [
          {
            "name": "category",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "DATA_CENTER",
                "BESS_BATTERY",
                "UTILITY_SOLAR_SUBSTATION",
                "INDUSTRIAL_LOGISTICS",
                "COMMERCIAL_REZONING",
                "CAPITAL_IMPROVEMENT",
                "MORATORIUM_ORDINANCE"
              ]
            }
          },
          {
            "name": "state",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "min_acres",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "min_mw",
            "in": "query",
            "required": false,
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "date_from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 15,
              "maximum": 15
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "default": 0,
              "maximum": 150
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Structured commercial infrastructure & siting records"
          }
        }
      }
    }
  }
}