{
  "openapi": "3.1.0",
  "info": {
    "title": "Glance website forms API",
    "version": "1.1.0",
    "description": "Public early-access signup and contact submission. No read access to emails or messages. Submit only on the person’s explicit request and appropriate consent."
  },
  "servers": [
    {
      "url": "https://www.glancewidgetapp.com"
    }
  ],
  "paths": {
    "/api/contact": {
      "post": {
        "operationId": "contactGlance",
        "summary": "Send a message with permission to reply",
        "x-requires-user-consent": true,
        "parameters": [
          {
            "in": "header",
            "name": "Origin",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "https://www.glancewidgetapp.com"
              ]
            },
            "description": "Must equal the website origin."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "email",
                  "topic",
                  "message",
                  "consent"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "maxLength": 100
                  },
                  "email": {
                    "type": "string",
                    "format": "email",
                    "maxLength": 254
                  },
                  "topic": {
                    "type": "string",
                    "enum": [
                      "general",
                      "support",
                      "feedback",
                      "partnership"
                    ]
                  },
                  "message": {
                    "type": "string",
                    "minLength": 10,
                    "maxLength": 2000
                  },
                  "consent": {
                    "type": "boolean",
                    "const": true,
                    "description": "Permission to use this email for a reply, not marketing."
                  },
                  "request_id": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9_-]{16,80}$",
                    "description": "Keep the same ID on retries. If omitted, identical messages deduplicate within a UTC day."
                  },
                  "website": {
                    "type": "string",
                    "maxLength": 0,
                    "description": "Leave empty."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Google confirmed the message or an existing request ID.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "duplicate"
                  ],
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "duplicate": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid form or missing consent."
          },
          "403": {
            "description": "Origin not allowed."
          },
          "413": {
            "description": "Payload exceeds 16 KiB."
          },
          "415": {
            "description": "Use JSON or URL-encoded form data."
          },
          "429": {
            "description": "Ten submissions per IP per 15 minutes across both forms. Obey Retry-After."
          },
          "502": {
            "description": "Save not confirmed. Retry with the same request_id."
          },
          "503": {
            "description": "Contact collector not configured."
          }
        }
      }
    },
    "/api/subscribe": {
      "post": {
        "operationId": "joinGlanceEarlyAccess",
        "summary": "Join the early-access list with explicit consent",
        "x-requires-user-consent": true,
        "parameters": [
          {
            "in": "header",
            "name": "Origin",
            "required": true,
            "description": "Must equal the website origin. Browsers set it automatically.",
            "schema": {
              "type": "string",
              "enum": [
                "https://www.glancewidgetapp.com"
              ]
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "email",
                  "consent"
                ],
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email",
                    "maxLength": 254
                  },
                  "consent": {
                    "type": "boolean",
                    "const": true,
                    "description": "Explicit agreement to receive Glance early-access emails."
                  },
                  "source": {
                    "type": "string",
                    "enum": [
                      "hero",
                      "footer"
                    ]
                  },
                  "website": {
                    "type": "string",
                    "maxLength": 0,
                    "description": "Honeypot; leave empty."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Google confirmed the signup or an existing entry.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "ok",
                    "duplicate"
                  ],
                  "properties": {
                    "ok": {
                      "const": true
                    },
                    "duplicate": {
                      "type": "boolean"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid email or missing consent."
          },
          "403": {
            "description": "Origin not allowed."
          },
          "413": {
            "description": "Payload too large."
          },
          "415": {
            "description": "Use JSON or URL-encoded form data."
          },
          "429": {
            "description": "Rate limit; obey Retry-After."
          },
          "502": {
            "description": "Save not confirmed. Retrying is duplicate-safe."
          },
          "503": {
            "description": "Collector not configured."
          }
        }
      }
    }
  }
}