{
  "openapi": "3.1.1",
  "info": {
    "title": "Halmos Labs inquiry receiver",
    "version": "1.0.0",
    "description": "A separate append-only contact receiver. It does not expose the Halmos application. Obtain explicit user approval before submitting an email address and question."
  },
  "servers": [{ "url": "https://halmoslabs.com" }],
  "paths": {
    "/api/v1/inquiries": {
      "post": {
        "operationId": "createInquiry",
        "summary": "Submit one user-approved inquiry",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "#/components/schemas/CreateInquiry" }
            }
          }
        },
        "responses": {
          "201": { "description": "Inquiry stored." },
          "200": { "description": "The same idempotent inquiry was already stored." },
          "400": { "description": "Invalid request or missing explicit consent." },
          "413": { "description": "Request exceeds 8 KiB." },
          "415": { "description": "Content type is not JSON." },
          "429": { "description": "Rate limit reached." }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "CreateInquiry": {
        "type": "object",
        "additionalProperties": false,
        "required": ["email", "question", "consent", "client_request_id"],
        "properties": {
          "email": { "type": "string", "format": "email", "maxLength": 254 },
          "question": { "type": "string", "minLength": 10, "maxLength": 2000 },
          "consent": {
            "type": "object",
            "additionalProperties": false,
            "required": ["contact_requested", "share_email_for_this_inquiry"],
            "properties": {
              "contact_requested": { "const": true },
              "share_email_for_this_inquiry": { "const": true }
            }
          },
          "source_url": { "type": "string", "format": "uri", "maxLength": 500 },
          "client_request_id": { "type": "string", "format": "uuid" }
        }
      }
    }
  }
}
