---
title: "Generate Scene"
method: POST
path: "/api/projects/{project_id}/scenes/generate"
---

# Generate Scene

`POST /api/projects/{project_id}/scenes/generate`

Generate a new scene with AI-generated video plan.

This endpoint:
1. Creates a new scene at the end of the project
2. Optionally processes uploaded reference images
3. Generates a video plan using LLM (keyframes and motion videos)
4. Saves keyframe and video records to the database
5. Returns the newly created scene with its plan

Args:
    project_id: Project ID to add scene to
    description: Description of the scene to generate
    duration: Optional duration in milliseconds. If not provided (None/empty), uses 'auto' mode
             where duration is determined by ai_video_generation.py based on voiceover length
    files: Optional reference images for generation
    current_user: Authenticated user
    db: Database session
    
Returns:
    Scene response with generated plan

## Path parameters

- `project_id` string, required

## Response `201`

Successful Response

- object

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.dev/latted/apis/motion-graphics-designer-api.md) · [All operations](https://skmtc.dev/latted/apis/motion-graphics-designer-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/latted/motion-graphics-designer-api/revisions/36d149b525df/schema)
