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

# Video Personalization

> Re-tell one video for a specific audience using the Python or TypeScript SDK

## Overview

Video personalization re-tells a finished video for one audience. The facts, the speakers, their voices and the timing stay as they were; the wording changes to suit the people you name in the prompt. One workout video becomes a beginner version that names every move, and one highlight package explains itself to someone watching the sport for the first time, with nothing re-shot and nobody re-recorded.

The pipeline is asynchronous: submit the video and a prompt, poll until the task reports `SUCCESS`, then fetch the result.

### Prerequisites

**1. Create an account**

Sign up at [CAMB.AI Studio](https://studio.camb.ai) if you haven't already.

**2. Get your API key**

Go to **Settings → API Keys** in Studio and copy your key. See [Authentication](https://docs.camb.ai/getting-started/authentication.md) for details.

**3. Install the SDK**

```bash Python theme={null} theme={null} theme={null}
pip install camb-sdk
```

```bash TypeScript theme={null} theme={null} theme={null}
npm install @camb-ai/sdk
```

Skip this step if you're using the [direct API](https://docs.camb.ai/tutorials/direct-api.md).

**4. Set your API key to use in your code**

```bash theme={null} theme={null} theme={null}
export CAMB_API_KEY="your_api_key_here"
```

***

## Code

This submits a video, polls until it finishes, prints the download links and creates a public link to share.

```python Python theme={null}
import os
import time

from camb.client import CambAI

client = CambAI(api_key=os.environ["CAMB_API_KEY"])

created = client.personalize.create_video(
    video_url="https://example.com/workout-video.mp4",
    prompt="Personalize this workout for a total beginner. Say what each move does, how it should feel, and what they can leave out on the first day.",
    project_name="Workout for beginners",
)
print(f"Personalization task created: {created.task_id}")

while True:
    status = client.personalize.get_status(created.task_id)
    print(f"Current status: {status.status}")
    if status.status == "SUCCESS":
        result = client.personalize.get_result(status.run_id)
        print(f"Video URL: {result.video_url}")
        print(f"Audio URL: {result.audio_url}")

        share = client.personalize.share_video(status.run_id)
        print(f"Share URL: {share.share_url}")
        break
    time.sleep(15)
```

```typescript TypeScript theme={null}
import { CambClient, CambApi } from "@camb-ai/sdk";

const client = new CambClient({ apiKey: process.env.CAMB_API_KEY });
const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));

async function personalizeVideo() {
    const created = await client.personalize.createVideo({
        video_url: "https://example.com/workout-video.mp4",
        prompt: "Personalize this workout for a total beginner. Say what each move does, how it should feel, and what they can leave out on the first day.",
        project_name: "Workout for beginners",
    });
    const taskId = created.task_id!;
    console.log(`Personalization task created: ${taskId}`);

    while (true) {
        const status = await client.personalize.getStatus({ task_id: taskId });
        console.log(`Current status: ${status.status}`);

        if (status.status === CambApi.TaskStatus.Success) {
            const runId = status.run_id!;
            const result = await client.personalize.getResult({ run_id: runId });
            console.log(`Video URL: ${result.video_url}`);
            console.log(`Audio URL: ${result.audio_url}`);

            const share = await client.personalize.shareVideo({ run_id: runId });
            console.log(`Share URL: ${share.share_url}`);
            return;
        }
        await sleep(15_000);
    }
}

void personalizeVideo();
```

> [!NOTE]
>
> Personalization re-voices every line, so a run takes noticeably longer than the source video. Poll every 10 to 15 seconds rather than submitting the job twice.

***

## Writing the Prompt

The prompt decides how the video gets re-told, so give it a sentence or two rather than a single word.

Say three things: **who is watching**, **what they already know**, and **how it should sound**.

Be specific about who. "A total beginner" beats "viewers", because the script then explains the things that person would not know. A beginner needs every move named and the pace slowed; someone who trains every day does not. Words like friendly, slow or punchy also change how each line is spoken, since every line is re-voiced.

### Examples

| The video | Prompt |
| - | - |
| A workout video | `Personalize this workout for a total beginner. Say what each move does, how it should feel, and what they can leave out on the first day.` |
| A sports highlight | `Personalize this for someone watching this sport for the first time. Say what the players are doing and why it matters, and do not assume they know the rules.` |
| A school class | `Personalize this for 10 year olds. Short sentences, simple words, and examples from things they already know, like school or games.` |

> [!WARNING]
>
> `make it better`, `professional` or a single word like `kids` will produce a competent read of the original and little else. The system has nothing to aim at, so it re-words rather than re-frames.

### What the Prompt Cannot Change

The prompt steers wording and delivery, not substance. Claims, numbers, names and anything shown on screen stay as they are, and the speakers keep their own voices and turns. Asking for a different ending, an extra feature or a competitor's name will not produce one.

***

## Using an Uploaded File

Pass `file_id` instead of `video_url` to personalize a video you uploaded through the Files API. Provide exactly one of the two. The Files API is enabled per workspace; contact support if your key cannot reach it.

```python Python theme={null}
created = client.personalize.create_video(
    file_id="0f8e2a1c-4b6d-4f1a-9c3e-77b0d2a5e913",
    prompt="Personalize this for 10 year olds. Short sentences and simple words.",
)
```

```typescript TypeScript theme={null}
const created = await client.personalize.createVideo({
    file_id: "0f8e2a1c-4b6d-4f1a-9c3e-77b0d2a5e913",
    prompt: "Personalize this for 10 year olds. Short sentences and simple words.",
});
```

***

## Listing Your Runs

Every personalization you start, from the API or from Studio, appears in one list with its progress, so you can drive a dashboard without holding on to task IDs.

```python Python theme={null}
runs = client.personalize.list_runs(limit=20, offset=0)
for run in runs.runs:
    print(f"{run.run_id}  {run.status:<10} {run.progress_pct:>3}%  {run.stage:<12} {run.title}")
```

```typescript TypeScript theme={null}
const runs = await client.personalize.listRuns({ limit: 20, offset: 0 });
for (const run of runs.runs) {
    console.log(`${run.run_id}  ${run.status}  ${run.progress_pct}%  ${run.stage}  ${run.title}`);
}
```

***

## Parameters

### Required

| Parameter | Type | Description |
| - | - | - |
| `prompt` | string | Who the video is for and how it should speak to them. 1 to 5000 characters. |
| `video_url` **or** `file_id` | string | A publicly accessible video URL, or the `file_id` of a video uploaded through the Files API. Provide exactly one. |

### Optional

| Parameter | Type | Description |
| - | - | - |
| `keep_music` | boolean | Keep the original background music under the new voiceover. Defaults to `true`; set `false` to deliver speech over silence. |
| `project_name` | string | Label for the run in Studio. Defaults to a generated name. |
| `folder_id` | integer | Studio folder to file the run in. |

### Result Fields

| Field | Description |
| - | - |
| `status` | `queued`, `processing`, `completed` or `failed`. |
| `video_url` | The personalized video, with the new voiceover mixed under the original footage. `null` until `completed`. |
| `audio_url` | The personalized voiceover on its own. `null` until `completed`. |
| `original_video_url` | The source video you submitted. |

***

## Tips

* **Source quality carries through.** Clear speech with little crosstalk personalizes best, exactly as it dubs best.
* **One audience per run.** Two audiences in one prompt average into a voice that suits neither. Submit the same video twice instead; the source is transcribed per run, so the two results stay independent.
* **Keep the music off for corporate re-cuts.** `keep_music=false` gives you clean speech to lay under your own bed.
* **Links expire.** `video_url` and `audio_url` are time-limited. Call the result endpoint again for a fresh link rather than caching one.
* **Share links last 7 days.** Calling the share endpoint again inside that window returns the same link rather than minting a new one.

***

## Next Steps

> [card] [Create Video Personalization](https://docs.camb.ai/api-reference/endpoint/create-personalize-video.md)
>
> Full API reference for the creation endpoint.

> [card] [Get Task Status](https://docs.camb.ai/api-reference/endpoint/get-personalize-video-status.md)
>
> Status polling endpoint reference.

> [card] [Get Result](https://docs.camb.ai/api-reference/endpoint/get-personalize-video-result.md)
>
> Retrieve the personalized video and audio URLs.

> [card] [Create a Share Link](https://docs.camb.ai/api-reference/endpoint/create-personalize-video-share.md)
>
> Publish a finished video on a link that works for 7 days.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.