> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mountsea.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Insert Object into Video

> Add an object to the video.
- **With imageMask**: insert at the masked area (white = insertion zone)
- **Without imageMask**: AI automatically determines placement based on prompt

## Overview

Add an object to a previously generated video. You can control placement with an optional image mask.

### Two Modes

| Mode                    | Description                                                       |
| ----------------------- | ----------------------------------------------------------------- |
| **With `imageMask`**    | Insert at the masked area (white pixels = insertion zone)         |
| **Without `imageMask`** | AI automatically determines optimal placement based on the prompt |

<Warning>
  Requires a valid `videoId` (mediaId) from a previously generated video.
</Warning>

<Tip>
  The `imageMask` should be a base64-encoded JPEG image where **white areas** indicate where the object should be inserted.
</Tip>


## OpenAPI

````yaml POST /gemini/video/object/insert
openapi: 3.0.0
info:
  title: Gemini AI
  description: API documentation for Gemini AI
  version: 1.0.0
  contact: {}
servers:
  - url: https://api.mountsea.ai
    description: API Gateway
security: []
tags:
  - name: gemini
    description: ''
paths:
  /gemini/video/object/insert:
    post:
      tags:
        - gemini
      summary: Insert object into video
      description: >-
        Add an object to the video.

        - **With imageMask**: insert at the masked area (white = insertion zone)

        - **Without imageMask**: AI automatically determines placement based on
        prompt
      operationId: ApiPublicController_insertObject
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VideoObjectInsertionDto'
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TaskIdDto'
      security:
        - bearerAuth: []
components:
  schemas:
    VideoObjectInsertionDto:
      type: object
      properties:
        videoId:
          type: string
          description: Video ID (mediaId) from a previously generated video
          example: CAUSJD...
        prompt:
          type: string
          description: Prompt describing what to insert
          example: add a flying pig with black wings
        imageMask:
          type: string
          description: >-
            Base64 encoded JPEG image mask (optional). White areas indicate
            where to insert the object. If not provided, AI auto-determines
            placement.
          example: /9j/4AAQSkZJRg...
      required:
        - videoId
        - prompt
    TaskIdDto:
      type: object
      properties:
        taskId:
          type: string
          description: task id, used to get task result later
      required:
        - taskId
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````