Dub
sourceLanguage), create a named version, then generate with required canvasVideoId, transcribe first, translate first. The video must already exist at S3_VIDEO_KEY. Workers must be running or jobs stay queued.What you need
- Workspace key to mint a project key — or skip create steps with
PERCHAT_PROJECT_ID/PERCHAT_PROJECT_KEY. See Create a project key. connectionId, bucket, and object key from Connect storage. Or let the script create the S3 connection from the env.- Project key with
service:transcribe,service:translate,service:dub, andjob:read. - A completed translation in the same
targetLanguagebefore dubbing — included as a step below. See Translate. targetLanguage— Same ISO code for POST /v1/translate and POST /v1/dub.
1. Create a canvas
POST /v1/canvases creates the canvas and video pool. Each videoSources[] item needs sourceLanguage. One video is enough for this walkthrough; you can also seed several in the same array. Save canvasId and the canvasVideoId you will generate against (videoAssets[0] here). See Canvases.
curl -X POST "{BASE_URL}/v1/canvases" \
-H "Authorization: Bearer {PROJECT_KEY}" \
-H "Content-Type: application/json" \
-d '{
"name": "{CANVAS_NAME}",
"videoSources": [{
"connectionId": "{CONNECTION_ID}",
"bucket": "{S3_BUCKET}",
"sourceKey": "{S3_VIDEO_KEY}",
"sourceLanguage": "{SOURCE_LANGUAGE}"
}]
}'# Same POST — two pool videos, each with its own sourceLanguage.
# Generate still takes one canvasVideoId per job (videoAssets[0] or videoAssets[1]).
curl -X POST "{BASE_URL}/v1/canvases" \
-H "Authorization: Bearer {PROJECT_KEY}" \
-H "Content-Type: application/json" \
-d '{
"name": "{CANVAS_NAME}",
"videoSources": [
{
"connectionId": "{CONNECTION_ID}",
"bucket": "{S3_BUCKET}",
"sourceKey": "{S3_VIDEO_KEY}",
"sourceLanguage": "en"
},
{
"connectionId": "{CONNECTION_ID}",
"bucket": "{S3_BUCKET}",
"sourceKey": "{S3_VIDEO_KEY_TA}",
"sourceLanguage": "ta",
"label": "Tamil master"
}
]
}'2. Create a version
POST /v1/canvases creates the video pool only — it does not create a cut. versions on that response is empty. Then POST /v1/canvases/:canvasId/versions. Optional label only (omit it and the API assigns v1, v2, …). Save canvasVersionId from this response, not from canvas create. Walkthrough: Create a canvas version.
curl -X POST "{BASE_URL}/v1/canvases/{CANVAS_ID}/versions" \
-H "Authorization: Bearer {PROJECT_KEY}" \
-H "Content-Type: application/json" \
-d '{ "label": "v1" }'3. Check workspace services
GET /v1/services with the project key lists whether this workspace may run each service. Fail fast if transcription or dubbing is not enabled. API keys cannot request access — ask a workspace admin (console Settings → Services) or a platform admin. See GET /v1/services.
curl "{BASE_URL}/v1/services" \
-H "Authorization: Bearer {PROJECT_KEY}"
# Confirm transcription and dubbing show "enabled": true before any generate POST.
# API keys cannot request access — ask a workspace admin (Settings → Services).4. Transcribe first
This route needs an active transcript on the cut. POST /v1/transcribe queues a job. Poll until completed before the next step. Same walkthrough as Transcribe a video.
curl -X POST "{BASE_URL}/v1/transcribe" \
-H "Authorization: Bearer {PROJECT_KEY}" \
-H "Content-Type: application/json" \
-d '{
"canvasId": "{CANVAS_ID}",
"canvasVersionId": "{CANVAS_VERSION_ID}",
"canvasVideoId": "{CANVAS_VIDEO_ID}",
"options": { "language": "{SOURCE_LANGUAGE}" }
}'curl "{BASE_URL}/v1/jobs/{JOB_ID}" \
-H "Authorization: Bearer {PROJECT_KEY}"
# Repeat until data.status is completed (or failed / cancelled).
# Then fetch the transcript:
curl "{BASE_URL}/v1/jobs/{JOB_ID}/transcription" \
-H "Authorization: Bearer {PROJECT_KEY}"5. Translate first
Dubbing synthesizes the translated segments. Queue POST /v1/translate with the same targetLanguage you will pass to POST /v1/dub. Poll until completed before dubbing. Same walkthrough as Translate.
translationStatus: missing — no spoken target-language track.curl -X POST "{BASE_URL}/v1/translate" \
-H "Authorization: Bearer {PROJECT_KEY}" \
-H "Content-Type: application/json" \
-d '{
"canvasId": "{CANVAS_ID}",
"canvasVersionId": "{CANVAS_VERSION_ID}",
"canvasVideoId": "{CANVAS_VIDEO_ID}",
"targetLanguage": "{TARGET_LANGUAGE}"
}'curl "{BASE_URL}/v1/jobs/{JOB_ID}" \
-H "Authorization: Bearer {PROJECT_KEY}"
# Repeat until data.status is completed (or failed / cancelled).6. Start dub
POST /v1/dub queues a dubbing job. The response is the Job object (status: queued). Full fields: Services → Dub.
curl -X POST "{BASE_URL}/v1/dub" \
-H "Authorization: Bearer {PROJECT_KEY}" \
-H "Content-Type: application/json" \
-d '{
"canvasId": "{CANVAS_ID}",
"canvasVersionId": "{CANVAS_VERSION_ID}",
"canvasVideoId": "{CANVAS_VIDEO_ID}",
"targetLanguage": "{TARGET_LANGUAGE}"
}'7. Monitor job status
Poll GET /v1/jobs/{jobId} until status is completed, failed, or cancelled. While running, currentStage is the worker stage. Same loop as every generate route — see How jobs work.
curl "{BASE_URL}/v1/jobs/{JOB_ID}" \
-H "Authorization: Bearer {PROJECT_KEY}"
# Repeat until data.status is completed (or failed / cancelled).8. Read the result
The dub lands on the canvas. Refresh GET /v1/canvases/{canvasId}, then GET /v1/dubbings/{dubbingId}. Skip translate and the Dubbing record reports translationStatus: missing.
Shared body fields (canvasId, canvasVersionId, canvasVideoId, overwrite, webhookUrl) are on Services.
Run the script
Replace {…} placeholders. After each POST, copy jobId and poll until completed before the next job.
# Video object must already exist at {S3_VIDEO_KEY} in {S3_BUCKET}.
# Full partner flow: workspace key → project key → S3 → canvas → (transcribe) → this service.
curl "{BASE_URL}/v1/workspace" \
-H "Authorization: Bearer {WORKSPACE_KEY}"
curl -X POST "{BASE_URL}/v1/projects" \
-H "Authorization: Bearer {WORKSPACE_KEY}" \
-H "Content-Type: application/json" \
-d '{"name": "{PROJECT_NAME}"}'
curl -X POST "{BASE_URL}/v1/project-api-keys" \
-H "Authorization: Bearer {WORKSPACE_KEY}" \
-H "Content-Type: application/json" \
-d '{"projectId": "{PROJECT_ID}", "serviceAccountName": "{SERVICE_ACCOUNT_NAME}"}'
curl -X POST "{BASE_URL}/v1/storage-connections" \
-H "Authorization: Bearer {PROJECT_KEY}" \
-H "Content-Type: application/json" \
-d '{
"name": "{STORAGE_CONNECTION_NAME}",
"provider": "s3",
"region": "{AWS_REGION}",
"accessKeyId": "{AWS_ACCESS_KEY_ID}",
"secretAccessKey": "{AWS_SECRET_ACCESS_KEY}",
"buckets": [{ "name": "{S3_BUCKET}", "defaultOutputPrefix": "{S3_OUTPUT_PREFIX}" }]
}'
curl -X POST "{BASE_URL}/v1/canvases" \
-H "Authorization: Bearer {PROJECT_KEY}" \
-H "Content-Type: application/json" \
-d '{
"name": "{CANVAS_NAME}",
"videoSources": [{
"connectionId": "{CONNECTION_ID}",
"bucket": "{S3_BUCKET}",
"sourceKey": "{S3_VIDEO_KEY}",
"sourceLanguage": "{SOURCE_LANGUAGE}"
}]
}'
curl -X POST "{BASE_URL}/v1/canvases/{CANVAS_ID}/versions" \
-H "Authorization: Bearer {PROJECT_KEY}" \
-H "Content-Type: application/json" \
-d '{ "label": "v1" }'
curl "{BASE_URL}/v1/services" \
-H "Authorization: Bearer {PROJECT_KEY}"
# Confirm transcription and dubbing show "enabled": true before generate POSTs.
curl -X POST "{BASE_URL}/v1/transcribe" \
-H "Authorization: Bearer {PROJECT_KEY}" \
-H "Content-Type: application/json" \
-d '{
"canvasId": "{CANVAS_ID}",
"canvasVersionId": "{CANVAS_VERSION_ID}",
"canvasVideoId": "{CANVAS_VIDEO_ID}",
"options": { "language": "{SOURCE_LANGUAGE}" }
}'
# Poll until data.status is completed
curl "{BASE_URL}/v1/jobs/{TRANSCRIBE_JOB_ID}" \
-H "Authorization: Bearer {PROJECT_KEY}"
curl -X POST "{BASE_URL}/v1/translate" \
-H "Authorization: Bearer {PROJECT_KEY}" \
-H "Content-Type: application/json" \
-d '{
"canvasId": "{CANVAS_ID}",
"canvasVersionId": "{CANVAS_VERSION_ID}",
"canvasVideoId": "{CANVAS_VIDEO_ID}",
"targetLanguage": "{TARGET_LANGUAGE}"
}'
# Poll until data.status is completed before dubbing
curl "{BASE_URL}/v1/jobs/{TRANSLATE_JOB_ID}" \
-H "Authorization: Bearer {PROJECT_KEY}"
curl -X POST "{BASE_URL}/v1/dub" \
-H "Authorization: Bearer {PROJECT_KEY}" \
-H "Content-Type: application/json" \
-d '{
"canvasId": "{CANVAS_ID}",
"canvasVersionId": "{CANVAS_VERSION_ID}",
"canvasVideoId": "{CANVAS_VIDEO_ID}",
"targetLanguage": "{TARGET_LANGUAGE}"
}'
# Poll until data.status is completed
curl "{BASE_URL}/v1/jobs/{JOB_ID}" \
-H "Authorization: Bearer {PROJECT_KEY}"