Get API Key

API Reference

Everything the TubeCaption API can do — endpoints, parameters, response shapes, and errors.

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.tubecaption.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 tc_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.tubecaption.com/v1/youtube/transcript?video_url=dQw4w9WgXcQ&send_metadata=true" \
  -H "Authorization: Bearer $TC_API_KEY"
import requests

r = requests.get(
    "https://api.tubecaption.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.tubecaption.com/v1/youtube/transcript?" +
    new URLSearchParams({ video_url: "dQw4w9WgXcQ", send_metadata: "true" }),
  { headers: { Authorization: `Bearer ${process.env.TC_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 YouTube for videos, channels, or playlists and returns up to 30 results per page.

Query parameters

NameTypeRequiredDefaultDescription
qstringFirst pageSearch query.
typestringOptionalvideoOne of video, channel, or playlist.
continuationstringNext pageOpaque token from the previous response. Send it by itself 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": "eyJraW5kIjoic2VhcmNoIi4uLiJ9"
}
Pagination When continuation is not null, pass it to the same endpoint without the original query parameters. Each page costs one credit.

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.
qstringRequiredSearch query.
continuationstringNext pageOpaque token from the previous response. Replaces channel and q.

Channel Videos

GET /youtube/channel/videos 1 credit

Lists channel uploads newest first, with up to 30 videos per page.

Query parameters

NameTypeRequiredDefaultDescription
channelstringRequiredHandle, channel URL, or channel ID.
continuationstringNext pageOpaque token from the previous response. Replaces channel.

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": "eyJraW5kIjoiY2hhbm5lbF92aWRlb3MiLi4ufQ"
}

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

Expands a playlist into an ordered list of up to 100 videos per page.

Query parameters

NameTypeRequiredDefaultDescription
playliststringRequiredPlaylist URL or ID.
continuationstringNext pageOpaque token from the previous response. Replaces playlist.

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": "eyJraW5kIjoicGxheWxpc3RfdmlkZW9zIi4uLn0"
}

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 creditsNoSubscribe or top up — paid subscribers can buy additional credits from the dashboard.
404Video/channel/transcript not foundNoFor language misses, pick from available_languages in the body.
429Rate limit exceededYesWait for 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

Limits are enforced per API key in fixed one-minute windows across all API instances.

PlanRequests per minute
Free60
Monthly200
Annual300

Successful responses include X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset. A 429 response also includes Retry-After.

Best practices

API Playground

Use the interactive Swagger UI to authorize with a TubeCaption key, inspect each endpoint, and execute requests without writing client code.

BROWSER
https://api.tubecaption.com/docs

The dashboard also includes a focused transcript test page that stores a test key only in your browser.