{
  "openapi": "3.1.0",
  "info": {
    "title": "Viral Hooks Public API",
    "version": "1.0.0",
    "description": "Create hook-led short-form videos programmatically."
  },
  "servers": [{ "url": "https://api.viralhooks.org/v1" }],
  "security": [{ "ApiKeyAuth": [] }],
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "key"
      }
    }
  },
  "paths": {
    "/render": {
      "post": {
        "summary": "Start an async video render",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["workflow", "source"],
                "properties": {
                  "workflow": { "type": "string" },
                  "source": { "type": "object" },
                  "hook": { "type": "object" },
                  "webhookUrl": { "type": "string", "format": "uri" }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Render queued",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "pid": { "type": "string" }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/status": {
      "get": {
        "summary": "Poll render status",
        "parameters": [
          {
            "name": "pid",
            "in": "query",
            "required": true,
            "schema": { "type": "string" }
          }
        ],
        "responses": {
          "200": { "description": "Render status" }
        }
      }
    },
    "/estimate": {
      "post": {
        "summary": "Estimate credit cost without charging",
        "responses": {
          "200": { "description": "Credit estimate" }
        }
      }
    }
  }
}
