{
  "openapi": "3.1.0",
  "info": {
    "title": "Implemento AI Video Explainer Service API",
    "version": "1.0.0",
    "description": "Machine-readable specification for the Implemento AI Video Explainer Studio (implemento.ai). Supports static headless URL invocation (/agent.html), browser JavaScript SDK (window.ImplementoVideoAPI), standalone customer embed player (/embed.html), and local Node.js MCP/REST bridge (server/mcp-bridge.mjs).",
    "contact": {
      "name": "Implemento AI",
      "url": "https://implemento.ai"
    }
  },
  "servers": [
    {
      "url": "https://implemento.ai",
      "description": "Production custom domain"
    },
    {
      "url": "https://kingwize1.github.io/implemento-video-studio",
      "description": "GitHub Pages deployment"
    },
    {
      "url": "http://127.0.0.1:4175",
      "description": "Local MCP/REST bridge connected to HyperFrames & FFmpeg"
    }
  ],
  "paths": {
    "/agent.html": {
      "get": {
        "operationId": "generateExplainerHeadless",
        "summary": "Headless URL-driven explainer video generation for visiting AI agents",
        "description": "Open with query parameters and autorun=true. Read structured JobResult JSON from <script id='agent-result-json'> once document.body.dataset.status === 'complete'.",
        "parameters": [
          { "name": "topic", "in": "query", "required": true, "schema": { "type": "string" } },
          { "name": "sourceType", "in": "query", "schema": { "type": "string", "enum": ["topic", "doc", "codebase", "url"], "default": "topic" } },
          { "name": "sourceContent", "in": "query", "schema": { "type": "string" } },
          { "name": "style", "in": "query", "schema": { "type": "string", "enum": ["motion", "illustrated", "3d"], "default": "motion" } },
          { "name": "theme", "in": "query", "schema": { "type": "string", "enum": ["default", "paper", "blueprint"], "default": "default" } },
          { "name": "depth", "in": "query", "schema": { "type": "string", "enum": ["general", "eli5", "technical"], "default": "general" } },
          { "name": "length", "in": "query", "schema": { "type": "integer", "minimum": 30, "maximum": 180, "default": 60 } },
          { "name": "aspect", "in": "query", "schema": { "type": "string", "enum": ["16:9", "9:16", "1:1"], "default": "16:9" } },
          { "name": "captions", "in": "query", "schema": { "type": "boolean", "default": true } },
          { "name": "silent", "in": "query", "schema": { "type": "boolean", "default": false } },
          { "name": "avatar", "in": "query", "schema": { "type": "string", "enum": ["none", "elena", "marcus", "priya", "kenji", "sofia", "david"], "default": "none" } },
          { "name": "lang", "in": "query", "schema": { "type": "string", "default": "en" } },
          { "name": "autorun", "in": "query", "schema": { "type": "boolean", "default": true } }
        ],
        "responses": {
          "200": {
            "description": "HTML document containing structured JobResult JSON in #agent-result-json"
          }
        }
      }
    },
    "/embed.html": {
      "get": {
        "operationId": "renderEmbeddablePlayer",
        "summary": "Standalone embeddable video player for customer websites",
        "parameters": [
          { "name": "id", "in": "query", "schema": { "type": "string" }, "description": "Saved or catalog video ID" },
          { "name": "data", "in": "query", "schema": { "type": "string" }, "description": "URL-safe base64 JSON video payload for stateless cross-site embeds" },
          { "name": "topic", "in": "query", "schema": { "type": "string" }, "description": "Generate and play directly on load" },
          { "name": "style", "in": "query", "schema": { "type": "string", "enum": ["motion", "illustrated", "3d"] } },
          { "name": "captions", "in": "query", "schema": { "type": "boolean", "default": true } },
          { "name": "autoplay", "in": "query", "schema": { "type": "boolean", "default": false } },
          { "name": "muted", "in": "query", "schema": { "type": "boolean", "default": false } },
          { "name": "whitelabel", "in": "query", "schema": { "type": "boolean", "default": false } },
          { "name": "accent", "in": "query", "schema": { "type": "string" } },
          { "name": "lang", "in": "query", "schema": { "type": "string", "default": "en" } }
        ],
        "responses": {
          "200": { "description": "Responsive embeddable player HTML" }
        }
      }
    },
    "/api/v1/generate": {
      "post": {
        "operationId": "generateViaLocalBridge",
        "summary": "Generate explainer video via local HyperFrames/FFmpeg MCP bridge",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": { "$ref": "/schema/job-request.schema.json" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Structured JobResult payload",
            "content": {
              "application/json": {
                "schema": { "$ref": "/schema/job-result.schema.json" }
              }
            }
          }
        }
      }
    }
  }
}
