{
  "openapi": "3.0.3",
  "info": {
    "title": "Mavaul site API",
    "version": "1.0.0",
    "description": "Read-only catalog of the public Mavaul website. Use it to find product, guide, blog, and legal pages. This API does not upload, list, or decrypt photos. No authentication.",
    "contact": {
      "email": "hello@mavaul.com",
      "url": "https://mavaul.com/docs/"
    }
  },
  "servers": [
    {
      "url": "https://mavaul.com",
      "description": "Production"
    }
  ],
  "tags": [
    {
      "name": "catalog",
      "description": "Machine-readable pages and product facts"
    }
  ],
  "paths": {
    "/api/ai": {
      "get": {
        "operationId": "getAiCatalog",
        "tags": ["catalog"],
        "summary": "Get the public page catalog",
        "description": "Returns the Mavaul website catalog: page URLs, Markdown mirrors, and product facts. Call this when an agent needs a list of canonical pages or a filtered slice of that list. Omit category for the full catalog. No authentication.",
        "parameters": [
          {
            "name": "category",
            "in": "query",
            "required": false,
            "description": "Limit pages to one section of the site. Omit this parameter to return every page.",
            "schema": {
              "type": "string",
              "enum": ["product", "guides", "blog", "legal"]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Catalog JSON. The same document as /ai-data.json, filtered when category is set.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AiCatalog"
                }
              }
            }
          },
          "400": {
            "description": "The category query parameter is not one of the allowed values.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "405": {
            "description": "The method is not GET, HEAD, or OPTIONS.",
            "headers": {
              "Allow": {
                "description": "Methods the route accepts.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "The catalog file could not be read.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/health": {
      "get": {
        "operationId": "getApiHealth",
        "tags": ["catalog"],
        "summary": "Check that the site API is serving",
        "description": "Returns ok when the public site API can answer. Call this before getAiCatalog when an agent needs a health indication. No authentication. This does not check the Mavaul app or anyone's vault.",
        "parameters": [],
        "responses": {
          "200": {
            "description": "The site API is serving.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": ["status"],
                  "properties": {
                    "status": {
                      "type": "string",
                      "enum": ["ok"]
                    }
                  }
                }
              }
            }
          },
          "405": {
            "description": "The method is not GET, HEAD, or OPTIONS.",
            "headers": {
              "Allow": {
                "description": "Methods the route accepts.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AiCatalog": {
        "type": "object",
        "required": ["name", "site_url", "pages"],
        "properties": {
          "schema_version": { "type": "string" },
          "generated": { "type": "string", "description": "Date the catalog was generated, YYYY-MM-DD." },
          "name": { "type": "string" },
          "site_url": { "type": "string", "format": "uri" },
          "tagline": { "type": "string" },
          "description": { "type": "string" },
          "contact_email": { "type": "string", "format": "email" },
          "platforms": {
            "type": "array",
            "items": { "type": "string" }
          },
          "llms_txt": { "type": "string", "format": "uri" },
          "llms_full_txt": { "type": "string", "format": "uri" },
          "pages": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/CatalogPage" }
          },
          "markdown_pages": {
            "type": "array",
            "items": { "type": "string", "format": "uri" }
          },
          "facts": { "$ref": "#/components/schemas/CatalogFacts" }
        }
      },
      "CatalogPage": {
        "type": "object",
        "required": ["title", "url", "markdown_url", "description", "category"],
        "properties": {
          "title": { "type": "string" },
          "url": { "type": "string", "format": "uri" },
          "markdown_url": { "type": "string", "format": "uri" },
          "description": { "type": "string" },
          "category": {
            "type": "string",
            "enum": ["product", "guides", "blog", "legal"]
          },
          "published": { "type": "string" }
        }
      },
      "CatalogFacts": {
        "type": "object",
        "properties": {
          "privacy_model": {
            "type": "object",
            "properties": {
              "local_first": { "type": "boolean" },
              "cloud_by_default": { "type": "boolean" },
              "hosts_backups": { "type": "boolean" },
              "zero_knowledge_goal": { "type": "boolean" }
            }
          },
          "security": {
            "type": "object",
            "properties": {
              "encryption": { "type": "string" },
              "access_controls": {
                "type": "array",
                "items": { "type": "string" }
              },
              "optional_premium_features": {
                "type": "array",
                "items": { "type": "string" }
              }
            }
          },
          "citation_guidance": { "type": "string" }
        }
      },
      "ErrorBody": {
        "type": "object",
        "required": ["code", "message", "hint"],
        "properties": {
          "code": {
            "type": "string",
            "description": "Stable machine-readable error code.",
            "enum": ["invalid_category", "method_not_allowed", "not_found", "ai_data_unavailable", "internal_error"]
          },
          "message": { "type": "string" },
          "hint": {
            "type": "string",
            "description": "What the caller should do next."
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "required": ["error"],
        "properties": {
          "error": { "$ref": "#/components/schemas/ErrorBody" }
        }
      }
    }
  }
}
