{
  "openapi": "3.1.0",
  "info": {
    "title": "Insan AI Developer API",
    "version": "1.0.0",
    "description": "Arabic-first multilingual AI Humanizer (3-Step Pro + Stealth Engine) and Hybrid AI Detector REST API by TREN Studio."
  },
  "servers": [
    { "url": "https://trenstudio.com/insan/api/v1", "description": "Production API v1" }
  ],
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    }
  },
  "security": [{ "ApiKeyAuth": [] }],
  "paths": {
    "/humanize.php": {
      "post": {
        "summary": "Humanize AI-generated text",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["text"],
                "properties": {
                  "text": { "type": "string", "maxLength": 12000 },
                  "language": { "type": "string", "enum": ["ar", "en", "fr"], "default": "ar" },
                  "intensity": { "type": "string", "enum": ["light", "medium", "professional"], "default": "professional" },
                  "tone": { "type": "string", "enum": ["friendly", "academic", "marketing"], "default": "friendly" },
                  "stealth": { "type": "string", "enum": ["light", "medium", "maximum"], "default": "medium" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Humanized text with quality metrics" },
          "401": { "description": "Invalid or missing X-API-Key" },
          "429": { "description": "Daily quota exceeded" }
        }
      }
    },
    "/detect.php": {
      "post": {
        "summary": "Detect AI probability in text",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["text"],
                "properties": {
                  "text": { "type": "string", "maxLength": 12000 },
                  "language": { "type": "string", "enum": ["ar", "en", "fr"], "default": "ar" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "AI probability, human probability, burstiness, and clichés detected" },
          "401": { "description": "Invalid or missing X-API-Key" }
        }
      }
    }
  }
}
