Guides/Batching videos

Batch-process up to 200 videos

Batch-process up to 200 videos in one POST against one schema, track progress with a single job id, and collect every result together.

Why batches

There is no separate batch endpoint. videos is a list on every submission, so batching means passing a longer one — nothing about the call changes between one video and two hundred.

What a batch buys you is one id and one call. Each video is still fetched and extracted as its own job, so one video without captions cannot fail the other ninety-nine, and one slow video does not hold the rest back. Several run at once, so a long list finishes well before the sum of its videos, and the price is the same per video however you group them.

Submitting

POST /v1
{
"videos": [
"https://youtu.be/…",
"https://youtu.be/…"
],
"multiple": true,
"schema": [
{
"name": "city",
"type": "verbatim-string",
"description": "A city the speaker mentions visiting"
}
]
}
202 · accepted
{
"job_id": "b3f1c0d2-77a4",
"status": "queued",
"videos": 2
}
NOTE
One id comes back, however many videos went in. That id is what you read, and the only thing you need to keep.

Reading progress

One id means one call to poll, not one per video. counts shows where the job has got to; when queued and processing reach zero the job has settled and each video’s rows arrives with it.

GET /v1/{job_id}
{
"status": "processing",
"counts": {
"queued": 4,
"processing": 2,
"done": 93,
"failed": 1
},
"videos": [
{
"video_id": "dQ8x2Kp",
"status": "done",
"rows": null
},
"…"
]
}

The 200 limit

A single call carries at most 200 videos. Over that it is refused outright with batch_too_large and the message 200 video limit per batch exceeded — nothing is queued and nothing is charged, so splitting the list and resubmitting is safe. Split on your side into calls of 200 and run them alongside each other.

Results arrive together

A job hands over its rows once every video in it has settled, not one at a time. That is why polling costs nothing: while anything is still running, every video’s rows is null and there is nothing to consume by accident.

The consequence for a long run is that the whole list is handed over in one response, when its last video finishes. If you want rows sooner than that, send smaller calls: each one settles as soon as its own videos are done, at the same price per video.

CAREFUL
The handover happens on one read and one only. Persist in the same code path that reads it.
Was this page useful?Tell us what was missing