{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/moments-lab/json-schema/moments-lab-media-hub-request-schema.json",
  "title": "MediaHubRequest",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/moments-lab-openapi.yml#/components/schemas/MediaHubRequest",
  "type": "object",
  "properties": {
    "type": {
      "type": "string",
      "enum": [
        "video",
        "image",
        "audio"
      ],
      "description": "The kind of media you’re about to analyze must be either \"Video\", \"Image\", or \"Audio\"."
    },
    "external_id": {
      "description": "An internal unique identifier from your system to help you link the original media file with the analyzed version. ",
      "type": "string"
    },
    "filename": {
      "type": "string",
      "description": "Name of the media file once analyzed"
    },
    "title": {
      "type": "string",
      "description": "The title that will be displayed in the optional user interface for these media files."
    },
    "source": {
      "oneOf": [
        {
          "$ref": "#/$defs/UrlSource"
        },
        {
          "$ref": "#/$defs/S3Source"
        },
        {
          "$ref": "#/$defs/GcsSource"
        }
      ],
      "description": "This is a mandatory field to give us information about where to find the original media file.",
      "type": "object"
    },
    "analysis_parameters": {
      "description": "Parameters to setup the analysis tasks you want to apply on the media",
      "$ref": "#/$defs/AnalysisParameters"
    },
    "event": {
      "description": "Parameters to setup the event linked to the media",
      "$ref": "#/$defs/IngestEventParameters"
    },
    "organisation_uids": {
      "description": "Organisation to link to the media, if not provided organisation will be the one linked to the api token",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "metadata": {
      "description": "Custom metadata to apply on the media",
      "type": "array",
      "items": {
        "$ref": "#/$defs/MetadataParametersRequest"
      }
    },
    "media_date": {
      "description": "The date the media was recorded or broadcast. ISO 8601 format (e.g. 2024-03-15T14:30:00Z).",
      "type": "string"
    },
    "customer_storage_path": {
      "description": "Path in your own storage where this media can be found, for your own reference.",
      "type": "string"
    }
  },
  "required": [
    "type",
    "filename",
    "title",
    "source",
    "analysis_parameters"
  ],
  "$defs": {
    "AnalysisParameters": {
      "type": "object",
      "properties": {
        "transcript_language": {
          "description": "Language in which the transcript will be generated, use <a href=\"https://en.wikipedia.org/wiki/List_of_ISO_639_language_codes\">ISO 639-1 Code format</a>, no value will result in auto-detection of the language.<br/>Notice that specifying a language will fasten the analysis",
          "type": "string",
          "enum": [
            "af",
            "am",
            "ar",
            "as",
            "az",
            "ba",
            "be",
            "bg",
            "bn",
            "bo",
            "br",
            "bs",
            "ca",
            "cs",
            "cy",
            "da",
            "de",
            "el",
            "en",
            "es",
            "et",
            "eu",
            "fa",
            "fi",
            "fo",
            "fr",
            "gl",
            "gu",
            "ha",
            "haw",
            "he",
            "hi",
            "hr",
            "ht",
            "hu",
            "hy",
            "id",
            "is",
            "it",
            "ja",
            "jw",
            "ka",
            "kk",
            "km",
            "kn",
            "ko",
            "la",
            "lb",
            "ln",
            "lo",
            "lt",
            "lv",
            "mg",
            "mi",
            "mk",
            "ml",
            "mn",
            "mr",
            "ms",
            "mt",
            "my",
            "ne",
            "nl",
            "nn",
            "no",
            "oc",
            "pa",
            "pl",
            "ps",
            "pt",
            "ro",
            "ru",
            "sa",
            "sd",
            "si",
            "sk",
            "sl",
            "sn",
            "so",
            "sq",
            "sr",
            "su",
            "sv",
            "sw",
            "ta",
            "te",
            "tg",
            "th",
            "tk",
            "tl",
            "tr",
            "tt",
            "uk",
            "ur",
            "uz",
            "vi",
            "yi",
            "yo",
            "zh",
            "yue"
          ]
        },
        "audio_channel_mapping": {
          "description": "Audio channel mapping configuration for analysis when audio contains multiple tracks and channels. Each object specifies a track number and the channels to use from that track. Track and channel numbers are zero-based. The example below selects the first 2 channels of the first audio track (track 0), plus the first channel of the second audio track (track 1). Left empty to default value which is a downmix of all tracks and channels.",
          "type": "array",
          "items": {
            "$ref": "#/$defs/AudioChannelMapping"
          }
        },
        "tasks": {
          "type": "array",
          "items": {
            "type": "string",
            "enum": [
              "mxt"
            ]
          },
          "description": "Tasks will be applied on the live feeds"
        }
      },
      "required": [
        "tasks"
      ]
    },
    "AudioChannelMapping": {
      "type": "object",
      "properties": {
        "track": {
          "type": "number",
          "description": "Zero-based index of the audio track — the first audio track is track 0, the second is track 1, and so on."
        },
        "channels": {
          "type": "array",
          "items": {
            "type": "number"
          },
          "description": "Zero-based indexes of the channels to use within the track (e.g. [0, 1] for the first two channels of that track)."
        }
      },
      "required": [
        "track",
        "channels"
      ]
    },
    "GcsSource": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "GCS"
          ]
        },
        "bucket": {
          "type": "string",
          "description": "Google Cloud Storage bucket name"
        },
        "key": {
          "type": "string",
          "description": "Object key (path) within the bucket"
        },
        "byos_credential_uid": {
          "type": "string",
          "description": "Uid of the BYOS credential used to access the bucket"
        }
      },
      "required": [
        "type",
        "bucket",
        "key",
        "byos_credential_uid"
      ]
    },
    "IngestCreationEventParameters": {
      "type": "object",
      "properties": {
        "title": {
          "type": "string",
          "description": "The title of the event"
        },
        "program_uid": {
          "description": "The program to apply on the media",
          "type": "string"
        },
        "organisation_uids": {
          "description": "Organisation to link to the event, if not provided organisation will be the one linked to the api token",
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "metadata": {
          "description": "Custom metadata to apply on the event",
          "type": "array",
          "items": {
            "$ref": "#/$defs/MetadataParametersRequest"
          }
        }
      },
      "required": [
        "title"
      ]
    },
    "IngestEventParameters": {
      "type": "object",
      "properties": {
        "event_uid": {
          "description": "The event to apply on the media. If event_uid is set, the next properties will be ignored.",
          "type": "string"
        },
        "event_parameters": {
          "description": "Parameters to create event the media will be attached to",
          "$ref": "#/$defs/IngestCreationEventParameters"
        }
      }
    },
    "MetadataParametersRequest": {
      "type": "object",
      "properties": {
        "field_uid": {
          "type": "string",
          "description": "Unique identifier of the metadata field"
        },
        "value": {
          "type": "string",
          "description": "Value of the metadata"
        }
      },
      "required": [
        "field_uid",
        "value"
      ]
    },
    "S3Source": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "S3"
          ]
        },
        "bucket": {
          "type": "string",
          "description": "S3 bucket name"
        },
        "key": {
          "type": "string",
          "description": "S3 key"
        },
        "region": {
          "type": "string",
          "description": "S3 region"
        },
        "external_byos_role_arn": {
          "deprecated": true,
          "description": "Deprecated: use byos_credential_uid instead with a AWS_ROLE credential type",
          "type": "string"
        },
        "byos_credential_uid": {
          "description": "Uid of the BYOS credential used to access the bucket",
          "type": "string"
        }
      },
      "required": [
        "type",
        "bucket",
        "key",
        "region"
      ]
    },
    "UrlSource": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "URL"
          ]
        },
        "url": {
          "type": "string",
          "description": "Original media's location where the media can be retrieved from"
        }
      },
      "required": [
        "type",
        "url"
      ]
    }
  }
}