You need a clean transcript of a YouTube video you can index, summarize, subtitle, or feed into your pipeline this week. By the end of this guide you’ll call a real endpoint that returns time-coded lines of text for a given video ID, and you’ll have copy-pasteable code you can drop into your app or automation.
What you’ll build with YouTube Sub Extractor API
Zyla API Hub hosts the YouTube Sub Extractor API, which returns the text transcript of a YouTube video as a sequence of caption entries. Each entry includes the text plus timing metadata you can use to render captions, align summaries, or anchor-search results to a moment in the video.
Typical uses include:
- Auto-generating subtitles and closed captions with time alignment.
- Creating searchable indexes of long-form video content.
- Feeding transcripts to summarizers, embedding pipelines, or moderation tools.
- Building “jump-to” links in your app based on transcript offsets.
Everything runs on a single API key and subscription within Zyla API Hub, which aggregates more than 10,000 public APIs across categories. There’s one account, one API key, and a subscription + quota model—not pay-per-call—so you can iterate without juggling separate credentials per provider.
Getting started on Zyla API Hub
To try this API fast:
- Open the API listing: Start 7-day trial on YouTube Sub Extractor API.
- Click Subscribe or Start Free Trial when available. For your first API on Zyla, you typically get a 7-day trial or 50 requests; check the API page for current access options and pricing. There is no Free Plan.
- Copy your API key from the dashboard.
- Call the endpoint shown below with Authorization: Bearer YOUR_API_KEY.
Endpoint overview
The YouTube Sub Extractor API currently exposes a single, focused endpoint for fetching a transcript:
- Endpoint: Get Video Transcript
- Method: GET
- URL: https://zylalabs.com/api/5216/youtube-sub-extractor-api/6681/get-video-transcript
- Required parameter: videoId (string)
Send the videoId of the YouTube video you want to transcribe. The API responds with a JSON payload that includes a success flag and a transcript array of caption entries. Each entry contains the text and timing fields you can use in your app.
Quickstart: cURL you can paste
Below is a complete, working request. Replace YOUR_API_KEY with your key. The videoId parameter is required, and the example uses a specific ID to demonstrate the response shape.
curl -s -X GET "https://zylalabs.com/api/5216/youtube-sub-extractor-api/6681/get-video-transcript?videoId=eCBABjPcNyo" \
-H "Authorization: Bearer YOUR_API_KEY"
Official example response
This is the real example JSON returned by the API for the request above. Use it to structure your parsing logic.
{"success":true,"transcript":[{"text":"o que a gente tem no diante","duration":3.24,"offset":0,"lang":"en"},{"text":"dos nossos olhos não dá muita esperança","duration":3.24,"offset":3.24,"lang":"en"},{"text":"no futuro daqui eu vejo a polícia","duration":3.24,"offset":6.48,"lang":"en"},{"text":"atirando a dignidade de pais de família","duration":3.24,"offset":9.72,"lang":"en"},{"text":"daqui eu vejo o estado transformando pessoas","duration":3.24,"offset":12.96,"lang":"en"},{"text":"que poderiam dar bons frutos carregado em","duration":3.24,"offset":16.200000000000003,"lang":"en"},{"text":"pessoas frustradas eu não julgo entendeu monstro","duration":3.24,"offset":19.44,"lang":"en"},{"text":"não precisa ser nenhum expert title superlotado","duration":3.24,"offset":22.68,"lang":"en"},{"text":"estudado formada uma coisa pra saber que","duration":3.24,"offset":25.92,"lang":"en"},{"text":"está tudo errado para saber qual a","duration":3.24,"offset":29.160000000000004,"lang":"en"},{"text":"posição da gente isso tem que acabar","duration":3.24,"offset":32.400000000000006,"lang":"en"},{"text":"com os palestinos abete paz [Música] gino","duration":3.24,"offset":35.64,"lang":"en"},{"text":"problema queria só paz mas não viu","duration":3.24,"offset":38.88,"lang":"en"},{"text":"o veículo agora sem proteção da vida","duration":3.24,"offset":42.120000000000005,"lang":"en"},{"text":"e arrojado mas ainda era o então","duration":3.24,"offset":45.36,"lang":"en"},{"text":"ainda disparava e agora o que eu","duration":3.24,"offset":48.6,"lang":"en"},{"text":"faço me fala na maturidade na sala","duration":3.24,"offset":51.84,"lang":"en"},{"text":"tem pesadelo é época de eleição nosso","duration":3.24,"offset":55.080000000000005,"lang":"en"},{"text":"descabelo progresso sem previsão no chão torço","duration":3.24,"offset":58.32000000000001,"lang":"en"},{"text":"pro meu filho também não vira lata","duration":3.24,"offset":61.56,"lang":"en"},{"text":"é um opção tem vaca tem sempre","duration":3.24,"offset":64.80000000000001,"lang":"en"},{"text":"cid piada pode justificar nada eu entrei","duration":3.24,"offset":68.04,"lang":"en"},{"text":"político claro que foi pra vencer nelson","duration":3.24,"offset":71.28,"lang":"en"},{"text":"é um nojo esgoto exposto é alguém","duration":3.24,"offset":74.52000000000001,"lang":"en"},{"text":"é tanta injustiça em sangue nas suas","duration":3.24,"offset":77.76,"lang":"en"},{"text":"mãos por não fazer nada a troca","duration":3.24,"offset":81…
Key fields you’ll use:
- success: boolean indicating whether the request succeeded.
- transcript: array of caption items. Each item includes:
- text: the caption text for that fragment.
- duration: numeric length of the fragment.
- offset: numeric start position from the beginning of the video.
- lang: a language code associated with the fragment.
Python example: fetch and stitch a plain transcript
This snippet calls the same endpoint and joins the caption lines into a single string while preserving timing for later use. It uses the Authorization header with your API key and the same videoId as the cURL example so you can compare outputs.
import os
import requests
API_KEY = os.getenv("ZYLA_API_KEY", "YOUR_API_KEY")
VIDEO_ID = "eCBABjPcNyo"
URL = "https://zylalabs.com/api/5216/youtube-sub-extractor-api/6681/get-video-transcript"
resp = requests.get(
URL,
params={"videoId": VIDEO_ID},
headers={"Authorization": f"Bearer {API_KEY}"},
timeout=30
)
resp.raise_for_status()
data = resp.json()
if not data.get("success"):
raise RuntimeError("Transcript request did not succeed")
entries = data.get("transcript", [])
# Keep a simple text transcript and an index of time anchors
full_text = " ".join([e.get("text", "") for e in entries if isinstance(e, dict)])
time_index = [{"offset": e.get("offset"), "duration": e.get("duration"), "text": e.get("text")} for e in entries]
print("First 200 chars of transcript:")
print(full_text[:200])
print("\nFirst 3 time anchors:")
for anchor in time_index[:3]:
print(anchor)
Implementation details that save time
- Authentication: pass your key via Authorization: Bearer YOUR_API_KEY on every request.
- Caching: transcripts for a given videoId are good candidates for caching at your layer to avoid repeat calls on hot pages or batched jobs.
- Pagination: the example response returns the full transcript array in one payload. No pagination params are required for this endpoint.
- Timing math: duration and offset are numeric values. Preserve them as-is if you plan to render captions or compute jump links.
- Language: a lang code is included per fragment. Use it when routing to translation or TTS pipelines.
- Error handling: check the success flag before using transcript data.
Building real features on top of the transcript
Create SRT or WebVTT
Convert each transcript item to a caption block by formatting offset and offset+duration into timecodes. Whether you output SRT or VTT, keep the original order of entries. Since the API already splits the transcript, you just need formatting logic.
Search with time anchors
Index text fragments with their offsets. When a user searches, show matching lines with a “Jump to 01:23” link based on the offset. This reduces friction compared to searching the entire text blob.
Summarize or extract highlights
Group adjacent entries into chunks of a target size (e.g., by number of characters or total duration). Feed those chunks into your summarizer and attach links to the starting offset of each chunk.
Content safety screening
If you run safety or compliance checks, perform them on individual fragments first. This makes it easier to locate and redact problematic spans, since you already have offsets and durations.
Calling the API from an AI agent (MCP)
Every Zyla API can be invoked from AI coding tools that support the Model Context Protocol. Point your MCP-compatible client to this endpoint: MCP.
- Provide your Zyla API key via the MCP client configuration (the endpoint accepts apikey in the URL you configure for the tool host).
- From agents like Claude Code, Cursor, or Windsurf, you can wire a tool that hits the same GET URL used in this post with the videoId parameter.
- The agent receives the JSON payload and can post-process the transcript—e.g., summarizing, generating notes, or inserting time-linked references in code comments.
If you are new to Zyla’s MCP tools, start with a simple tool definition that wraps the single endpoint shown here and returns the transcript array to the agent for further reasoning.
Operational notes on Zyla usage
- Access model: subscription + quota, not pay-per-call. For your first API on Zyla you typically get a 7-day trial or 50 requests. Always check the listing for current limits and billing.
- One key, many services: your Zyla key works across subscribed APIs, which simplifies CI/CD and secrets management.
- Team workflows: store the Authorization header in your secrets manager and share it via environment variables in your repo or deployment platform.
If you don’t have an account yet, you can create one in minutes on Zyla API Hub and start calling APIs immediately after subscribing on the listing page.
Troubleshooting checklist
- 401/403 errors: confirm the Authorization header is set to Bearer YOUR_API_KEY, and the key is valid for your subscription.
- Empty transcript: double-check the videoId string and ensure the video has available subtitle data.
- Unexpected language codes: log the lang field per fragment and route through your translation stack if needed.
- Timeouts in your client: set a reasonable timeout (e.g., 30s) and retry once. Cache successful responses by videoId.
Reference: Endpoint and parameters
Get Video Transcript
- Method: GET
- URL: https://zylalabs.com/api/5216/youtube-sub-extractor-api/6681/get-video-transcript
- Required query parameter:
- videoId: the YouTube video ID string (e.g., eCBABjPcNyo)
- Authentication: Authorization: Bearer YOUR_API_KEY
FAQ
What do I need to authenticate requests?
Include Authorization: Bearer YOUR_API_KEY in the request headers. You obtain the key after subscribing on the API’s listing page.
Which parameters are required?
Only videoId is required for the Get Video Transcript endpoint.
Does the API return timing information?
Yes, each transcript item includes numeric duration and offset fields you can use for caption timing and jump links.
Is there a free plan?
There is no Free Plan. For your first API on Zyla, you typically get a 7-day trial or 50 requests. Check the API page for current access and limits.
Can I call this from an AI agent?
Yes. Use the MCP endpoint and configure your tool to hit the same GET URL with the videoId parameter. See the MCP link above for details.
Ready to ship your transcript integration? Subscribe on the listing page and get your key now: Start 7-day trial on YouTube Sub Extractor API.