{
  "openapi": "3.1.0",
  "info": {
    "title": "Permits N' More Public Website API",
    "version": "2026-07-28",
    "description": "Implemented public discovery and project-brief operations. This contract does not expose client documents, case status, signing, payment, representation approval, or agency submission."
  },
  "servers": [{ "url": "https://permitsnmore.org" }],
  "paths": {
    "/api/capabilities": {
      "get": {
        "operationId": "getPublicCapabilities",
        "summary": "Read the current public capability record",
        "responses": {
          "200": {
            "description": "Current capability document",
            "content": { "application/json": { "schema": { "$ref": "#/components/schemas/CapabilityDocument" } } }
          }
        }
      }
    },
    "/api/intake": {
      "post": {
        "operationId": "createProjectBrief",
        "summary": "Submit a bounded public project brief for human review",
        "description": "Creates or matches a private CRM lead after validation, honeypot handling, and rate limits. Submission does not authorize representation, filing, signature, attestation, payment, or agency submission. Do not send private case documents or sensitive personal information.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/ProjectBrief" },
              "example": {
                "fullName": "Authorized contact",
                "email": "contact@example.com",
                "phone": "+19095550100",
                "service": "Pre-lease feasibility",
                "city": "Ontario",
                "message": "Restaurant concept; comparing locations."
              }
            }
          }
        },
        "responses": {
          "200": { "$ref": "#/components/responses/AcceptedBrief" },
          "201": { "$ref": "#/components/responses/AcceptedBrief" },
          "202": { "$ref": "#/components/responses/AcceptedBrief" },
          "400": { "$ref": "#/components/responses/Problem" },
          "413": { "$ref": "#/components/responses/Problem" },
          "429": { "$ref": "#/components/responses/Problem" },
          "503": { "$ref": "#/components/responses/Problem" }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ProjectBrief": {
        "type": "object",
        "additionalProperties": false,
        "required": ["fullName", "email", "service"],
        "properties": {
          "fullName": { "type": "string", "minLength": 1, "maxLength": 120 },
          "email": { "type": "string", "format": "email", "maxLength": 254 },
          "phone": { "type": "string", "maxLength": 40 },
          "service": { "type": "string", "minLength": 1, "maxLength": 120 },
          "city": { "type": "string", "maxLength": 120 },
          "message": { "type": "string", "maxLength": 2000 },
          "company": { "type": "string", "maxLength": 200, "description": "Bot honeypot. Human and agent clients should omit this field." }
        }
      },
      "CapabilityDocument": {
        "type": "object",
        "required": ["id", "version", "status", "canonical_url", "public_capabilities", "unavailable_capabilities", "prohibited_agent_actions"],
        "properties": {
          "id": { "type": "string" },
          "version": { "type": "string" },
          "status": { "type": "string", "const": "current" },
          "canonical_url": { "type": "string", "format": "uri" },
          "last_reviewed": { "type": "string", "format": "date" },
          "organization": { "type": "object" },
          "public_capabilities": { "type": "array", "items": { "type": "object" } },
          "unavailable_capabilities": { "type": "array", "items": { "type": "object" } },
          "prohibited_agent_actions": { "type": "array", "items": { "type": "string" } },
          "services": { "type": "array", "items": { "type": "object" } },
          "policies": { "type": "object" }
        }
      },
      "Accepted": {
        "type": "object",
        "required": ["ok"],
        "properties": {
          "ok": { "type": "boolean", "const": true },
          "duplicate": { "type": "boolean" }
        }
      },
      "Problem": {
        "type": "object",
        "required": ["error"],
        "properties": { "error": { "type": "string" } }
      }
    },
    "responses": {
      "AcceptedBrief": {
        "description": "Brief accepted for private human review or bot honeypot quietly accepted",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Accepted" } } }
      },
      "Problem": {
        "description": "Validation, size, rate-limit, or availability error",
        "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Problem" } } }
      }
    }
  }
}
