> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs-dev.ltx.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs-dev.ltx.io/_mcp/server.

# Blend a foreground element into a shot

POST https://api.ltx.io/v2/video-compositing
Content-Type: application/json

Place an object or character over the background footage in your editor and export the rough composite as a single video. The API uses that video to blend the element into the shot. It can match the lighting and color, soften hard edges, and add details such as contact shadows and reflections.

### Prepare the shot

Set the element's scale, position, and timing in your editor. If the camera moves, track the element so it stays in place in the scene. Rough edges or mismatched lighting are fine. Fast movement and complex occlusions can still produce artifacts, so review the result around those moments.

### Prompt guidelines

A prompt is optional. Use one for complex shots, such as when the element's mask is damaged or incomplete, objects overlap, or you want more control over how a material looks. In plain sentences, describe the finished shot in this order.

1. **Identify the element.** Say what it is and where it sits in the frame.
2. **Describe the lighting.** Say where each light comes from and what color it is.
3. **Describe the visual effects you want.** Include shadows, reflections, objects passing in front, and any focus or blur. Mention details to preserve, such as a face.

Describe the result you want, for example, “A soft shadow sits under the paws.” If the lighting changes or something passes in front of the element, describe those changes in the order they happen.

### Input limits

Use a constant frame rate of 20–60 fps and a clip up to 20 seconds. The long side must be 448–3840 pixels and the short side 256–2176 pixels, in either orientation. The clip must also fit the frame cap for its size.

| Frame size (either orientation) | Maximum frames |
| ------------------------------- | -------------: |
| 1280×720                        |          1,689 |
| 1920×1080                       |            761 |
| 2560×1440                       |            417 |
| 3840×2160                       |            185 |

For other sizes, use the cap for the smallest size in the table with at least as many pixels. For sizes with more pixels than 3840×2160, use the 185-frame cap. Both limits apply. For example, a 3840×2160 clip at 24 fps can be about 7.7 seconds long.

### Get the result

The response contains a job `id` and `created_at`. [Poll the job](/async-jobs) at `GET /v2/video-compositing/{id}`. When the job completes, download the video from `result.video_url`. A ProRes 422 HQ or 4444 input gives a ProRes `.mov` in the same profile, keeping a 4444 input's alpha channel. Any other input gives an H.264 MP4.

The output keeps the input's displayed orientation, frame rate, and frame count. Odd dimensions are padded by one pixel. The output uses the source audio when available. A source with no audio track gives a video with no audio.

Billing is based on the length of the input video. See [Pricing](/pricing#video-compositing).

Reference: https://docs-dev.ltx.io/api-documentation/api-reference/async-video-generation/submit-video-compositing

## Authentication

- `Authorization` header (bearer token, required) — API key authentication

## Request

### Body (application/json)

This endpoint expects a VideoCompositingRequest.

- `video_uri` (string, required) — The rough composite as an HTTPS URL, a base64 data URI, or a [Cloud Storage](/input-formats#cloud-storage-upload) `storage_uri`. See [video formats and codecs](/input-formats#videos). Up to 100 MB from HTTPS or Cloud Storage and up to 15 MB as a data URI.
- `prompt` (string, optional) — Describe the finished shot, including the element, its lighting, and how it should blend into the scene. A blank prompt is ignored.

## Response

### 202

Job submitted successfully

- `id` (string, required) — Unique job identifier. Use this to poll for status.
- `created_at` (datetime, required) — ISO 8601 timestamp of when the job was created.

## Errors

### 400 Bad Request Error

The request is invalid or malformed

- `type` (enum, required) — Response type indicator
  - Allowed values: `error`
- `error` (ErrorError, required)

### 401 Unauthorized Error

Authentication failed

- `type` (enum, required) — Response type indicator
  - Allowed values: `error`
- `error` (ErrorError, required)

### 413 Content Too Large Error

The request body exceeds 32 MB

- `type` (enum, required) — Response type indicator
  - Allowed values: `error`
- `error` (ErrorError, required)

### 429 Too Many Requests Error

Queue limit exceeded

- `type` (enum, required) — Response type indicator
  - Allowed values: `error`
- `error` (ErrorError, required)

### 500 Internal Server Error

An unexpected error occurred

- `type` (enum, required) — Response type indicator
  - Allowed values: `error`
- `error` (ErrorError, required)

## Types

### ErrorError

- `type` (string, required) — Error type for programmatic handling
- `message` (string, required) — Human-readable error description

## Examples

**Request**

```json
{
  "video_uri": "https://example.com/rough-composite.mp4",
  "prompt": "The element is the red leather bag on the left, resting on the table. Warm window light falls on it from the right. A soft contact shadow sits under the bag, matching the other shadows on the table."
}
```

**Response**

```json
{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "created_at": "2026-01-15T10:00:00.000Z"
}
```

**SDK Code**

```python
import requests

url = "https://api.ltx.io/v2/video-compositing"

payload = {
    "video_uri": "https://example.com/rough-composite.mp4",
    "prompt": "The element is the red leather bag on the left, resting on the table. Warm window light falls on it from the right. A soft contact shadow sits under the bag, matching the other shadows on the table."
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.ltx.io/v2/video-compositing"

	payload := strings.NewReader("{\n  \"video_uri\": \"https://example.com/rough-composite.mp4\",\n  \"prompt\": \"The element is the red leather bag on the left, resting on the table. Warm window light falls on it from the right. A soft contact shadow sits under the bag, matching the other shadows on the table.\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.ltx.io/v2/video-compositing")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"video_uri\": \"https://example.com/rough-composite.mp4\",\n  \"prompt\": \"The element is the red leather bag on the left, resting on the table. Warm window light falls on it from the right. A soft contact shadow sits under the bag, matching the other shadows on the table.\"\n}")
  .asString();
```