Get API Key

API Reference

Everything the TranscriptLayer API can do — endpoints, parameters, response shapes, errors, and rate limits.

Prefer to explore interactively? Every endpoint below is also available in our live Swagger UI with your own API key.
Open Swagger UI

Getting Started

The API is served over HTTPS from a single base URL. All responses are JSON unless you request plain text.

BASE URL
https://api.transcriptlayer.com/v1
  1. Create an account and grab your API key from the dashboard.
  2. Pass the key as a Bearer token on every request (see Authentication).
  3. Call any endpoint — your first 100 credits are free, no card required.

Authentication

Authenticate with your API key in the Authorization header using the Bearer scheme:

HEADER
Authorization: Bearer tl_live_xxxxxxxxxxxxxxxx
Requests without a valid key return 401 The response body includes a code field of invalid_api_key — check for it before retrying.

Get Transcript

GET /youtube/transcript 1 credit

Returns the transcript of a public video. Choose JSON segments (with or without timestamps) or a single plain-text block.

Query parameters

NameTypeRequiredDefaultDescription
video_urlstringRequiredFull video URL, short URL, or bare 11-char video ID.
formatstringOptionaljsonjson or text. Text returns one joined string.
include_timestampbooleanOptionaltrueWhen false, segments omit start/duration.
send_metadatabooleanOptionalfalseInclude title, channel, duration, and view count in the response.
languagestringOptionalautoISO 639-1 code (e.g. en, es). Falls back to the default track when omitted.
Tip: language detection Omit language on the first call — the response's language field tells you which track was used, and a 404 for a specific language lists the tracks that are available.

Example request

curl "https://api.transcriptlayer.com/v1/youtube/transcript?video_url=dQw4w9WgXcQ&send_metadata=true" \
  -H "Authorization: Bearer $TL_API_KEY"
import requests

r = requests.get(
    "https://api.transcriptlayer.com/v1/youtube/transcript",
    params={"video_url": "dQw4w9WgXcQ", "send_metadata": True},
    headers={"Authorization": f"Bearer {API_KEY}"},
)
r.raise_for_status()
data = r.json()
const res = await fetch(
  "https://api.transcriptlayer.com/v1/youtube/transcript?" +
    new URLSearchParams({ video_url: "dQw4w9WgXcQ", send_metadata: "true" }),
  { headers: { Authorization: `Bearer ${process.env.TL_API_KEY}` } }
);
if (!res.ok) throw new Error(`HTTP ${res.status}`);
const data = await res.json();

Example response

{
  "video_id": "dQw4w9WgXcQ",
  "language": "en",
  "metadata": {
    "title": "How We Built Our Home Studio",
    "channel": "Creator Channel",
    "duration_seconds": 213
  },
  "transcript": [
    { "text": "Welcome back to the channel", "start": 0.0, "duration": 3.4 },
    { "text": "today we're covering something special", "start": 3.4, "duration": 3.1 }
  ]
}
{
  "video_id": "dQw4w9WgXcQ",
  "language": "en",
  "transcript": [
    { "text": "Welcome back to the channel" },
    { "text": "today we're covering something special" }
  ]
}
{
  "video_id": "dQw4w9WgXcQ",
  "language": "en",
  "transcript": "Welcome back to the channel today we're covering something special ..."
}

Video Info

GET /youtube/info Free

Returns metadata for a video without fetching its transcript. Costs no credits — useful for validating URLs before spending a credit on the transcript.

Query parameters

NameTypeRequiredDefaultDescription
video_urlstringRequiredFull video URL, short URL, or bare video ID.

Example response

200 OK
{
  "video_id": "dQw4w9WgXcQ",
  "title": "How We Built Our Home Studio",
  "channel": "Creator Channel",
  "duration_seconds": 213,
  "view_count": 1600000000,
  "has_transcript": true,
  "available_languages": ["en", "es", "pt"]
}

Search YouTube

GET /youtube/search 1 credit

Searches all of YouTube for videos, channels, or playlists. Paginate with the returned continuation token.

Query parameters

NameTypeRequiredDefaultDescription
qstringRequired*Search query. *Not required when passing continuation.
typestringOptionalvideovideo, channel, or playlist.
continuationstringOptionalToken from a previous response to fetch the next page.

Example response

200 OK
{
  "results": [
    {
      "video_id": "5C_HPTJg5ek",
      "title": "Rust in 100 Seconds",
      "channel": "Fireship",
      "duration_seconds": 156,
      "view_count": 2400000,
      "thumbnail": "https://i.ytimg.com/vi/5C_HPTJg5ek/hqdefault.jpg"
    }
  ],
  "continuation": "EpcDEg1ydXN0IGxhbmd1YWdl..."
}
Pagination flow 1. Call with q → 2. read continuation from the response → 3. call again passing only continuation → repeat until it returns null.

