Skip to content
Developer reference

TranscriptLab API

Fetch YouTube captions, transcribe Instagram Reels, TikTok, podcasts, and audio, search across platforms, monitor channels, and export Markdown or RAG chunks through one REST API.

Base URL: https://api-staging.transcriptlab.dev

01 · Quick start

Make your first request

Create an API key from your account dashboard, keep it in a server-side environment variable, and send it as a Bearer token. X-API-Key is also accepted.

curl -i -X POST \
  -H "Authorization: Bearer $YTGW_KEY" \
  -H "Content-Type: application/json" \
  -d '{"video_id":"dQw4w9WgXcQ","format":"json","lang":"en","markdown":true,"chunks":true}' \
  "https://api-staging.transcriptlab.dev/v1/transcripts"
Show a Node.js example
const response = await fetch('https://api.transcriptlab.dev/v1/transcripts', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.YTGW_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({ video_id: 'dQw4w9WgXcQ', format: 'json', markdown: true, chunks: true }),
});

let result;
if (response.status === 202) {
  // Request the Location URL again until it answers 200; there is no job to poll.
  const location = new URL(response.headers.get('Location'), 'https://api.transcriptlab.dev');
  let poll;
  do {
    await new Promise((resolve) => setTimeout(resolve, 2_000));
    poll = await fetch(location, {
      headers: { Authorization: 'Bearer ' + process.env.YTGW_KEY },
    });
    if (!poll.ok) throw new Error('Transcript read failed: ' + poll.status);
  } while (poll.status === 202);
  result = await poll.json();
} else {
  result = await response.json();
}
console.log(result.transcript.text);
console.log(result.chunks?.length, 'RAG chunks');
Never embed an API key in browser JavaScript or a public mobile app. Keep it on a server you control.

02 · JavaScript SDK

npm install transcriptlab

The official transcriptlab package on npm wraps every route on this page: transcripts, caption discovery, batch and channel jobs, media transcription, cached queries, and webhook verification. It handles the 202 polling contract, retries with Retry-After, typed errors, and pagination. Zero dependencies, TypeScript types included, works on Node 22+, Bun, and Deno.

npm install transcriptlab

// ---

import { TranscriptLab } from 'transcriptlab';

const lab = new TranscriptLab('ytgw_your_key'); // or set TRANSCRIPTLAB_API_KEY

// Requests the transcript and polls until it is ready (no 202 handling needed).
const doc = await lab.getTranscript({ url: 'https://youtu.be/dQw4w9WgXcQ' });
console.log(doc.text);

// Text/SRT/VTT render as strings.
const srt = await lab.getTranscript({ videoId: 'dQw4w9WgXcQ', format: 'srt' });

// Batch jobs: submit, wait, read every item.
const { job, items } = await lab.batch({
  urls: ['https://youtu.be/abc12345678', 'https://youtu.be/def23456789'],
});

// Webhooks: verify the signature on the raw body before parsing.
const event = await lab.verifyWebhook({
  rawBody, signature: req.headers['x-ytgw-signature'], secret,
});

Full API reference and examples in the transcriptlab-js repository. Other languages: use the REST endpoints below, as every SDK feature maps to one or two calls.

03 · Authentication

API keys and credentials

Send either Authorization: Bearer ytgw_… or X-API-Key: ytgw_…. If both headers are present, they must contain the same key. Deployments with Clerk configured also accept a valid dashboard session token; API keys are the recommended credential for integrations. Create and manage keys in your account dashboard; the full key is shown only once.

04 · Request flow

Handle both 200 and 202

A YouTube request waits up to deadline_ms. If the transcript is ready, the response is 200. If work continues, the 202 response has a Location header and a body of { video_id, state: "processing" }. Request that URL again every couple of seconds until it answers 200; a 404 means nothing of yours is running, and a 422 means the run failed. There is no job id for a single video.

# A 202 response carries a Location header: the same URL a finished transcript is read from.
# Request it again every couple of seconds. 202 means keep waiting; 200 is the transcript.
curl -sS -i -H "Authorization: Bearer $YTGW_KEY" \
  "https://api-staging.transcriptlab.dev/v1/transcripts/dQw4w9WgXcQ?format=json&lang=en"

Single transcript

A 202 is not a delivered transcript and is not charged as one. The result is billed when delivered.

Batch and channel jobs

These return 202. Poll the job, then use its items_url to inspect each video. These are the only transcripts that have a job.

05 · Transcript requests

Formats, Markdown, RAG chunks, and options

