{
  "openapi": "3.1.0",
  "info": {
    "title": "HavenSync website API",
    "version": "1.0.0",
    "description": "Public endpoint behind the HavenSync early-access form (havensync.in). HavenSync is a Wi-Fi smart switch controller for lights and fans in Indian homes, made by Hexahaven Integrations.",
    "contact": {
      "name": "HavenSync support",
      "email": "support@havensync.in",
      "url": "https://havensync.in/contact.html"
    }
  },
  "servers": [
    {
      "url": "https://havensync.in"
    }
  ],
  "paths": {
    "/early-access.php": {
      "post": {
        "operationId": "requestEarlyAccess",
        "summary": "Register an email address for HavenSync early-access updates",
        "description": "Sends an early-access notification to the HavenSync support inbox. Only requests from the havensync.in website origin are accepted, and each visitor is limited to one submission every 20 seconds.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "email"
                ],
                "properties": {
                  "email": {
                    "type": "string",
                    "format": "email",
                    "maxLength": 254,
                    "description": "Email address to register"
                  },
                  "page": {
                    "type": "string",
                    "maxLength": 500,
                    "description": "Page the request was made from"
                  },
                  "source": {
                    "type": "string",
                    "description": "Where the request came from"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Request received",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Result"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request or email address",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Result"
                }
              }
            }
          },
          "403": {
            "description": "Origin not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Result"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Result"
                }
              }
            }
          },
          "429": {
            "description": "Rate limit: wait a moment and try again",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Result"
                }
              }
            }
          },
          "500": {
            "description": "Notification could not be sent",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Result"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Result": {
        "type": "object",
        "required": [
          "success",
          "message"
        ],
        "properties": {
          "success": {
            "type": "boolean"
          },
          "message": {
            "type": "string"
          }
        }
      }
    }
  }
}
