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

# Create Viral Ad Clone Video Tasks

> Creates one or more video generation tasks from a Viral Ads Clone project whose script is already available. This endpoint can be called multiple times for the same project. If a script is provided, it is used only for this batch and does not overwrite the project view_script.



## OpenAPI

````yaml POST /v1/video/viral-ads-clone/{project_id}/videos
openapi: 3.1.0
info:
  title: Loova API
  description: Loova API lets developers generate AI images and videos programmatically.
  version: 1.0.0
servers:
  - url: https://api.loova.ai/api
security:
  - bearerAuth: []
paths:
  /v1/video/viral-ads-clone/{project_id}/videos:
    post:
      summary: Create Viral Ad Clone Video Tasks
      description: >-
        Creates one or more video generation tasks from a Viral Ads Clone
        project whose script is already available. This endpoint can be called
        multiple times for the same project. If a script is provided, it is used
        only for this batch and does not overwrite the project view_script.
      operationId: createViralAdsCloneVideos
      parameters:
        - name: project_id
          in: path
          required: true
          description: The project ID returned by the create project endpoint.
          schema:
            type: string
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateViralAdsCloneVideosRequest'
            example:
              script: |-
                0.0-2.0s
                Close-up of the product...
              out_number: 2
              resolution: 720
              aspect_ratio: '9:16'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateViralAdsCloneVideosResponse'
              example:
                code: 200
                trace_id: 45c30d76f06549b199a3775544515689
                message: null
                data:
                  project_id: 683f1a2b3c4d5e6f7890abcd
                  project_status: running
                  current_step: generating_video
                  task_ids:
                    - 68401a2b3c4d5e6f7890abcd
                    - 68401a2b3c4d5e6f7890abce
        '400':
          description: Request failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                code: 400
                trace_id: 45c30d76f06549b199a3775544515689
                message: Detailed error message
                data: null
        '404':
          description: Request failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                code: 100099
                trace_id: 45c30d76f06549b199a3775544515689
                message: Project not found
                data: null
        '409':
          description: Business-level rejection
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                scriptNotReady:
                  summary: Script is not ready
                  value:
                    code: 100099
                    trace_id: 45c30d76f06549b199a3775544515689
                    message: Script is not ready
                    data: null
                insufficientCredits:
                  summary: Insufficient API credits
                  value:
                    code: 300111
                    trace_id: 45c30d76f06549b199a3775544515689
                    message: Insufficient API credits
                    data: null
      security:
        - bearerAuth: []
components:
  schemas:
    CreateViralAdsCloneVideosRequest:
      type: object
      properties:
        script:
          type:
            - string
            - 'null'
          description: >-
            Optional script for this video batch. If omitted, the project
            view_script is used. This value does not overwrite the project
            original script.
        out_number:
          type: integer
          minimum: 1
          maximum: 4
          description: >-
            Number of video tasks to create in this call. If omitted, the
            project default is used.
        resolution:
          type:
            - integer
            - string
          description: >-
            Resolution for this video batch. If omitted, the project default is
            used.
        aspect_ratio:
          type: string
          enum:
            - '9:16'
            - '1:1'
            - '16:9'
          description: >-
            Aspect ratio for this video batch. If omitted, the project default
            is used.
      description: |-
        Validation rules:
        - The project script must already be generated
        - `out_number`, if provided, must be between 1 and 4
        - If `script` is provided, it must be a non-empty string after trimming
    CreateViralAdsCloneVideosResponse:
      type: object
      properties:
        code:
          type: integer
        trace_id:
          type: string
        message:
          type:
            - string
            - 'null'
        data:
          type: object
          properties:
            project_id:
              type: string
            project_status:
              $ref: '#/components/schemas/ViralAdsCloneProjectStatus'
            current_step:
              $ref: '#/components/schemas/ViralAdsCloneCurrentStep'
            task_ids:
              type: array
              items:
                type: string
              description: Video task IDs created by this request.
    ErrorResponse:
      type: object
      properties:
        code:
          type: integer
        trace_id:
          type: string
        message:
          type:
            - string
            - 'null'
        data:
          type:
            - object
            - 'null'
    ViralAdsCloneProjectStatus:
      type: string
      enum:
        - draft
        - running
        - succeeded
        - failed
      description: Project status.
    ViralAdsCloneCurrentStep:
      type: string
      enum:
        - preparing_media
        - analyzing
        - generating_script
        - script_ready
        - generating_video
        - failed
      description: Coarse-grained current project step.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````