{
  "openapi": "3.1.0",
  "info": {
    "title": "TBG — The Brett Group API",
    "version": "1.0.0",
    "description": "Look up service area, local permit rules and Maryland contractor-hiring rules, and send home project, lending or partner requests to TBG (Annapolis, MD). An MCP server with the same capabilities is at https://thebrettgroup.com/mcp. Never submit a request without the person's explicit consent."
  },
  "servers": [
    {
      "url": "https://thebrettgroup.com"
    }
  ],
  "paths": {
    "/api/agent/company": {
      "get": {
        "operationId": "getCompanyOverview",
        "summary": "What TBG does, who it serves, how matching works",
        "responses": {
          "200": {
            "description": "Company overview",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent/service-area": {
      "get": {
        "operationId": "checkServiceArea",
        "summary": "Check whether TBG serves a ZIP code or town",
        "parameters": [
          {
            "name": "zip",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "5-digit ZIP"
          },
          {
            "name": "town",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Town name"
          }
        ],
        "responses": {
          "200": {
            "description": "Coverage result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent/permits": {
      "get": {
        "operationId": "getLocalPermitGuidance",
        "summary": "Permit office and local rules for a project in Anne Arundel County / Annapolis",
        "parameters": [
          {
            "name": "zip",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "5-digit ZIP"
          },
          {
            "name": "town",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "Town name"
          },
          {
            "name": "project_type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            },
            "description": "kitchen, bathroom, addition, basement, deck, new custom home"
          }
        ],
        "responses": {
          "200": {
            "description": "Permit guidance",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent/hiring-checklist": {
      "get": {
        "operationId": "getHiringChecklist",
        "summary": "Maryland home improvement contractor hiring rules with official sources",
        "responses": {
          "200": {
            "description": "Checklist",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/agent/options": {
      "get": {
        "operationId": "listProjectOptions",
        "summary": "Valid form values and the consent text",
        "responses": {
          "200": {
            "description": "Options",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/lead": {
      "post": {
        "operationId": "submitRequest",
        "summary": "Send a home project, lending, build-to-rent or general request to TBG",
        "description": "Confirm details with the person and get explicit agreement to the consent text first.",
        "x-openai-isConsequential": true,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "service_line",
                  "name",
                  "phone",
                  "consent"
                ],
                "properties": {
                  "service_line": {
                    "type": "string",
                    "enum": [
                      "remodeling",
                      "new_home",
                      "lending",
                      "build_to_rent",
                      "property_services",
                      "other"
                    ]
                  },
                  "project_type": {
                    "type": "string",
                    "description": "Remodeling: kitchen, bathroom, additions, basement, custom-homes, decks-exteriors, other. Lending: fix_and_flip, construction, bridge, other."
                  },
                  "scope": {
                    "type": "string"
                  },
                  "zip": {
                    "type": "string",
                    "pattern": "^[0-9]{5}$"
                  },
                  "timeline": {
                    "type": "string"
                  },
                  "budget": {
                    "type": "string"
                  },
                  "details": {
                    "type": "string",
                    "maxLength": 2000
                  },
                  "name": {
                    "type": "string"
                  },
                  "phone": {
                    "type": "string",
                    "description": "10-digit US number"
                  },
                  "email": {
                    "type": "string"
                  },
                  "consent": {
                    "type": "string",
                    "enum": [
                      "yes"
                    ],
                    "description": "Only \"yes\" if the person explicitly agreed to: \"I agree that TBG may share my details with one licensed partner who may contact me by phone, text or email about this request. Consent is not a condition of any purchase. Message and data rates may apply.\""
                  },
                  "business_purpose": {
                    "type": "string",
                    "enum": [
                      "yes"
                    ],
                    "description": "Required for lending: the property is a business or investment property the borrower will not live in."
                  },
                  "agent_platform": {
                    "type": "string",
                    "description": "Name of the AI assistant submitting (marks the request as agent-submitted)."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Received",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "request_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "422": {
            "description": "Validation errors"
          }
        }
      }
    },
    "/api/partner": {
      "post": {
        "operationId": "applyToNetwork",
        "summary": "Apply to join the TBG partner network (contractors, trades, builders, lenders...)",
        "x-openai-isConsequential": true,
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "partner_type",
                  "contact_name",
                  "email",
                  "consent"
                ],
                "properties": {
                  "partner_type": {
                    "type": "string",
                    "enum": [
                      "general_contractor",
                      "subcontractor",
                      "home_builder",
                      "architect_designer",
                      "lender",
                      "agent_broker",
                      "property_manager",
                      "supplier",
                      "other"
                    ]
                  },
                  "company": {
                    "type": "string"
                  },
                  "contact_name": {
                    "type": "string"
                  },
                  "title": {
                    "type": "string"
                  },
                  "email": {
                    "type": "string"
                  },
                  "phone": {
                    "type": "string"
                  },
                  "company_website": {
                    "type": "string"
                  },
                  "trades": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "service_areas": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "license_info": {
                    "type": "string"
                  },
                  "years_in_business": {
                    "type": "string"
                  },
                  "team_size": {
                    "type": "string"
                  },
                  "insured": {
                    "type": "string"
                  },
                  "capital_info": {
                    "type": "string"
                  },
                  "notes": {
                    "type": "string"
                  },
                  "consent": {
                    "type": "string",
                    "enum": [
                      "yes"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Received"
          },
          "422": {
            "description": "Validation errors"
          }
        }
      }
    }
  }
}