YTAPI.devDocs

Submit batch job

submitBatch(params, options?): BatchSubmitResponse

POST
https://api.ytapi.dev/v1/batch

Submit a batch of up to 100 video tasks (transcripts or basic metadata) for asynchronous execution. Tasks are queued and executed concurrently across a background worker pool (default 10, maximum 20 concurrent workers). The call returns immediately with 202 Accepted containing a unique id. Poll GET /v1/batch/{id} to retrieve task results once processing finishes.

API Key

All requests require a valid API key from the developer dashboard.

Headers: Authorization: Bearer YOUR_API_KEYorX-API-Key: YOUR_API_KEY

See Authentication for headers and rate limits.

Headers

ParameterTypeRequiredDescription
Idempotency-Keyheader
stringNo

Makes the submit safe to retry. Send any unique string of 1 to 255 printable ASCII characters, such as a UUID. Reuse it when you retry the same request after a timeout or network error. For 24 hours, the same key with the same body returns the original job (202 with header Idempotent-Replayed: true) instead of starting and billing a second one. The same key with a different body returns 409 idempotency_conflict. Keys are per account.

Request Body

ParameterTypeRequiredDescription
tasksbody
BatchTask[]Yes

Array of up to 100 task objects to execute in the batch job.

↳id
stringNo

Caller-defined task identifier echoed in the result.

↳type
stringYes

Task type: transcript or basic_info.

↳video_id
stringYes

11-character YouTube video ID.

↳format
stringNo

Transcript format when type is transcript (segments, word_timestamps, markdown, etc.). Default segments.

concurrencybody
numberNo

Number of concurrent workers executing tasks in the batch (default 10, maximum 20).

Response (HTTP 202)

{
  "id": string,                  // Unique batch job identifier (e.g. "batch_1789995131572858354_84b12de0")
  "status": string,              // Initial job status ("pending")
  "total": number,               // Total number of submitted tasks
  "estimated_credits": number,   // Maximum estimated credits reserved for this batch (1 credit / task)
  "created_at": string           // ISO 8601 creation timestamp
}
Response headerWhen
Idempotent-Replayed: trueThe request repeated an Idempotency-Key from the last 24 hours with the same body. The response describes the job created by the first request; no new job was started and no credits were reserved.

Fair credit accounting & upfront reservation

Your account balance is checked against estimated_credits upon submission (1 credit reserved per task). In batch execution, every successfully completed task consumes 1 credit (both for transcript and basic_info). Please note: while individual single GET /v1/videos/{id}/basic-info calls are free, batch processing of basic_info is billed at 1 credit per successful task due to high-concurrency server cluster capacity. Unused reserved credits are released immediately when the job finishes. Failed tasks cost 0 credits.