{
  "openapi": "3.1.0",
  "info": {
    "title": "SkaleWell Lead Submission API",
    "summary": "Submit a new lead from skalewell.com's contact and call-booking forms.",
    "description": "Accepts lead-generation form submissions (name, email, website, ad spend, message) from skalewell.com and forwards them to SkaleWell's internal notification pipeline (email + Telegram, with optional CRM sync). This is the same endpoint the site's own contact and call-booking forms submit to \u2014 documented here for automated discovery per RFC 9727.",
    "version": "1.0.0",
    "contact": {
      "name": "SkaleWell",
      "email": "contact@skalewell.com",
      "url": "https://skalewell.com/contact.html"
    }
  },
  "servers": [
    { "url": "https://skalewell.com", "description": "Production" }
  ],
  "paths": {
    "/contact.php": {
      "post": {
        "operationId": "submitLead",
        "summary": "Submit a lead",
        "description": "Validates and forwards a lead submission. Always returns JSON. Requests that fail basic anti-spam checks are accepted silently (HTTP 200, ok:true) without being delivered, so automated probing cannot be used to fingerprint the filtering logic.",
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": { "$ref": "#/components/schemas/LeadSubmission" }
            },
            "application/x-www-form-urlencoded": {
              "schema": { "$ref": "#/components/schemas/LeadSubmission" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Accepted. Note: a 200 with ok:true does not guarantee an email was actually forwarded to a human \u2014 requests identified as automated/spam are silently accepted without delivery.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/OkResponse" },
                "examples": {
                  "accepted": { "value": { "ok": true } }
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed \u2014 only POST is accepted.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" },
                "examples": { "wrongMethod": { "value": { "ok": false, "error": "method_not_allowed" } } }
              }
            }
          },
          "422": {
            "description": "Missing or invalid required field (name and/or a valid email are required).",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" },
                "examples": { "invalidInput": { "value": { "ok": false, "error": "invalid_input" } } }
              }
            }
          },
          "500": {
            "description": "Server misconfigured (should not occur in production).",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" },
                "examples": { "misconfigured": { "value": { "ok": false, "error": "server_misconfigured" } } }
              }
            }
          },
          "502": {
            "description": "Upstream email delivery failed.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" },
                "examples": { "emailFailed": { "value": { "ok": false, "error": "email_failed" } } }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "LeadSubmission": {
        "type": "object",
        "required": ["name", "email"],
        "properties": {
          "name": { "type": "string", "description": "Full name of the person submitting the enquiry." },
          "email": { "type": "string", "format": "email", "description": "Reply-to email address." },
          "website": { "type": "string", "format": "uri", "description": "Optional URL of the submitter's brand/store." },
          "spend": { "type": "string", "description": "Optional free-text current or planned monthly ad spend." },
          "message": { "type": "string", "description": "Optional free-text enquiry details." },
          "_gotcha": { "type": "string", "description": "Honeypot field. Must be left empty by legitimate clients." },
          "_ts": { "type": "string", "description": "Client-side page-load timestamp in epoch milliseconds, used for basic submission-timing validation." }
        }
      },
      "OkResponse": {
        "type": "object",
        "required": ["ok"],
        "properties": { "ok": { "type": "boolean", "const": true } }
      },
      "ErrorResponse": {
        "type": "object",
        "required": ["ok", "error"],
        "properties": {
          "ok": { "type": "boolean", "const": false },
          "error": {
            "type": "string",
            "enum": ["invalid_input", "method_not_allowed", "server_misconfigured", "email_failed"]
          }
        }
      }
    }
  }
}
