{
  "openapi": "3.1.0",
  "info": {
    "title": "Comunidad App Public API",
    "version": "1.1.0",
    "summary": "Public APIs for the Comunidad App marketing site: contact and MCP.",
    "description": "Machine-readable API for AI agents and integrators. Contact submissions require Cloudflare Turnstile. Product accounts at gestor.comunidadapp.es are a separate authenticated application and are not part of this surface.",
    "contact": {
      "name": "Comunidad App",
      "email": "hola@comunidadapp.es",
      "url": "https://comunidadapp.es/contacto/"
    },
    "license": {
      "name": "Proprietary",
      "url": "https://comunidadapp.es/aviso-legal/"
    }
  },
  "jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
  "servers": [
    {
      "url": "https://comunidadapp.es",
      "description": "Production"
    },
    {
      "url": "https://new.comunidadapp.es",
      "description": "Sandbox / staging"
    }
  ],
  "tags": [
    {
      "name": "Contact",
      "description": "Send a message to the Comunidad App team"
    },
    {
      "name": "MCP",
      "description": "Model Context Protocol endpoint"
    },
    {
      "name": "Discovery",
      "description": "Agent-readable discovery documents"
    }
  ],
  "paths": {
    "/api/contact": {
      "post": {
        "tags": [
          "Contact"
        ],
        "operationId": "createContactInquiry",
        "summary": "Send a contact message",
        "description": "Creates a sales, demo, or support inquiry. Cloudflare Turnstile is required. The request body is limited to 32 KiB.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ContactRequest"
              },
              "examples": {
                "browser": {
                  "summary": "Browser inquiry",
                  "value": {
                    "name": "Ana García",
                    "email": "ana@example.com",
                    "message": "Quiero una demo del panel gestor para 12 comunidades.",
                    "locale": "es",
                    "privacy": true,
                    "turnstileToken": "turnstile-response-token"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Message accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ContactResponse"
                }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Turnstile verification failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Payload larger than 32 KiB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Content-Type must be application/json",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Email delivery failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Turnstile is not configured",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      },
      "options": {
        "tags": [
          "Contact"
        ],
        "operationId": "corsContact",
        "summary": "CORS preflight for contact",
        "responses": {
          "204": {
            "description": "No content"
          }
        }
      }
    },
    "/mcp": {
      "post": {
        "tags": [
          "MCP"
        ],
        "operationId": "mcpJsonRpc",
        "summary": "MCP Streamable HTTP endpoint",
        "description": "JSON-RPC MCP server (`contact_comunidadapp` tool and contact-form MCP App UI). The contact tool does not send email.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/JsonRpcRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "JSON-RPC response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/JsonRpcResponse"
                }
              }
            }
          },
          "204": {
            "description": "Notification acknowledged"
          }
        }
      }
    },
    "/openapi.json": {
      "get": {
        "tags": [
          "Discovery"
        ],
        "operationId": "getOpenApi",
        "summary": "OpenAPI 3.1 specification",
        "responses": {
          "200": {
            "description": "OpenAPI document",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ContactRequest": {
        "type": "object",
        "required": [
          "name",
          "email",
          "message",
          "privacy",
          "turnstileToken"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 120
          },
          "email": {
            "type": "string",
            "format": "email",
            "maxLength": 254
          },
          "message": {
            "type": "string",
            "maxLength": 5000
          },
          "locale": {
            "type": "string",
            "enum": [
              "es",
              "en",
              "ca",
              "ru",
              "eu",
              "gl"
            ],
            "default": "es"
          },
          "privacy": {
            "type": "boolean",
            "description": "Must be true (privacy policy accepted)"
          },
          "turnstileToken": {
            "type": "string",
            "description": "Cloudflare Turnstile response token"
          },
          "website": {
            "type": "string",
            "description": "Honeypot; leave empty"
          }
        }
      },
      "ContactResponse": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "error": {
            "type": "string"
          }
        }
      },
      "JsonRpcRequest": {
        "type": "object",
        "required": [
          "jsonrpc",
          "method"
        ],
        "properties": {
          "jsonrpc": {
            "type": "string",
            "enum": [
              "2.0"
            ]
          },
          "id": {},
          "method": {
            "type": "string"
          },
          "params": {
            "type": "object"
          }
        }
      },
      "JsonRpcResponse": {
        "type": "object"
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "error_description": {
            "type": "string"
          },
          "ok": {
            "type": "boolean"
          }
        }
      }
    }
  }
}
