> ## Documentation Index
> Fetch the complete documentation index at: https://api-tools.memories.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# YouTube Video Transcript

> Get YouTube video transcript.

<Info>
  **Product**: Visual Intelligence — Social Media Scraping
  **Use case**: Fetch video metadata, transcripts, captions, and comments from YouTube, Instagram, TikTok, and Twitter/X
  **Host**: `https://mavi-backend.memories.ai/serve/api/v2`
  **Auth**: `Authorization: sk-mavi-...` (no `Bearer` prefix)
</Info>

This endpoint allows you to retrieve transcript for a YouTube video.

<Note>
  Channel routing guide: see [Social Media Scraping Overview](/visual-intelligence/social-media-scraping-overview). Endpoints with a `channel` request field let you choose `apify`, `rapid`, or `memories.ai`; endpoints without this field use managed routing.
</Note>

<Note>
  **Pricing:**

  * **rapid** channel: \$0.02 per video
  * **memories.ai** channel: \$0.01 per video
  * **apify** channel: Charged at Apify's actual cost (higher and variable pricing)
</Note>

### Code Example

<CodeGroup>
  ```python Python theme={null}
  import requests

  BASE_URL = "https://mavi-backend.memories.ai/serve/api/v2"
  API_KEY = "sk-mavi-..."
  HEADERS = {
      "Authorization": f"{API_KEY}"
  }

  def youtube_video_transcript(video_url: str, channel: str):
      url = f"{BASE_URL}/youtube/video/transcript"
      data = {"video_url": video_url, "channel": channel}
      resp = requests.post(url, headers=HEADERS, json=data)
      return resp.json()

  # Usage example
  result = youtube_video_transcript("https://www.youtube.com/watch?v=Y2y4OpzKIK4", "apify")
  print(result)
  ```
</CodeGroup>

### Request Body

| Field      | Type   | Required | Description                                                         |
| ---------- | ------ | -------- | ------------------------------------------------------------------- |
| video\_url | string | Yes      | The YouTube video URL                                               |
| channel    | string | Yes      | The channel name. Supported values: `apify`, `rapid`, `memories.ai` |

### Response

<Warning>
  **Response shape depends on the `channel` parameter** — same pattern as `/youtube/video/metadata`. Verified live:

  * `channel: "apify"` — `data` is an **array** containing one object whose `data` field is the array of `{start, dur, text}` segments (the shape documented below).
  * `channel: "memories.ai"` — `data` is an **object** with `lang`, `availableLangs`, and `content` keys (a different transcript representation).
  * `channel: "rapid"` — same shape as `memories.ai` (`{lang, availableLangs, content}`).

  If you need the timestamped segment format below, pass `channel: "apify"` explicitly.
</Warning>

<ResponseExample>
  ```json theme={null}
  {
    "code": 200,
    "msg": "success",
    "data": [
      {
        "data": [
          {
            "start": "1.480",
            "dur": "4.839",
            "text": "they've intercepted a croc from the"
          },
          {
            "start": "3.360",
            "dur": "5.720",
            "text": "jungle up for sale this is a a young"
          },
          {
            "start": "6.319",
            "dur": "5.081",
            "text": "female that was taken from a wildlife"
          },
          {
            "start": "9.080",
            "dur": "4.439",
            "text": "Trader okay obviously uh trying to make"
          },
          {
            "start": "11.400",
            "dur": "4.680",
            "text": "a dollar so what we want to do is catch"
          }
        ]
      }
    ],
    "failed": false,
    "success": true
  }
  ```
</ResponseExample>

### Response Parameters

| Parameter             | Type           | Description                                      |
| --------------------- | -------------- | ------------------------------------------------ |
| code                  | string         | Response code indicating the result status       |
| msg                   | string         | Response message describing the operation result |
| data                  | array\[object] | Array containing transcript data objects         |
| data\[].data          | array\[object] | Array of transcript segments                     |
| data\[].data\[].start | string         | Start time of the transcript segment in seconds  |
| data\[].data\[].dur   | string         | Duration of the transcript segment in seconds    |
| data\[].data\[].text  | string         | The transcript text for this segment             |
| success               | boolean        | Indicates whether the operation was successful   |
| failed                | boolean        | Indicates whether the operation failed           |


## OpenAPI

````yaml POST /youtube/video/transcript
openapi: 3.1.0
info:
  title: Video Metadata & Transcript API Reference
  description: >-
    REST APIs for retrieving video metadata and transcripts from YouTube,
    Instagram, TikTok, and Twitter
  version: v1.0.1
servers:
  - url: https://mavi-backend.memories.ai/serve/api/v2
security:
  - ApiKeyAuth: []
paths:
  /youtube/video/transcript:
    post:
      summary: YouTube Video Transcript
      description: Get YouTube video transcript.
      operationId: youtube_video_transcript
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                video_url:
                  type: string
                  description: The YouTube video URL
                  example: https://www.youtube.com/watch?v=Y2y4OpzKIK4
                channel:
                  type: string
                  description: >-
                    The channel name. Supported values: apify, rapid,
                    memories.ai
                  enum:
                    - apify
                    - rapid
                    - memories.ai
                  example: apify
              required:
                - video_url
                - channel
      responses:
        '200':
          description: Video transcript
          content:
            application/json:
              schema:
                type: object
                properties:
                  code:
                    type: string
                    example: 200
                    description: Response code indicating the result status
                  msg:
                    type: string
                    example: success
                    description: Response message describing the operation result
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        data:
                          type: array
                          items:
                            type: object
                            properties:
                              start:
                                type: string
                                example: '1.480'
                                description: >-
                                  Start time of the transcript segment in
                                  seconds
                              dur:
                                type: string
                                example: '4.839'
                                description: Duration of the transcript segment in seconds
                              text:
                                type: string
                                example: they've intercepted a croc from the
                                description: The transcript text for this segment
                          description: Array of transcript segments
                    description: Array containing transcript data objects
                  success:
                    type: boolean
                    example: true
                    description: Indicates whether the operation was successful
                  failed:
                    type: boolean
                    example: false
                    description: Indicates whether the operation failed
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization

````