OptionType / defaultDescription
langstring
Default: auto
Preferred YouTube caption language (ISO 639-1) or spoken-language hint for STT.
translatestring
Default: -
Translate a YouTube caption track to another ISO 639-1 language. Not supported with engine=stt.
typeany | manual | generated
Default: any
Choose which YouTube caption track to use.
formatjson | text | srt | vtt | markdown
Default: json
Choose JSON, plain text, SubRip, WebVTT, or timestamped Markdown output.
metadataboolean
Default: true
Include source metadata in JSON.
alsoarray
Default: -
Embed additional text, SRT, VTT, or markdown renderings in a JSON response (formats.*).
markdownboolean
Default: false
Embed timestamped Markdown in a JSON response (formats.markdown). Costs 0 credits.
chunksboolean | object
Default: -
Include RAG-ready o200k_base token chunks ({max_tokens: 100..2000, overlap_tokens: 0..200}). Costs 0 credits.
deadline_msinteger
Default: 20,000
How long the request waits for a transcript. Default: 20 seconds. Set 1,000-60,000 ms (1-60 seconds); if it is still processing, the API returns 202.
enginecaptions | stt | auto
Default: captions
captions reads existing subtitles and returns an explicit error if missing; auto is an opt-in captions-first mode that falls back to AI audio when captions are absent; stt always runs speech-to-text.
diarizeboolean
Default: false
Add speaker labels (Speaker 1, Speaker 2, ...) to the transcript. Requires engine=stt or engine=auto and forces tier=premium (10 credits/min).
tiernormal | premium | auto
Default: auto
Speech model tier: normal bills 1 credit per audio minute; premium bills 10 credits per audio minute and can label speakers.

YouTube transcript POST bodies accept these fields in JSON. The transcript GET endpoint accepts them as query parameters (including markdown=1, chunks=1, max_tokens, and overlap_tokens). For JSON, timestamps are in seconds under transcript.timestamped, Markdown is embedded at formats.markdown, and RAG chunks appear under chunks with o200k_base token counts.

With engine=captions (default), language.is_generated distinguishes auto-generated from manual YouTube captions. Opting into engine=auto tries captions first and falls back to AI audio only if captions are unavailable. Speech transcripts include metadata.engine="stt" and a detected language.

06 · Endpoint reference

Available API routes

Explore parameters, response schemas, and examples in the interactive Swagger reference. The machine-readable OpenAPI 3.1 document is available too.

YouTube transcripts

Fetch caption tracks, discover languages, search cached transcript text, and browse your transcript library.

POST/v1/transcriptsRequest a transcript. Returns 200 with the transcript or 202 with job and retry URLs.
GET/v1/transcripts/{videoId}Read a published transcript from cache; free once the variant is owned. This route does not start a fetch.
GET/v1/transcripts/{videoId}/discoverList available caption tracks. Discovery is free and plan-quota limited.
POST/v1/transcripts/batchQueue a batch of YouTube video URLs. Accepts an Idempotency-Key header, so a retry never creates a second job.
GET/v1/transcriptsBrowse your delivered transcript library. Pages are consistent: pass next_cursor back as cursor.

Channels and jobs

Queue channel listings and transcription, then poll job state or read item-level results.

POST/v1/channels/transcribeList channel videos or transcribe up to 250 videos per job. Accepts an Idempotency-Key header.
GET/v1/jobsList jobs for the authenticated account. Filter with state=waiting|preparing|processing|done|failed.
GET/v1/jobs/{jobId}Read job status, progress, result URL, and counters.
GET/v1/jobs/{jobId}/itemsRead per-video job results.
DELETE/v1/jobs/{jobId}Cancel a non-terminal job.

Media URLs (IG Reels, TikTok, Podcasts)

Transcribe Instagram Reels/Posts, TikTok videos (built-in WebVTT captions first at 1 credit), Apple Podcasts, Spotify, RSS feeds, and direct HTTPS media files.

POST/v1/mediaTranscribe an Instagram Reel, TikTok, podcast link, or public media-file URL.
GET/v1/media/{mediaId}/transcriptRead a completed media transcript in json, text, srt, vtt, or markdown, with optional RAG chunks.

Multi-platform search

Search videos, channels, and playlists across YouTube, TikTok, and Instagram at 0 credits, with optional inline transcript expansion.

POST/v1/searchSearch YouTube (with upload_date, duration, sort, captions filters), TikTok, or Instagram. 0 credits; optional transcripts=true bills normal credits.
POST/v1/search/channelList videos, shorts, or streams from a YouTube channel or TikTok/Instagram profile. 0 credits; supports since_video_id and optional transcripts=true.

Channel monitors (Starter / Pro)

Watch channels and profiles on a schedule, receive signed HMAC-SHA256 webhooks, and optionally auto-transcribe new uploads.

POST/v1/monitorsCreate a monitor for a YouTube channel or TikTok/Instagram profile (returns webhook_secret once if webhook_url is set).
GET/v1/monitorsList configured monitors on your account.
GET/v1/monitors/{id}Read a monitor by ID.
PATCH/v1/monitors/{id}Update interval_minutes, status (active|paused), transcripts, mode, markdown, chunks, or webhook_url.
DELETE/v1/monitors/{id}Delete a monitor and its event history.
GET/v1/monitors/{id}/eventsRead discovered video events incrementally with ?since= and ?limit=.
POST/v1/monitors/{id}/checkRun an immediate check on a monitor (0 credits unless transcripts=true delivers new transcripts).

07 · Async jobs

Poll, inspect, or cancel work

Job state is the polling field: waiting, preparing, and processing are in progress; done and failed are terminal. The finer-grained status field is also returned. Completed single-result jobs have a result_url; batch and channel jobs expose item results at items_url. DELETE a non-terminal job to cancel it. Each account may have up to 25 open jobs; wait for a job to finish if the API returns a concurrency 429.

