{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/elaiio/json-schema/elaiio-video-schema.json",
  "title": "Video",
  "description": "A video. Fields are as stored, so a draft carries far fewer of them than a rendered video.",
  "x-generated": "2026-12-01",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/elaiio-elai-public-api-openapi.yml#/components/schemas/Video",
  "type": "object",
  "additionalProperties": true,
  "properties": {
    "_id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "status": {
      "type": "string",
      "enum": [
        "draft",
        "validating",
        "rendering",
        "moderation",
        "error",
        "ready"
      ],
      "description": "Only `ready` means the MP4 exists. `error` carries no reason here — that arrives on the `video_error` webhook."
    },
    "url": {
      "type": "string",
      "description": "The rendered MP4. Absent until `status` is `ready`."
    },
    "audioUrl": {
      "type": "string",
      "description": "Rendered audio track, when one was produced separately."
    },
    "thumbnail": {
      "type": "string"
    },
    "duration": {
      "type": "number",
      "description": "Seconds. Known once the speech has been synthesised."
    },
    "slides": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/Slide"
      }
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "Videos created over the API always carry `api`."
    },
    "public": {
      "type": "boolean",
      "default": false
    },
    "deleted": {
      "type": "boolean",
      "default": false
    },
    "verified": {
      "type": "boolean",
      "default": false
    },
    "version": {
      "type": "integer",
      "default": 0
    },
    "data": {
      "type": "object",
      "additionalProperties": true,
      "description": "Render settings — subtitles, background music, and similar. Passed through to the renderer untouched."
    },
    "template": {
      "type": "object",
      "additionalProperties": true,
      "description": "Present only on templates.",
      "properties": {
        "enabled": {
          "type": "boolean",
          "default": false
        },
        "private": {
          "type": "boolean",
          "default": true
        },
        "tags": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "order": {
          "type": "integer",
          "default": 1
        }
      }
    },
    "sourceId": {
      "type": "string",
      "description": "The template this video was created or copied from."
    },
    "userId": {
      "type": "string"
    },
    "accountId": {
      "type": "string",
      "description": "The workspace that owns it."
    },
    "createdAt": {
      "type": "string",
      "format": "date-time"
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time"
    }
  },
  "$defs": {
    "Slide": {
      "type": "object",
      "description": "One slide. The model stores slides as an untyped array, so this lists the keys the API and the renderer actually read rather than a closed contract — extra keys are preserved. See [Slide structure](ref:slide-structure) for the canvas in full.",
      "additionalProperties": true,
      "properties": {
        "id": {
          "type": "integer",
          "description": "Unique within the video, and must be a number."
        },
        "canvas": {
          "type": "object",
          "additionalProperties": true,
          "description": "Fabric.js canvas: `objects[]`, `background`, `version`."
        },
        "avatar": {
          "type": "object",
          "additionalProperties": true,
          "description": "The speaking avatar. A flat object — `code` identifies it (`id` is accepted but deprecated).",
          "properties": {
            "code": {
              "type": "string"
            },
            "name": {
              "type": "string"
            },
            "gender": {
              "type": "string"
            },
            "version": {
              "type": "integer"
            },
            "canvas": {
              "type": "string",
              "description": "Preview image for the avatar."
            }
          }
        },
        "speech": {
          "type": "string",
          "description": "What the avatar says. Stripped from `GET /videos` list responses."
        },
        "voice": {
          "type": "string"
        },
        "voiceType": {
          "type": "string",
          "description": "How the speech is produced, e.g. `text`, `audio`, `silence`."
        },
        "voiceProvider": {
          "type": "string",
          "enum": [
            "azure",
            "google",
            "elevenlabs"
          ]
        },
        "language": {
          "type": "string"
        },
        "animation": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "description": "Set on story and outline slides while they are still placeholders."
        },
        "duration": {
          "type": [
            "number",
            "null"
          ],
          "description": "Seconds. `null` until the slide's speech has been synthesised."
        }
      }
    }
  }
}