{
  "openapi": "3.1.0",
  "info": {
    "title": "Mavilo beta waitlist",
    "version": "1.0.0",
    "description": "Same-origin signup used by the public Mavilo form. Subscriber records are not publicly readable.",
    "contact": {
      "email": "contact@mavilo.ch"
    }
  },
  "servers": [
    {
      "url": "https://mavilo.ch"
    }
  ],
  "paths": {
    "/api/waitlist/token": {
      "get": {
        "operationId": "getWaitlistToken",
        "summary": "Get a short-lived signed form token",
        "responses": {
          "200": {
            "description": "Token issued",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "token"
                  ],
                  "properties": {
                    "token": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "403": {
            "description": "Cross-site request rejected"
          },
          "503": {
            "description": "Signups unavailable"
          }
        }
      }
    },
    "/api/waitlist": {
      "post": {
        "operationId": "joinWaitlist",
        "summary": "Save consented beta interest",
        "description": "Use a token from the token endpoint and send the request from the Mavilo origin. Duplicate addresses update language interests without disclosing prior membership.",
        "parameters": [
          {
            "in": "header",
            "name": "Origin",
            "required": true,
            "schema": {
              "type": "string",
              "const": "https://mavilo.ch"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "token",
                  "email",
                  "languages",
                  "consent"
                ],
                "properties": {
                  "token": {
                    "type": "string",
                    "maxLength": 1024
                  },
                  "email": {
                    "type": "string",
                    "format": "email",
                    "maxLength": 254
                  },
                  "languages": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 4,
                    "items": {
                      "type": "string",
                      "enum": [
                        "English",
                        "Chinese",
                        "Japanese",
                        "Other"
                      ]
                    }
                  },
                  "consent": {
                    "type": "boolean",
                    "const": true
                  },
                  "website": {
                    "type": "string",
                    "description": "Honeypot; leave empty.",
                    "maxLength": 0
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Interest saved",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "registered"
                  ],
                  "properties": {
                    "registered": {
                      "type": "boolean",
                      "const": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid or incomplete form"
          },
          "403": {
            "description": "Origin or token rejected"
          },
          "429": {
            "description": "Hourly rate limit reached"
          },
          "503": {
            "description": "Interest could not be saved"
          }
        }
      }
    }
  }
}
