Transcribe a video

Canvas-first: point a canvas at the S3 object, start transcription, wait with poll or a webhook, then optionally generate metadata. The video must already exist at S3_VIDEO_KEY. Workers must be running or jobs stay queued. Already have captions? Bring your own transcript instead — no ASR job.

What you need

  • Project key with service:transcribe, job:read, and canvas / transcript permissions.
  • connectionId, bucket, and object key from Connect storage.

1. Create a canvas

POST /v1/canvases creates the canvas and video pool. Each videoSources[] item needs sourceLanguage. This call does not create a cut — versions is empty. You add the cut in the next step. One video is enough for this tutorial; you can also seed several in the same array. Save canvasId and the canvasVideoId you will transcribe (videoAssets[0] here). See Canvases.

POST /v1/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 route — more than one video
# 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.

POST /v1/canvases/{canvasId}/versions
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 metadata is not enabled — do not wait for the later 403. API keys cannot request access; ask a workspace admin (console Settings → Services) or a platform admin. See GET /v1/services.

GET /v1/services
curl "{BASE_URL}/v1/services" \
  -H "Authorization: Bearer {PROJECT_KEY}"
# Confirm transcription and metadata show "enabled": true before any generate POST.
# API keys cannot request access — ask a workspace admin (Settings → Services).

4. Start transcription

POST /v1/transcribe queues a job. The response is the Job object (status: queued). See Services. Optional webhookUrl on this body is covered in the next step.

POST /v1/transcribe
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}" }
  }'

5. Wait for the job

The create call returns immediately. Pick one wait path — or use both. This tutorial polls so it runs from a laptop without a public HTTPS URL.

Poll

GET /v1/jobs/{jobId} until status is completed, failed, or cancelled. Do not poll the jobs list. While running, currentStage is the worker stage (for example download, transcribe). On success, resultSummary.textSourceId is the transcript id. You can also GET /v1/jobs/{jobId}/transcription.

GET /v1/jobs/{jobId}
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}"

Webhook

Pass webhookUrl (HTTPS) on POST /v1/transcribe to override the callback for that job. Or set a project default once with PATCH /v1/project-webhooks/settings and omit it. If neither is set, no callbacks are sent.

Perchat POSTs JSON to that URL on each status change. Wait for event: completed (or failed / cancelled). The job field is the same Job object as retrieve — on success, job.resultSummary.textSourceId is the transcript. Verify signatures in production.

POST /v1/transcribe with webhookUrl
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}",
    "webhookUrl": "https://example.com/webhooks/perchat",
    "options": { "language": "{SOURCE_LANGUAGE}" }
  }'
{
  "event": "completed",
  "timestamp": "2026-06-01T12:00:00.123Z",
  "job": {
    "jobId": "job_…",
    "serviceType": "transcription",
    "status": "completed",
    "resultSummary": { "textSourceId": "txt_…" }
  }
}

Full events, retries, and signature verification: Webhooks. Same wait pattern as How jobs work.

6. Generate metadata (optional)

After a completed transcript, POST /v1/metadata queues a metadata job on the same canvas. Poll or webhook it the same way, then GET /v1/transcriptions/{textSourceId}/metadata for title, description, categories, and chapters.

POST /v1/metadata
curl -X POST "{BASE_URL}/v1/metadata" \
  -H "Authorization: Bearer {PROJECT_KEY}" \
  -H "Content-Type: application/json" \
-d '{ "canvasId": "{CANVAS_ID}", "canvasVersionId": "{CANVAS_VERSION_ID}", "canvasVideoId": "{CANVAS_VIDEO_ID}" }'

# Poll GET /v1/jobs/{JOB_ID} until completed, then:
curl "{BASE_URL}/v1/transcriptions/{TEXT_SOURCE_ID}/metadata" \
  -H "Authorization: Bearer {PROJECT_KEY}"
Another take? Same cut and pool video — New transcription version. Every service: New service versions. A new named cut is Create a canvas version.

Run the script

Replace {…} placeholders. After transcribe, wait until completed (poll GET /v1/jobs/{jobId} or handle the webhook) before metadata.

Canvas → version → transcribe → metadata
# Video object must already exist at {S3_VIDEO_KEY} in {S3_BUCKET}.
# This is the full partner flow: workspace key → project key → S3 → canvas → transcribe → metadata.

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 metadata 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}" }
  }'
# Optional: add "webhookUrl": "https://example.com/webhooks/perchat" to that body
# instead of (or as well as) polling.

# Poll until data.status is completed
curl "{BASE_URL}/v1/jobs/{JOB_ID}" \
  -H "Authorization: Bearer {PROJECT_KEY}"

curl -X POST "{BASE_URL}/v1/metadata" \
  -H "Authorization: Bearer {PROJECT_KEY}" \
  -H "Content-Type: application/json" \
-d '{ "canvasId": "{CANVAS_ID}", "canvasVersionId": "{CANVAS_VERSION_ID}", "canvasVideoId": "{CANVAS_VIDEO_ID}" }'