Resolve Channel

GET /youtube/channel/resolve Free

Turns any channel reference — @handle, custom URL, or full URL — into a canonical channel ID. Free, so resolve once and cache the ID.

Query parameters

NameTypeRequiredDefaultDescription
inputstringRequiredHandle (@fireship), channel URL, or channel ID.

Example response

200 OK
{
  "channel_id": "UCsBjURrPoezykLs9EqgamOA",
  "handle": "@fireship",
  "title": "Fireship",
  "subscriber_count": 3100000
}
GET /youtube/channel/search 1 credit

Searches for videos within a single channel. Same result shape as Search YouTube.

Query parameters

NameTypeRequiredDefaultDescription
channelstringRequiredHandle, channel URL, or channel ID.
qstringRequired*Search query. *Not required when passing continuation.
continuationstringOptionalToken for the next page of results.

Channel Videos

GET /youtube/channel/videos 1 credit / page

Lists a channel's uploads, newest first, ~30 per page. Each page consumes one credit.

Query parameters

NameTypeRequiredDefaultDescription
channelstringRequired*Handle, channel URL, or channel ID. *Not required when passing continuation.
continuationstringOptionalToken for the next page of uploads.

Example response

200 OK
{
  "channel_id": "UCHnyfMqiRRG1u-2MsSQLbXA",
  "videos": [
    {
      "video_id": "aX3jf9Qw1kE",
      "title": "The Universe Is Weirder Than You Think",
      "published": "3 days ago",
      "duration_seconds": 1264,
      "view_count": 1900000
    }
  ],
  "continuation": "4qmFsgKFARIYVUNIbnlmTXFpUlJH..."
}

Latest Uploads

GET /youtube/channel/latest Free

Returns a channel's most recent uploads at zero credit cost. Designed for polling — diff the IDs against your store to detect new videos, then spend credits only on transcripts you actually need.

Query parameters

NameTypeRequiredDefaultDescription
channelstringRequiredHandle, channel URL, or channel ID.

Playlist Videos

GET /youtube/playlist/videos 1 credit / page

Expands a playlist into its ordered list of videos, ~100 per page.

Query parameters

NameTypeRequiredDefaultDescription
playliststringRequired*Playlist URL or ID. *Not required when passing continuation.
continuationstringOptionalToken for the next page.

Example response

200 OK
{
  "playlist_id": "PLBmcuObd5An594-lZO6BvNU7cvz9CkQvI",
  "title": "Intro to Machine Learning",
  "videos": [
    { "position": 1, "video_id": "kfF04B6pDKY", "title": "Lesson 1: Getting Started" }
  ],
  "continuation": null
}

Error Handling

Errors use conventional HTTP status codes with a consistent JSON body:

ERROR SHAPE
{
  "detail": "Transcript not available in requested language 'fr'",
  "code": "language_unavailable",
  "available_languages": ["en", "es"]
}
StatusMeaningRetry?What to do
400Bad requestNoFix the parameter named in detail.
401Invalid or missing API keyNoCheck the Authorization header and key validity.
402Out of creditsNoTop up — the response includes a billing_url to your dashboard.
404Video/channel/transcript not foundNoFor language misses, pick from available_languages in the body.
429Rate limit exceededYesBack off per Retry-After, then retry.
500Server errorYesRetry with exponential backoff; contact us if persistent.
503Upstream temporarily unavailableYesRetry after a short delay — usually transient.
Failed requests are never billed Credits are only deducted on 2xx responses. A 404 or 503 costs nothing.

Rate Limits

Default limit is 10 requests/second per API key (burst up to 20). Every response includes your current state:

HeaderDescription
X-RateLimit-LimitRequests allowed per window.
X-RateLimit-RemainingRequests left in the current window.
X-RateLimit-ResetUnix time when the window resets.
Retry-AfterSeconds to wait (only on 429 responses).

Best practices

MCP Server

The official MCP server exposes every endpoint above as tools your AI client can call natively.

claude mcp add transcriptlayer \
  -e TL_API_KEY=tl_live_xxx \
  -- npx @transcriptlayer/mcp
{
  "mcpServers": {
    "transcriptlayer": {
      "command": "npx",
      "args": ["@transcriptlayer/mcp"],
      "env": { "TL_API_KEY": "tl_live_xxx" }
    }
  }
}

Tool calls made through MCP consume credits at the same rates as direct API calls.