# Scenario Caption Studio — API Reference Model ID: `model_scenario-caption-studio` --- ## Authentication - **API_KEY** and **API_SECRET** are found in your [Scenario Project Settings](https://app.scenario.com/team&tab=project_api_keys) under API Keys. - Set them as environment variables `SCENARIO_SDK_API_KEY` and `SCENARIO_SDK_API_SECRET` — both SDKs pick them up by default. - For raw HTTP (cURL), use Basic Auth: `Authorization: Basic base64(":")`. ### Install the SDK - JavaScript / TypeScript: `npm install @scenario-labs/sdk` - Python: `pip install scenario-sdk` --- ## Generate **Endpoint:** `POST https://api.cloud.scenario.com/v1/generate/custom/model_scenario-caption-studio` ### Parameters | Parameter | Type | Required | Default | Description | |-----------|------|----------|---------|-------------| | `video` | assetId | yes | - | The video you want to caption. | | `subtitles` | assetId | - | - | Optional. Upload an existing subtitle file (.srt) to use. Leave it empty and the audio will be transcribed automatically. | | `targetLanguage` | string | - | `auto` | Translate captions into this language. Leave on Auto to keep the original spoken language. | | `stylePreset` | string | - | `` | Pick a ready-made caption style (TikTok Bouncy, Karaoke Fill, Cinematic Fade, and more). Leave empty for the default look. | | `themeTsx` | string | - | - | Advanced: supply your own custom caption theme to fully replace the preset. If you also add a Style Prompt, it refines this theme. | | `stylePrompt` | string | - | - | Describe the caption look you want in plain words and the model will build a matching style. | | `maxSegmentDuration` | number | - | - | The longest a single caption can stay on screen, in seconds. | | `maxSegmentChars` | number | - | - | The most characters a caption can hold before it splits into the next one. | | `maxSegmentWords` | number | - | - | The most words per caption. Set to 1 to show one word at a time, great for karaoke-style captions. | | `fontColor` | string | - | `#FFFFFF` | Main text colour, as a hex code (e.g. #FFFFFF for white). | | `accentColorStart` | string | - | `#FF8A3D` | Colour used to highlight or animate words (e.g. karaoke and pop styles). This is where the gradient begins. Hex code, e.g. #FF8A3D. | | `accentColorEnd` | string | - | `#FF3D8A` | The colour the accent gradient ends on. Set it to a different colour from the start to create a gradient. Hex code, e.g. #FF3D8A. | | `textPosition` | string | - | `bottom` | Where captions sit on screen — top, middle, or bottom. | | `fontSizePx` | number | - | - | Caption font size in pixels. Leave empty to size automatically. | | `maxLines` | number | - | `2` | The most lines a caption can wrap onto. | | `textWidthPct` | number | - | - | How much of the screen width captions can fill, as a percentage. | | `transcriptionPrompt` | string | - | - | Optional hint to improve transcription — list names, brands, or technical terms used in the video so they're spelled correctly. | | `modelSize` | string | - | `medium` | Transcription quality. Larger sizes are more accurate but slower and cost more. | | `compressionLevel` | number | - | `23` | Output quality. Lower numbers mean higher quality and larger files. | | `outputVideo` | boolean | - | `true` | Return the finished video with captions burned in. | | `outputSrt` | boolean | - | `false` | Also return the captions as a separate .srt file you can reuse or edit. | | `outputTsx` | boolean | - | `false` | Advanced: also return the caption theme used to render the video. | | `outputSubtitles` | string | - | `video_image` | How captions appear in the video. Burn Into Video bakes the styled captions permanently into the picture, so they always show and keep their style — but can't be turned off. Soft Subtitle Track adds captions as a separate track the viewer can switch on or off; it's faster, but shows plain text without the preset styling. Only applies when Output Video is on. | ### Example Requests **cURL** ```bash curl -X POST "https://api.cloud.scenario.com/v1/generate/custom/model_scenario-caption-studio" \ -H "Authorization: Basic $(echo -n ':' | base64)" \ -H "Content-Type: application/json" \ --data-binary @- <<'EOF' { "video": "", "targetLanguage": "auto", "stylePreset": "", "fontColor": "#FFFFFF", "accentColorStart": "#FF8A3D", "accentColorEnd": "#FF3D8A", "textPosition": "bottom", "maxLines": 2, "modelSize": "medium", "compressionLevel": 23, "outputVideo": true, "outputSrt": false, "outputTsx": false, "outputSubtitles": "video_image" } EOF ``` **Python** ```python import os from scenario_sdk import Scenario client = Scenario( api_key=os.environ.get("SCENARIO_SDK_API_KEY"), api_secret=os.environ.get("SCENARIO_SDK_API_SECRET"), ) body = { "video": "", "targetLanguage": "auto", "stylePreset": "", "fontColor": "#FFFFFF", "accentColorStart": "#FF8A3D", "accentColorEnd": "#FF3D8A", "textPosition": "bottom", "maxLines": 2, "modelSize": "medium", "compressionLevel": 23, "outputVideo": True, "outputSrt": False, "outputTsx": False, "outputSubtitles": "video_image" } response = client.generate.run_model( model_id="model_scenario-caption-studio", body=body, ) print(response) ``` **JavaScript** ```javascript import Scenario from "@scenario-labs/sdk"; const client = new Scenario({ apiKey: process.env["SCENARIO_SDK_API_KEY"], apiSecret: process.env["SCENARIO_SDK_API_SECRET"], }); const body = { "video": "", "targetLanguage": "auto", "stylePreset": "", "fontColor": "#FFFFFF", "accentColorStart": "#FF8A3D", "accentColorEnd": "#FF3D8A", "textPosition": "bottom", "maxLines": 2, "modelSize": "medium", "compressionLevel": 23, "outputVideo": true, "outputSrt": false, "outputTsx": false, "outputSubtitles": "video_image" }; const response = await client.generate.runModel("model_scenario-caption-studio", { body }); console.info(response); ``` --- ## Retrieve Results After submitting a generation request, you receive a `jobId`. Poll the job until `job.status` is `"success"`. The generated asset IDs are in `job.metadata.assetIds`. **Endpoint:** `GET https://api.cloud.scenario.com/v1/jobs/{jobId}` ### Example Requests **cURL** ```bash curl -X GET "https://api.cloud.scenario.com/v1/jobs/" \ -H "Authorization: Basic $(echo -n ':' | base64)" ``` **Python** ```python job = client.jobs.retrieve(job_id="") print(job.status) print(job.metadata.asset_ids) ``` **JavaScript** ```javascript // Option 1 — wait on the response from runModel using the SDK helper const completed = await response.job.wait(); console.info(completed.status); console.info(completed.metadata?.assetIds); // Option 2 — retrieve a job by its ID const job = await client.jobs.retrieve(""); console.info(job.status); console.info(job.metadata?.assetIds); ``` **Example response:** ```json { "job": { "jobId": "job_abc123", "status": "success", "metadata": { "assetIds": [ "asset_abc123" ] } } } ``` > **Important:** Generated asset URLs are **temporary** and expire after a short period. Download and store any images you wish to keep before the URL expires. More info: [Content Delivery Network (CDN)](https://docs.scenario.com/get-started/documentation/content-delivery-network-cdn). --- *Generated by [Scenario](https://app.scenario.com)*