{
  "openapi": "3.1.0",
  "info": {
    "title": "Adnove Video & Marketing Engine API",
    "version": "1.0.0",
    "description": "Developer API for real estate marketing intelligence, script generation, and 720p HD Preview video synthesis.",
    "contact": {
      "name": "Adnove Developer Support",
      "email": "partners@adnove.com",
      "url": "https://adnove.com"
    }
  },
  "servers": [
    {
      "url": "https://adnove.com",
      "description": "Production Web & Preview API Gateway"
    }
  ],
  "paths": {
    "/api/v1/analyze": {
      "post": {
        "summary": "Analyze Property Listing",
        "description": "Extract features, pricing, and marketing angles from listing URLs or text.",
        "operationId": "analyzeListing",
        "security": [{ "bearerAuth": [] }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": { "type": "string" },
                  "description": { "type": "string" },
                  "language": { "type": "string", "enum": ["darija", "arabic", "french", "english"] },
                  "target_audience": { "type": "string" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Listing analyzed successfully" },
          "401": { "description": "Unauthorized" },
          "429": { "description": "Rate limit exceeded" }
        }
      }
    },
    "/api/v1/generate-script": {
      "post": {
        "summary": "Generate Voiceover Script",
        "description": "Generate engaging, high-conversion localized scripts in Moroccan Darija, Standard Arabic, French, or English.",
        "operationId": "generateScript",
        "security": [{ "bearerAuth": [] }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": ["property_id"],
                "properties": {
                  "property_id": { "type": "string" },
                  "dialect": { "type": "string" },
                  "voice_gender": { "type": "string", "enum": ["male", "female"] },
                  "duration_seconds": { "type": "integer" },
                  "call_to_action": { "type": "string" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Script generated successfully" },
          "401": { "description": "Unauthorized" }
        }
      }
    },
    "/api/v1/render-video": {
      "post": {
        "summary": "Initiate 720p HD Video Rendering Job",
        "description": "Dispatch a video rendering job for 720p HD MP4 previews across multiple aspect ratios.",
        "operationId": "renderVideo",
        "security": [{ "bearerAuth": [] }],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "script_id": { "type": "string" },
                  "image_urls": { "type": "array", "items": { "type": "string" } },
                  "resolution": { "type": "string", "default": "720p" },
                  "aspect_ratios": { "type": "array", "items": { "type": "string" } },
                  "webhook_url": { "type": "string" }
                }
              }
            }
          }
        },
        "responses": {
          "200": { "description": "Job queued successfully with job_id" },
          "401": { "description": "Unauthorized" }
        }
      }
    },
    "/api/v1/jobs/{id}": {
      "get": {
        "summary": "Poll Rendering Job Status",
        "description": "Poll status (queued -> processing -> completed) and retrieve downloadable 720p HD MP4 outputs.",
        "operationId": "getRenderJob",
        "security": [{ "bearerAuth": [] }],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Job ID returned by POST /api/v1/render-video",
            "schema": { "type": "string" }
          }
        ],
        "responses": {
          "200": { "description": "Job status and outputs" },
          "401": { "description": "Unauthorized" },
          "404": { "description": "Job not found in registry" }
        }
      }
    },
    "/api/v1/campaigns/generate": {
      "post": {
        "deprecated": true,
        "summary": "DEPRECATED (Retired v0.9 Contract)",
        "description": "Permanently retired as of 2026-10-01. Returns HTTP 410 Gone. Migrate to POST /api/v1/render-video.",
        "responses": {
          "410": { "description": "Endpoint retired" }
        }
      }
    },
    "/api/v1/tasks/{id}": {
      "get": {
        "deprecated": true,
        "summary": "DEPRECATED (Retired v0.9 Contract)",
        "description": "Permanently retired as of 2026-10-01. Returns HTTP 410 Gone. Migrate to GET /api/v1/jobs/{job_id}.",
        "responses": {
          "410": { "description": "Endpoint retired" }
        }
      }
    },
    "/api/v1/billing": {
      "get": {
        "summary": "Enterprise Billing Management (Protected)",
        "description": "Requires 'billing:manage' scope. Sandbox preview keys receive HTTP 403 INSUFFICIENT_SCOPE.",
        "operationId": "getBillingStatus",
        "security": [{ "bearerAuth": [] }],
        "responses": {
          "200": { "description": "Billing account information" },
          "401": { "description": "Unauthorized" },
          "403": { "description": "Forbidden - INSUFFICIENT_SCOPE" }
        }
      }
    },
    "/api/v1/tenants/{id}": {
      "get": {
        "summary": "Tenant Organization Account Isolation (Protected)",
        "description": "Requires 'tenant:manage' scope. Sandbox preview keys receive HTTP 403 INSUFFICIENT_SCOPE.",
        "operationId": "getTenantDetails",
        "security": [{ "bearerAuth": [] }],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": { "type": "string" }
          }
        ],
        "responses": {
          "200": { "description": "Tenant organization details" },
          "401": { "description": "Unauthorized" },
          "403": { "description": "Forbidden - INSUFFICIENT_SCOPE" }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "API_KEY",
        "description": "Sandbox Preview Keys hold scopes [preview:read, preview:dispatch]. Enterprise keys hold [billing:manage, tenant:manage]."
      }
    }
  }
}
