{
  "openapi": "3.1.0",
  "info": {
    "title": "Automata Labs First-Party Form APIs",
    "version": "1.0.0",
    "description": "Reference for the existing browser forms at https://automatalabs.ca, not a general-purpose integration API. Use the first-party forms with a person present, JavaScript enabled, and their Cloudflare Turnstile check completed. Publication of this specification does not authorize autonomous submissions, bulk messaging, cross-origin integrations, or bypassing protections. These form endpoints accept no API-key or OAuth credentials; the absence of account authentication does not remove the human-verification requirement. The separate read-only agent catalog API is documented at /auth.md and /agent-openapi.json; its keys cannot authorize these forms.\n\nAll three operations accept form-encoded text fields, not JSON or file uploads. Fields describe canonical browser values; normalization occurs before validation. Single-line values have whitespace collapsed and are trimmed; multiline values have carriage returns removed and are trimmed. Values are truncated to the normalized lengths described by x-normalized-max-length (JavaScript UTF-16 code units), rather than rejected solely for exceeding those lengths. Email addresses are lowercased. Unrecognized fields are ignored.\n\nThe normal production flow requires a fresh, single-use Turnstile response bound to the site's hostname and the operation's action. Rate limits, duplicate suppression, an empty honeypot, a 64 KiB request-body ceiling, and a global mail-send ceiling also apply. Limits are operational controls, not a published submission quota. A 200 response is not a delivery receipt: abuse controls, duplicate suppression, and the send ceiling can return the same success body without sending email. Dedupe is not a durable idempotency guarantee. Avoid automatic retries. Framework or proxy rejections can be non-JSON, unlike handler responses. No response-time, delivery, availability, or versioned-integration guarantee is offered.",
    "contact": {
      "name": "Automata Labs Support",
      "url": "https://automatalabs.ca/support/",
      "email": "support@automatalabs.ca"
    }
  },
  "servers": [
    { "url": "https://automatalabs.ca", "description": "Production first-party website" }
  ],
  "externalDocs": {
    "description": "Browser-form API reference and usage restrictions",
    "url": "https://automatalabs.ca/api/"
  },
  "security": [],
  "tags": [
    { "name": "Contact", "description": "Human-submitted sales, support, media, and general inquiries." },
    { "name": "Support", "description": "Human-submitted support requests." },
    { "name": "Waitlist", "description": "Email subscription requests requiring double opt-in." }
  ],
  "paths": {
    "/api/contact": {
      "post": {
        "operationId": "submitContactForm",
        "tags": ["Contact"],
        "summary": "Submit the first-party contact form",
        "description": "Use https://automatalabs.ca/contact/. Turnstile action: contact. A permitted submission attempts a staff email and a submitter acknowledgement. Duplicate detection uses normalized email, subject, and message; changing name, company, phone, or inquiry type does not make that text a new inquiry. Acknowledgement is not proof of delivery or a response-time commitment. No inquiry identifier or status lookup is returned.",
        "externalDocs": { "url": "https://automatalabs.ca/api/#contact" },
        "requestBody": {
          "required": true,
          "description": "Text form fields supplied by the first-party browser form, including its human-verification response. The body-size ceiling includes encoding and multipart overhead.",
          "content": {
            "application/x-www-form-urlencoded": { "schema": { "$ref": "#/components/schemas/ContactRequest" } },
            "multipart/form-data": { "schema": { "$ref": "#/components/schemas/ContactRequest" } }
          }
        },
        "responses": {
          "200": {
            "description": "Normal acknowledgement, also used when abuse controls, duplicate suppression, or the send ceiling suppress mail. Does not guarantee delivery.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/SuccessResponse" },
                "example": { "ok": true, "message": "Your message has been sent. Our team will respond shortly." }
              }
            }
          },
          "400": { "$ref": "#/components/responses/InvalidSubmission" },
          "403": { "$ref": "#/components/responses/OriginRejected" },
          "413": { "$ref": "#/components/responses/SubmissionTooLarge" },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "500": {
            "description": "Unexpected handler or email-send failure. A staff message may already have been sent before the acknowledgement failed; do not assume retrying is safe.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" },
                "example": { "ok": false, "error": "Server error while sending your message. Please try again." }
              }
            }
          },
          "503": { "$ref": "#/components/responses/ChallengeUnavailable" },
          "default": { "$ref": "#/components/responses/InfrastructureResponse" }
        }
      }
    },
    "/api/support": {
      "post": {
        "operationId": "submitSupportForm",
        "tags": ["Support"],
        "summary": "Submit the first-party support form",
        "description": "Use https://automatalabs.ca/support/. Turnstile action: support. A permitted submission attempts a staff email and a submitter acknowledgement. Duplicate detection uses normalized email, subject, and description; changing priority, category, name, or company does not make that text a new ticket. Priority is a request classification, not a service-level commitment. No ticket identifier, attachments, or ticket-status API is provided.",
        "externalDocs": { "url": "https://automatalabs.ca/api/#support" },
        "requestBody": {
          "required": true,
          "description": "Text form fields supplied by the first-party browser form, including its human-verification response. Include product, OS, and reproduction details in description, not in extra fields or file attachments.",
          "content": {
            "application/x-www-form-urlencoded": { "schema": { "$ref": "#/components/schemas/SupportRequest" } },
            "multipart/form-data": { "schema": { "$ref": "#/components/schemas/SupportRequest" } }
          }
        },
        "responses": {
          "200": {
            "description": "Normal acknowledgement, also used when abuse controls, duplicate suppression, or the send ceiling suppress mail. Does not guarantee delivery.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/SuccessResponse" },
                "example": { "ok": true, "message": "Your support ticket has been submitted. We will follow up shortly." }
              }
            }
          },
          "400": { "$ref": "#/components/responses/InvalidSubmission" },
          "403": { "$ref": "#/components/responses/OriginRejected" },
          "413": { "$ref": "#/components/responses/SubmissionTooLarge" },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "500": {
            "description": "Unexpected handler or email-send failure. A staff message may already have been sent before the acknowledgement failed; do not assume retrying is safe.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" },
                "example": { "ok": false, "error": "Server error while submitting your ticket. Please try again." }
              }
            }
          },
          "503": { "$ref": "#/components/responses/ChallengeUnavailable" },
          "default": { "$ref": "#/components/responses/InfrastructureResponse" }
        }
      }
    },
    "/api/waitlist": {
      "post": {
        "operationId": "requestWaitlistConfirmation",
        "tags": ["Waitlist"],
        "summary": "Request a double-opt-in confirmation email",
        "description": "Use a product waitlist form or the site's Release Radar form. Turnstile action: waitlist. This is only step one: a permitted submission sends a confirmation request, not a welcome email or staff notification. The recipient must follow the signed link in their email to /waitlist/confirm/ within seven days. That browser page performs confirmation and attempts the welcome and staff emails, subject to further rate/send limits. Ignoring the email leaves the request unconfirmed. Confirmation is a state-changing GET; mail-client or security-scanner link previews can confirm it. Links contain signed, not encrypted, subscription data and must remain private. This specification does not expose confirmation as a programmatic operation.\n\nDuplicate detection uses normalized email and productSlug, ignoring name and notifyAll. The 200 body never reports membership or confirmed status and does not guarantee a confirmation email was sent. Rate-limited requests return 429 when that guard is reached; duplicates can return 200 earlier. There is no subscription lookup, durable idempotency key, or automated subscription-management API.",
        "externalDocs": { "url": "https://automatalabs.ca/api/#waitlist" },
        "requestBody": {
          "required": true,
          "description": "Text form fields and the waitlist form's human-verification response. Subscribe only your own address with consent. notifyAll is a presence-based checkbox field, not a JSON boolean.",
          "content": {
            "application/x-www-form-urlencoded": { "schema": { "$ref": "#/components/schemas/WaitlistRequest" } },
            "multipart/form-data": { "schema": { "$ref": "#/components/schemas/WaitlistRequest" } }
          }
        },
        "responses": {
          "200": {
            "description": "Pending-confirmation message, not confirmed membership. Also returned for suppressed submissions without sending email.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/SuccessResponse" },
                "example": { "ok": true, "message": "Almost done — check your inbox for a confirmation link to finish subscribing. It may take a minute to arrive." }
              }
            }
          },
          "400": { "$ref": "#/components/responses/InvalidWaitlistSubmission" },
          "403": { "$ref": "#/components/responses/OriginRejected" },
          "413": { "$ref": "#/components/responses/SubmissionTooLarge" },
          "429": { "$ref": "#/components/responses/RateLimited" },
          "500": {
            "description": "Unexpected handler or confirmation-email send failure. The response does not establish delivery state.",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" },
                "example": { "ok": false, "error": "Server error while joining the waitlist. Please try again." }
              }
            }
          },
          "503": { "$ref": "#/components/responses/WaitlistUnavailable" },
          "default": { "$ref": "#/components/responses/InfrastructureResponse" }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "FormProtectionFields": {
        "type": "object",
        "required": ["cf-turnstile-response"],
        "description": "Production browser-form requirements, not API credentials. A valid challenge is required for a normal submission to proceed. Operational rejection or silent suppression can happen before challenge verification. The optional signed timing field is a signal only, not a blocking CSRF or authentication token.",
        "properties": {
          "cf-turnstile-response": {
            "type": "string",
            "minLength": 1,
            "maxLength": 2048,
            "writeOnly": true,
            "description": "Fresh response from the first-party Cloudflare Turnstile widget. Single-use and valid for approximately five minutes. The server checks hostname and the contact, support, or waitlist action, matching this operation. Use the browser form to complete verification; do not manufacture or reuse tokens."
          },
          "honeypot": {
            "type": "string",
            "description": "Hidden anti-abuse field. Leave blank as rendered by the form. A nonblank normalized value can cause the ordinary success body to be returned with no mail sent.",
            "examples": [""]
          },
          "ts": {
            "type": "string",
            "writeOnly": true,
            "description": "Optional opaque, signed form-issue timestamp supplied by server-rendered forms. Preserve it when present. Missing, invalid, fast, or stale timing is currently a non-blocking signal. Prerendered waitlist forms intentionally omit it. This is not an API key or a caller-generated timestamp."
          }
        }
      },
      "Name": {
        "type": "string",
        "description": "Single-line name, normalized and truncated to 120 UTF-16 code units before validation. Contact and support require a nonblank value; waitlist name is optional.",
        "x-normalized-max-length": 120
      },
      "Email": {
        "type": "string",
        "format": "email",
        "description": "Valid email address after whitespace normalization, truncation to 160 UTF-16 code units, and lowercasing. Use your own address.",
        "x-normalized-max-length": 160
      },
      "Company": {
        "type": "string",
        "description": "Optional single-line company or organization. Normalized and truncated to 120 UTF-16 code units; blank is treated as absent.",
        "x-normalized-max-length": 120
      },
      "Subject": {
        "type": "string",
        "minLength": 1,
        "description": "Required nonblank subject after single-line whitespace normalization and truncation to 180 UTF-16 code units.",
        "x-normalized-max-length": 180
      },
      "ContactRequest": {
        "allOf": [
          { "$ref": "#/components/schemas/FormProtectionFields" },
          {
            "type": "object",
            "required": ["name", "email", "inquiry_type", "subject", "message"],
            "properties": {
              "name": { "$ref": "#/components/schemas/Name", "minLength": 1 },
              "email": { "$ref": "#/components/schemas/Email" },
              "company": { "$ref": "#/components/schemas/Company" },
              "phone": {
                "type": "string",
                "description": "Optional single-line phone text; no phone-number format validation. Normalized and truncated to 60 UTF-16 code units; blank is treated as absent.",
                "x-normalized-max-length": 60
              },
              "inquiry_type": {
                "type": "string",
                "enum": ["sales", "support", "press", "general"],
                "description": "Required case-sensitive inquiry classification. Whitespace-normalized and truncated to 40 UTF-16 code units before the enum check; it is not lowercased.",
                "x-normalized-max-length": 40
              },
              "subject": { "$ref": "#/components/schemas/Subject" },
              "message": {
                "type": "string",
                "minLength": 1,
                "description": "Required nonblank multiline message. Carriage returns removed, trimmed, then truncated to 6000 UTF-16 code units.",
                "x-normalized-max-length": 6000
              }
            }
          }
        ]
      },
      "SupportRequest": {
        "allOf": [
          { "$ref": "#/components/schemas/FormProtectionFields" },
          {
            "type": "object",
            "required": ["name", "email", "category", "priority", "subject", "description"],
            "properties": {
              "name": { "$ref": "#/components/schemas/Name", "minLength": 1 },
              "email": { "$ref": "#/components/schemas/Email" },
              "company": { "$ref": "#/components/schemas/Company" },
              "category": {
                "type": "string",
                "enum": ["installation", "purchase", "bug", "workflow", "other"],
                "description": "Required classification; normalized, truncated to 120 UTF-16 code units, and lowercased before matching these canonical values.",
                "x-normalized-max-length": 120
              },
              "priority": {
                "type": "string",
                "enum": ["low", "normal", "high", "urgent"],
                "description": "Required classification with no server default or response-time guarantee; normalized, truncated to 80 UTF-16 code units, and lowercased before matching these canonical values.",
                "x-normalized-max-length": 80
              },
              "subject": { "$ref": "#/components/schemas/Subject" },
              "description": {
                "type": "string",
                "minLength": 1,
                "description": "Required nonblank multiline issue description. Include product, OS, and reproduction details. Carriage returns removed, trimmed, then truncated to 8000 UTF-16 code units. No attachment upload is supported.",
                "x-normalized-max-length": 8000
              }
            }
          }
        ]
      },
      "WaitlistAudience": {
        "type": "string",
        "description": "Required audience slug. Normalized, truncated to 120 UTF-16 code units, and lowercased before checking the current allowlist: product slugs plus release-radar and legacy macos-flagships. Acceptance of a slug is not a promise of product availability or a launch date. Display names are derived by the server.",
        "x-normalized-max-length": 120,
        "enum": [
          "port-detective", "timefence", "pinpoint", "prismkit", "staygreen",
          "contextcleaner", "intelliclip", "lockghost", "monitorpilot", "csvprune",
          "opticbatch", "metaforge", "dupedoctor", "backuppaper", "scanroute",
          "batesbind", "sheetstamp", "proofslip", "measureset", "cutpacket",
          "drawing-revision-delta", "inkquote", "ledgerpair", "meshmedic", "print-preflight-desk",
          "pstvault", "spec-register-builder", "threadbind", "underbase", "wavspec",
          "keyfence", "release-radar", "macos-flagships"
        ]
      },
      "WaitlistRequest": {
        "allOf": [
          { "$ref": "#/components/schemas/FormProtectionFields" },
          {
            "type": "object",
            "required": ["email", "productSlug"],
            "properties": {
              "email": { "$ref": "#/components/schemas/Email" },
              "name": { "$ref": "#/components/schemas/Name" },
              "productSlug": { "$ref": "#/components/schemas/WaitlistAudience" },
              "notifyAll": {
                "type": "string",
                "description": "Optional checkbox for other Automata Labs product announcements. Presence means true, regardless of the submitted text (even an empty string or 'false'); absence means false. The browser sends 'yes' when checked. This is not a boolean-valued JSON field.",
                "examples": ["yes"]
              },
              "productName": {
                "type": "string",
                "description": "Legacy hidden field present in existing forms. Ignored by the server; the authoritative audience display name is derived from productSlug. Not required."
              }
            }
          }
        ]
      },
      "SuccessResponse": {
        "type": "object",
        "required": ["ok", "message"],
        "additionalProperties": false,
        "properties": {
          "ok": { "type": "boolean", "const": true },
          "message": { "type": "string", "description": "Human-readable acknowledgement; not proof of email delivery or confirmed subscription." }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "required": ["ok", "error"],
        "additionalProperties": false,
        "properties": {
          "ok": { "type": "boolean", "const": false },
          "error": { "type": "string", "description": "Human-readable error message, not a machine-readable error code or field-error map." }
        }
      }
    },
    "responses": {
      "InvalidSubmission": {
        "description": "Unsupported or unparseable form content (including JSON), missing or invalid fields, or failed human verification (missing, expired, replayed, wrong-hostname, or wrong-action Turnstile response). This handler uses 400, not 415 or 422. Only the first validation error is returned.",
        "content": {
          "application/json": {
            "schema": { "$ref": "#/components/schemas/ErrorResponse" },
            "examples": {
              "format": { "value": { "ok": false, "error": "Invalid form submission format." } },
              "email": { "value": { "ok": false, "error": "Please enter a valid email address." } },
              "required": { "value": { "ok": false, "error": "Please fill in all required fields." } },
              "option": { "value": { "ok": false, "error": "Please choose one of the available options." } },
              "verification": { "value": { "ok": false, "error": "We could not verify that this form was submitted by a person. Please reload the page and try again, or email support@automatalabs.ca and we will help directly." } }
            }
          }
        }
      },
      "InvalidWaitlistSubmission": {
        "description": "Unsupported or unparseable form content, invalid email, missing or unknown productSlug, or failed human verification. Only the first validation error is returned. Format and verification errors have the same shape and messages as the other forms.",
        "content": {
          "application/json": {
            "schema": { "$ref": "#/components/schemas/ErrorResponse" },
            "examples": {
              "audience": { "value": { "ok": false, "error": "Unknown waitlist." } },
              "email": { "value": { "ok": false, "error": "Please enter a valid email address." } },
              "format": { "value": { "ok": false, "error": "Invalid form submission format." } }
            }
          }
        }
      },
      "OriginRejected": {
        "description": "The framework or edge may reject a cross-origin form submission before the handler runs. Use the first-party same-origin browser form. This is not the handler's JSON error contract; the body can be plain text or HTML.",
        "content": {
          "text/plain": { "schema": { "type": "string" } },
          "text/html": { "schema": { "type": "string" } }
        }
      },
      "SubmissionTooLarge": {
        "description": "Request exceeds the 64 KiB (65536-byte) form-body ceiling, including encoding overhead. The application checks the declared Content-Length; the production proxy also limits the body. Proxy rejections can be HTML rather than JSON.",
        "content": {
          "application/json": {
            "schema": { "$ref": "#/components/schemas/ErrorResponse" },
            "example": { "ok": false, "error": "Submission too large." }
          },
          "text/html": { "schema": { "type": "string" } }
        }
      },
      "RateLimited": {
        "description": "An IP, email, aggregate, or proxy rate limit was reached. All application scopes use the same error message. No Retry-After header or numeric quota is guaranteed. Wait before a human retry or use the support email; do not retry automatically. Proxy rejections can be HTML.",
        "content": {
          "application/json": {
            "schema": { "$ref": "#/components/schemas/ErrorResponse" },
            "example": { "ok": false, "error": "You have sent several messages recently, so this one was not delivered. Please try again later, or email support@automatalabs.ca if it is urgent." }
          },
          "text/html": { "schema": { "type": "string" } }
        }
      },
      "ChallengeUnavailable": {
        "description": "The security check could not complete, including a verification-provider outage or unavailable production configuration. The normal production flow fails closed rather than sending unverified mail.",
        "content": {
          "application/json": {
            "schema": { "$ref": "#/components/schemas/ErrorResponse" },
            "example": { "ok": false, "error": "We could not complete the security check just now. Please try again in a few minutes, or email support@automatalabs.ca and we will pick it up from there." }
          }
        }
      },
      "WaitlistUnavailable": {
        "description": "Human verification or confirmation-link issuance is unavailable. The operation does not fall back to a subscription without double opt-in.",
        "content": {
          "application/json": {
            "schema": { "$ref": "#/components/schemas/ErrorResponse" },
            "examples": {
              "verification": { "value": { "ok": false, "error": "We could not complete the security check just now. Please try again in a few minutes, or email support@automatalabs.ca and we will pick it up from there." } },
              "subscription": { "value": { "ok": false, "error": "Subscriptions are temporarily unavailable. Please try again shortly." } }
            }
          }
        }
      },
      "InfrastructureResponse": {
        "description": "Other framework, edge, or proxy responses are outside the handler JSON contract. Inspect status and Content-Type before interpreting a body; do not treat infrastructure failures as permission to resubmit automatically."
      }
    }
  }
}
