{
  "openapi": "3.1.0",
  "info": {
    "title": "Lapeep API",
    "version": "1.0.0",
    "description": "Lapeep REST API for AI sales, customer support, and booking. Public endpoints require no auth; workspace endpoints use Bearer JWT from POST /auth/login. Official docs: https://lapeep.com/docs"
  },
  "servers": [{ "url": "https://lapeep.com/api/v1" }],
  "tags": [
    { "name": "System", "description": "Health and readiness" },
    { "name": "Public", "description": "Marketing and signup surfaces" },
    { "name": "Auth", "description": "Authentication" }
  ],
  "paths": {
    "/health": {
      "get": {
        "tags": ["System"],
        "operationId": "getHealth",
        "summary": "Liveness probe",
        "security": [],
        "responses": {
          "200": {
            "description": "Service is up",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": { "status": { "type": "string", "example": "ok" } },
                  "required": ["status"]
                }
              }
            }
          }
        }
      }
    },
    "/health/ready": {
      "get": {
        "tags": ["System"],
        "operationId": "getReadiness",
        "summary": "Readiness probe",
        "security": [],
        "responses": {
          "200": { "description": "Ready" },
          "503": { "description": "Not ready" }
        }
      }
    },
    "/auth/login": {
      "post": {
        "tags": ["Auth"],
        "operationId": "login",
        "summary": "Obtain access and refresh tokens",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["email", "password"],
                "properties": {
                  "email": { "type": "string", "format": "email" },
                  "password": { "type": "string", "format": "password" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Tokens and user profile" },
          "401": { "description": "Invalid credentials" }
        }
      }
    },
    "/public/packages": {
      "get": {
        "tags": ["Public"],
        "operationId": "listPublicPackages",
        "summary": "List public signup packages",
        "security": [],
        "responses": { "200": { "description": "Package list" } }
      }
    },
    "/public/packages/signup-offer": {
      "get": {
        "tags": ["Public"],
        "operationId": "getSignupOffer",
        "summary": "Resolve signup offer for a plan slug",
        "security": [],
        "parameters": [
          { "name": "plan", "in": "query", "schema": { "type": "string" } },
          {
            "name": "billingInterval",
            "in": "query",
            "schema": { "type": "string", "enum": ["MONTHLY", "YEARLY"] }
          }
        ],
        "responses": { "200": { "description": "Signup offer" } }
      }
    },
    "/public/inquiries": {
      "post": {
        "tags": ["Public"],
        "operationId": "createPublicInquiry",
        "summary": "Submit a demo or contact inquiry",
        "security": [],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/CreateInquiry" }
            }
          }
        },
        "responses": {
          "201": { "description": "Inquiry accepted" },
          "429": { "description": "Rate limited" }
        }
      }
    },
    "/public/clinic-demos": {
      "get": {
        "tags": ["Public"],
        "operationId": "listPublicClinicDemos",
        "summary": "Public clinic demo categories",
        "security": [],
        "responses": { "200": { "description": "Demo categories" } }
      }
    },
    "/contacts": {
      "get": {
        "tags": ["Public"],
        "operationId": "listContacts",
        "summary": "List contacts (workspace)",
        "security": [{ "bearerAuth": ["contacts:read"] }],
        "responses": { "200": { "description": "Contact list" } }
      },
      "post": {
        "tags": ["Public"],
        "operationId": "createContact",
        "summary": "Create a contact (workspace)",
        "security": [{ "bearerAuth": ["contacts:write"] }],
        "responses": { "201": { "description": "Contact created" } }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "JWT from POST /auth/login"
      },
      "oauth2": {
        "type": "oauth2",
        "flows": {
          "password": {
            "tokenUrl": "https://lapeep.com/api/v1/auth/login",
            "scopes": {
              "openid": "OpenID Connect scope",
              "profile": "User profile",
              "health:read": "Read health endpoints",
              "packages:read": "Read public packages",
              "inquiries:write": "Submit marketing inquiries",
              "contacts:read": "Read contacts",
              "contacts:write": "Create and update contacts",
              "leads:read": "Read leads",
              "leads:write": "Create and update leads",
              "appointments:read": "Read appointments",
              "appointments:write": "Book and manage appointments",
              "inbox:read": "Read conversations",
              "messages:write": "Send messages",
              "knowledge:read": "Read knowledge base"
            }
          }
        }
      }
    },
    "schemas": {
      "CreateInquiry": {
        "type": "object",
        "required": ["type", "name"],
        "properties": {
          "type": { "type": "string", "enum": ["DEMO", "CONTACT"] },
          "name": { "type": "string", "maxLength": 120 },
          "email": { "type": "string", "format": "email" },
          "phone": { "type": "string" },
          "company": { "type": "string" },
          "message": { "type": "string" },
          "metadata": { "type": "object", "additionalProperties": true }
        }
      }
    }
  }
}
