{
  "openapi": "3.1.0",
  "info": {
    "title": "DIAL3D Website API",
    "version": "1.0.0",
    "description": "Public endpoints on dial3d.ai. The primary operation is the contact/demo-request endpoint used by the /demo and /company/contact forms. AI agents acting for a behavioral-health organization may submit on a human's behalf — always with that person's knowledge and real contact details.",
    "contact": {
      "name": "DIAL3D",
      "email": "hello@dial3d.ai",
      "url": "https://dial3d.ai/company/contact/"
    }
  },
  "servers": [{ "url": "https://dial3d.ai" }],
  "paths": {
    "/api/contact": {
      "post": {
        "operationId": "submitContact",
        "summary": "Submit a contact or demo request",
        "description": "Sends the submission to the DIAL3D team by email. Accepts application/json, multipart/form-data, or application/x-www-form-urlencoded. When Cloudflare Turnstile enforcement is enabled, browser submissions must include a valid cf-turnstile-response token; submissions without a valid token are rejected 400/403.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/ContactRequest" },
              "example": {
                "formType": "Demo",
                "name": "Jordan Alvarez",
                "email": "jordan@example-treatment.com",
                "organization": "Example Treatment Center",
                "role": "Admissions Director",
                "facilities": "2",
                "reason": "Evaluating AI voice agents",
                "message": "We'd like to see the voice agent handle an insurance verification call."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Submission accepted",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": { "ok": { "type": "boolean", "const": true } },
                  "required": ["ok"]
                }
              }
            }
          },
          "400": { "$ref": "#/components/responses/Error" },
          "403": { "$ref": "#/components/responses/Error" },
          "502": { "$ref": "#/components/responses/Error" }
        }
      }
    },
    "/api/health": {
      "get": {
        "operationId": "getHealth",
        "summary": "Service health",
        "responses": {
          "200": {
            "description": "Health check result (draft-inadarei-api-health-check format)",
            "content": {
              "application/health+json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": { "type": "string", "enum": ["pass", "warn", "fail"] },
                    "description": { "type": "string" },
                    "time": { "type": "string", "format": "date-time" }
                  },
                  "required": ["status"]
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ContactRequest": {
        "type": "object",
        "required": ["name", "email"],
        "properties": {
          "name": { "type": "string", "maxLength": 200, "description": "Full name of the human making the request" },
          "email": { "type": "string", "format": "email", "maxLength": 200, "description": "Reply-to email address" },
          "formType": { "type": "string", "description": "Label for the submission, e.g. \"Demo\" or \"Contact\". Defaults to \"Contact\".", "default": "Contact" },
          "organization": { "type": "string", "description": "Treatment center / company name" },
          "role": { "type": "string", "description": "Requester's role, e.g. \"Admissions Director\"" },
          "facilities": { "type": "string", "description": "Number of facilities or locations" },
          "reason": { "type": "string", "description": "Short reason for reaching out" },
          "message": { "type": "string", "description": "Free-form message" },
          "cf-turnstile-response": { "type": "string", "description": "Cloudflare Turnstile token. Required when Turnstile enforcement is enabled on the server." }
        },
        "additionalProperties": { "type": "string" }
      }
    },
    "responses": {
      "Error": {
        "description": "Request rejected",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "properties": { "error": { "type": "string" } },
              "required": ["error"]
            }
          }
        }
      }
    }
  }
}