08 · Media URLs

Instagram Reels, TikTok, podcasts, and direct files

POST a public HTTPS URL to /v1/media. Supported inputs include Instagram Reels/Posts (/reel/, /reels/, /p/, /tv/), TikTok videos (extracts built-in WebVTT captions first at 1 credit with zero STT, falling back to audio STT when absent), Apple Podcasts, Spotify, RSS feeds, and direct audio/video files up to 12 hours and 2 GB. YouTube links use /v1/transcripts.

curl -X POST "https://api-staging.transcriptlab.dev/v1/media" \
  -H "Authorization: Bearer $YTGW_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://www.instagram.com/reel/EXAMPLE123/","format":"json","markdown":true,"chunks":true}'

Audio transcription supports optional diarization and speaker renaming. TikTok built-in captions cost 1 credit once; audio transcription costs 1 credit per started minute (10 credits per minute for premium tier / diarization).

10 · Channel monitors

Watch channels and receive webhooks

Starter and Pro accounts can create up to 25 monitors on /v1/monitors (Free accounts receive 403 plan_required). Choose a polling interval of 15, 60, 360, or 1440 minutes, optionally enable transcripts: true (mode: "auto" | "captions" | "audio", markdown, chunks), and attach an HTTPS webhook_url. Poll GET /v1/monitors/{id}/events?since= incrementally or run POST /v1/monitors/{id}/check anytime. Monitor checks cost 0 credits.

curl -X POST "https://api-staging.transcriptlab.dev/v1/monitors" \
  -H "Authorization: Bearer $YTGW_KEY" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://www.youtube.com/@anthropic-ai","interval_minutes":60,"transcripts":true,"mode":"auto","markdown":true,"chunks":true,"webhook_url":"https://app.example.com/webhooks/transcriptlab"}'

11 · Webhooks

Verify job and monitor webhook events

Batch, channel, and media transcription jobs sign X-YTGW-Signature (t=timestamp,v1=signature). Channel monitors send X-TranscriptLab-Event: monitor.new_videos with X-TranscriptLab-Signature: sha256=<hex> over the raw JSON body using the webhook_secret returned when the monitor was created. A video whose transcript is still being produced arrives with transcript_status: "pending"; one monitor.transcript_ready or monitor.transcript_failed event follows when it settles, and the stored event is updated in place.

// Job webhooks (X-YTGW-Signature: t=timestamp,v1=signature)
const [timestampPart, signaturePart] = request.headers
  .get('X-YTGW-Signature')!.split(',');
const timestamp = timestampPart.slice(2);
const received = signaturePart.slice('v1='.length);
const signedPayload = timestamp + '.' + rawBody;
const expected = createHmac('sha256', webhookSecret)
  .update(signedPayload, 'utf8')
  .digest('hex');

// Monitor webhooks (X-TranscriptLab-Event: monitor.new_videos)
// Header: X-TranscriptLab-Signature: sha256=<hmac-sha256-hex> over rawBody

12 · Errors and pagination

Handle errors and page through lists

Errors use the same JSON shape and include a request ID. Common HTTP statuses include 400 invalid request, 401 unauthorized, 402 insufficient credits, 403 plan required, 404 not found, 409 conflict, 413 payload too large, 422 transcript unavailable, and 429 rate limited.

{
  "error": {
    "code": "invalid_request",
    "message": "url or video_id is required",
    "request_id": "req_01JQ8S7X"
  }
}

Responses include X-Request-Id. Transcript reads also report X-Cache, X-Credits-Charged, and usually X-Credits-Remaining. A 429 includes Retry-After.

List endpoints return has_more and an opaque next_cursor; pass it back as cursor to get the next page.

13 · Credits

Usage and billing

Each caption transcript variant (YouTube or TikTok built-in WebVTT captions) costs 1 credit once: the first delivered transcript is charged and every later delivery of it is free. Audio transcription costs 1 credit per started minute on the normal tier; tier=premium (and diarize) costs 10. Markdown formatting, o200k_base RAG chunks, search requests, and monitor checks cost 0 credits.

14 · Agent payments

Pay per transcript with x402

Transcript reads also accept x402, an open HTTP payment protocol with no API key, account, or sign-up required. This rail is meant for AI agents and machine clients that hold a crypto wallet. Credentialed requests are unchanged; if Authorization or X-API-Key is present, the request uses credits as usual.

Two routes participate: POST /v1/transcripts and GET /v1/transcripts/{videoId}. An unpaid request returns 402 with a base64 PAYMENT-REQUIRED challenge describing the price: $0.01 in USDC on Base (eip155:8453), scheme exact. The client signs an EIP-3009 transferWithAuthorization and retries with the PAYMENT-SIGNATURE header. A delivered transcript comes back with a PAYMENT-RESPONSE settlement receipt.

Payment settles only when a transcript is delivered. Errors, invalid requests, and still-processing 202 responses do not settle; retry the poll URL with a signature until the read returns 200.

Any x402-aware client handles the flow automatically; see the PayAI Bazaar docs and the x402 protocol docs for supported SDKs.