YouTube transcript API
Extract the caption track from any public YouTube video with one POST. The response returns the full transcript text with per-segment timestamps.
- One POST, One Transcript
- Manual And Auto Captions
- Per-Segment Timestamps
- Every Public Link Shape
- Idempotency Key Support
- Server-Side Key Required
Request examples
curl "https://api.agentbody.io/v1/youtube/transcript?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DdQw4w9WgXcQ&language=en" \
-H "Authorization: Bearer <YOUR_AGENTBODY_API_KEY>"Response examples
Documented responses from the OpenAPI specification.
Existing captions or explicitly requested audio transcription.
{
"caption_type": "manual",
"language": "example_value",
"segments": [],
"text": "example_value",
"video_id": "example_value"
}Features
The youtube.transcript operation extracts an existing caption track from one public YouTube video. Your server holds the API key; the endpoint returns the full transcript in a single call.
One POST, One Transcript
Send POST /v1/youtube/transcript with a public video URL. A successful 200 returns video_id, caption_type, language, segments with start/duration/text, and the joined full text — everything a transcript pipeline needs.
Manual And Auto Captions
The API returns both manually written caption tracks and auto-generated ones. Request a specific language when multiple tracks exist; the response reports which caption_type was used.
Per-Segment Timestamps
Every segment carries start time and duration in seconds alongside its text, so downstream code can cite moments, build subtitles, or align the transcript with playback precisely.
Every Public Link Shape
Watch pages, youtu.be short links, Shorts, and embed URLs all resolve. Private, deleted, and age-restricted videos return an error instead of a transcript.
Idempotency Key Support
Pass an Idempotency-Key header to retry failed requests safely. The gateway deduplicates by key, so a network retry never triggers a second extraction or charge.
Server-Side Key Required
The endpoint requires an AgentBody API key held on your server. Never ship the key to a client bundle; route calls through your backend.
How to use
Integrate YouTube transcript extraction in three API steps.
Get Your API Key
Create a free AgentBody account and generate an API key from the dashboard. The key authenticates every request.
POST The Video URL
Send POST /v1/youtube/transcript with the public video URL and an optional language preference. Include an Idempotency-Key header for safe retries.
Receive The Transcript
A 200 returns the caption_type, language, per-segment timestamps, and the full text. Store it, index it, or stream it to your summarizer.
Frequently asked questions
How does the YouTube transcript API work?
Send POST /v1/youtube/transcript with a public video URL. The API fetches the video's caption track — manual or auto-generated — and returns the full text with per-segment timestamps in one response.
Which videos are supported?
Any public video with a caption track. Private, deleted, age-restricted videos and videos with captions disabled by the uploader return an error and are not billed.
What is in the response?
video_id, caption_type (manual or auto), language, a segments array where each segment has start (seconds), duration (seconds), and text, plus the joined full transcript text.
Can I request a specific language?
Yes. When a video has caption tracks in multiple languages, pass the language you want; the API extracts that track and reports which one was used in the response.
How am I billed?
Each successful extraction draws a fixed amount from your AgentBody balance at the gateway-governed price. Failed requests are not billed, and the Idempotency-Key header prevents duplicate charges on retries.
Is there a rate limit?
There is no separate rate limit beyond your account balance. Each request is one extraction at the published fixed price.