{
  "openapi": "3.0.3",
  "info": {
    "title": "Desk It Preview API",
    "version": "1.0.0",
    "description": "Test a saved Desk It assistant from a trusted server. Each revocable key is scoped to one assistant. This preview does not publish assistants or charge customer credits.",
    "contact": {"name": "ParmTech", "url": "https://deskit.parmtech.au/?page=developer"}
  },
  "servers": [{"url": "https://deskit.parmtech.au"}],
  "paths": {
    "/developer-api.php": {
      "post": {
        "operationId": "previewAssistantChat",
        "summary": "Get a text reply from one saved assistant",
        "security": [{"PreviewKey": []}],
        "requestBody": {
          "required": true,
          "content": {"application/json": {
            "schema": {"type": "object", "required": ["message"], "properties": {"message": {"type": "string", "minLength": 2, "maxLength": 400}}},
            "example": {"message": "What services do you offer?"}
          }}
        },
        "responses": {
          "200": {"description": "A successful preview", "content": {"application/json": {
            "schema": {"type": "object", "required": ["assistant", "answer", "mode"], "properties": {"assistant": {"type": "string"}, "answer": {"type": "string"}, "mode": {"type": "string", "enum": ["preview"]}}},
            "example": {"assistant": "Website support", "answer": "We offer installation and scheduled maintenance.", "mode": "preview"}
          }}},
          "401": {"description": "Missing, invalid or revoked key", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}},
          "405": {"description": "Use POST", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}},
          "413": {"description": "Request body over 8 KiB", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}},
          "415": {"description": "Content-Type must be application/json", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}},
          "422": {"description": "Invalid message or text channel disabled", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}},
          "429": {"description": "Preview limit reached", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}},
          "503": {"description": "Preview service unavailable", "content": {"application/json": {"schema": {"$ref": "#/components/schemas/Error"}}}}
        }
      }
    }
  },
  "components": {
    "securitySchemes": {"PreviewKey": {"type": "http", "scheme": "bearer", "description": "Create a key in My assistants → Preview API key. Keep it server-side."}},
    "schemas": {"Error": {"type": "object", "required": ["error"], "properties": {"error": {"type": "string"}}}}
  }
}
