Transcript

The transcript of any public video with captions, as plain text, timestamped segments, SRT or WebVTT.

GET/v1/youtube/transcript

Costs 1 credit per request. Only requests that return data are charged.

Parameters

NameTypeDescription
videorequired string Video URL or 11-character video id. Watch, youtu.be, Shorts, embed and live links all work.
langoptional string Preferred caption language code, such as en, es or pt-BR. Without it you get the video's original language.
formatoptional string What the text field holds: plain text, text with [0:12] timestamps, or a ready SRT or WebVTT file. One of: text, timestamped, srt, vtt. Default: text.
segmentsoptional boolean Include the list of timed segments (start, duration, text). Default: true.

Example request

curl "https://pipefetch.com/v1/youtube/transcript?video=jNQXAC9IVRw" \
  -H "x-api-key: YOUR_API_KEY"

Example response

A real answer to the request above. Long texts and lists are shortened here.

200 OK · application/json
{
  "data": {
    "videoId": "jNQXAC9IVRw",
    "url": "https://www.youtube.com/watch?v=jNQXAC9IVRw",
    "title": "Me at the zoo",
    "channel": {
      "id": "UC4QobU6STFB0P71PMvOGN5A",
      "name": "jawed",
      "handle": "@jawed",
      "url": "https://www.youtube.com/@jawed"
    },
    "publishedAt": "2005-04-23",
    "durationSeconds": 19,
    "language": "en",
    "languageName": "English",
    "isAutoGenerated": false,
    "isPreferredLanguage": true,
    "availableLanguages": [
      {
        "code": "en",
        "name": "English",
        "isAutoGenerated": false
      },
      {
        "code": "de",
        "name": "German",
        "isAutoGenerated": false
      }
    ],
    "format": "text",
    "text": "All right, so here we are, in front of the elephants the cool thing about these guys is that they have really... really really long trunks and that's …",
    "wordCount": 39,
    "segments": [
      {
        "start": 1.2,
        "duration": 2.16,
        "text": "All right, so here we are, in front of the elephants"
      },
      {
        "start": 5.318,
        "duration": 2.656,
        "text": "the cool thing about these guys is that they have really..."
      }
    ],
    "chapters": [
      {
        "title": "Intro",
        "startSeconds": 0,
        "endSeconds": 5
      },
      {
        "title": "The cool thing",
        "startSeconds": 5,
        "endSeconds": 17
      }
    ]
  },
  "credits": {
    "used": 1,
    "remaining": 99
  }
}

Good to know

  • Uploaded captions are preferred over auto-generated ones. isAutoGenerated tells you which one you got.
  • If the language you asked for does not exist, another one is returned and isPreferredLanguage is false.
  • A video without captions answers 404 no_transcript and costs nothing.

Errors

Every error has the same shape, and none of them is charged. The full list is in the error reference.

Looking for an overview and use cases? See the YouTube Transcript API page.