{
  "openapi": "3.0.1",
  "info": {
    "title": "YouTube Transcript Scraper — Subtitles, Chapters & RAG (MCP)",
    "description": "Fast, browser-free YouTube transcript and subtitles scraper API. Extract clean paragraphs, timestamps, chapters, rich metadata, and RAG chunks from videos, Shorts, playlists, channels, or search queries. MCP & AI-agent ready — $0 charged on failed videos.",
    "version": "0.1",
    "x-build-id": "WOptAWPK83HJiyEh7"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/datapipestudio~youtube-transcript-rag/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-datapipestudio-youtube-transcript-rag",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/acts/datapipestudio~youtube-transcript-rag/runs": {
      "post": {
        "operationId": "runs-sync-datapipestudio-youtube-transcript-rag",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor and returns information about the initiated run in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runsResponseSchema"
                }
              }
            }
          }
        }
      }
    },
    "/acts/datapipestudio~youtube-transcript-rag/run-sync": {
      "post": {
        "operationId": "run-sync-datapipestudio-youtube-transcript-rag",
        "x-openai-isConsequential": false,
        "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
        "tags": [
          "Run Actor"
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/inputSchema"
              }
            }
          }
        },
        "parameters": [
          {
            "name": "token",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Enter your Apify token here"
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "inputSchema": {
        "type": "object",
        "properties": {
          "urls": {
            "title": "YouTube URLs or Video IDs",
            "type": "array",
            "description": "List of YouTube video URLs, Shorts URLs, bare 11-char video IDs, playlist URLs, or channel URLs (@handle or /channel/UC...).",
            "items": {
              "type": "string"
            }
          },
          "searchQueries": {
            "title": "YouTube Search Queries (Optional)",
            "type": "array",
            "description": "Optional search queries to automatically discover videos and extract their transcripts.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "maxVideos": {
            "title": "Max Videos",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Maximum total videos to extract across all inputs. Free Apify plans are capped at 15 videos per run; paid plans support up to 5,000.",
            "default": 10
          },
          "languages": {
            "title": "Preferred Languages (ISO 639-1)",
            "type": "array",
            "description": "Ordered list of preferred transcript language codes (e.g. ['en', 'es', 'ar']). Manual captions are preferred over auto-generated.",
            "default": [
              "en"
            ],
            "items": {
              "type": "string"
            }
          },
          "allowAutoTranslation": {
            "title": "Translate If Preferred Language Missing",
            "type": "boolean",
            "description": "If none of the preferred languages exist natively, request YouTube's built-in translation to the first preferred language.",
            "default": true
          },
          "includeTimestamps": {
            "title": "Include Timestamped Segments",
            "type": "boolean",
            "description": "Include the raw array of {start, duration, text} caption segments in each output item.",
            "default": true
          },
          "includeMetadata": {
            "title": "Include Rich Video Metadata (Add-on)",
            "type": "boolean",
            "description": "Include title, channel info, views, likes, duration, publish date, keywords, chapters, and description.",
            "default": true
          },
          "includeRagChunks": {
            "title": "Generate Chapter Markdown & RAG Chunks (Add-on)",
            "type": "boolean",
            "description": "Generate chapter-aligned Markdown with clickable timestamps plus pre-chunked RAG segments ready for vector databases and LLMs.",
            "default": false
          },
          "ragChunkTokens": {
            "title": "Target Tokens per RAG Chunk",
            "minimum": 100,
            "maximum": 2000,
            "type": "integer",
            "description": "Approximate token size for each generated RAG chunk (used only when Generate RAG Chunks is enabled).",
            "default": 400
          },
          "ragChunkOverlapTokens": {
            "title": "RAG Chunk Overlap (Tokens)",
            "minimum": 0,
            "maximum": 400,
            "type": "integer",
            "description": "Approximate token overlap between consecutive RAG chunks to preserve context across boundaries.",
            "default": 50
          },
          "stripSoundMarkers": {
            "title": "Strip [Music] / [Applause] Markers",
            "type": "boolean",
            "description": "Remove bracketed non-speech sound annotations like [Music] or [Applause] from clean text and RAG chunks.",
            "default": true
          },
          "concurrency": {
            "title": "Concurrency",
            "minimum": 1,
            "maximum": 15,
            "type": "integer",
            "description": "Number of videos to extract in parallel.",
            "default": 5
          },
          "proxyConfiguration": {
            "title": "Proxy Configuration",
            "type": "object",
            "description": "Residential proxies are recommended on cloud IPs because YouTube rate-limits datacenter ranges.",
            "default": {
              "useApifyProxy": true,
              "apifyProxyGroups": [
                "RESIDENTIAL"
              ]
            }
          }
        }
      },
      "runsResponseSchema": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "actId": {
                "type": "string"
              },
              "userId": {
                "type": "string"
              },
              "startedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "finishedAt": {
                "type": "string",
                "format": "date-time",
                "example": "2025-01-08T00:00:00.000Z"
              },
              "status": {
                "type": "string",
                "example": "READY"
              },
              "meta": {
                "type": "object",
                "properties": {
                  "origin": {
                    "type": "string",
                    "example": "API"
                  },
                  "userAgent": {
                    "type": "string"
                  }
                }
              },
              "stats": {
                "type": "object",
                "properties": {
                  "inputBodyLen": {
                    "type": "integer",
                    "example": 2000
                  },
                  "rebootCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "restartCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "resurrectCount": {
                    "type": "integer",
                    "example": 0
                  },
                  "computeUnits": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "options": {
                "type": "object",
                "properties": {
                  "build": {
                    "type": "string",
                    "example": "latest"
                  },
                  "timeoutSecs": {
                    "type": "integer",
                    "example": 300
                  },
                  "memoryMbytes": {
                    "type": "integer",
                    "example": 1024
                  },
                  "diskMbytes": {
                    "type": "integer",
                    "example": 2048
                  }
                }
              },
              "buildId": {
                "type": "string"
              },
              "defaultKeyValueStoreId": {
                "type": "string"
              },
              "defaultDatasetId": {
                "type": "string"
              },
              "defaultRequestQueueId": {
                "type": "string"
              },
              "buildNumber": {
                "type": "string",
                "example": "1.0.0"
              },
              "containerUrl": {
                "type": "string"
              },
              "usage": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "integer",
                    "example": 1
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              },
              "usageTotalUsd": {
                "type": "number",
                "example": 0.00005
              },
              "usageUsd": {
                "type": "object",
                "properties": {
                  "ACTOR_COMPUTE_UNITS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATASET_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "KEY_VALUE_STORE_WRITES": {
                    "type": "number",
                    "example": 0.00005
                  },
                  "KEY_VALUE_STORE_LISTS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_READS": {
                    "type": "integer",
                    "example": 0
                  },
                  "REQUEST_QUEUE_WRITES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_INTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "DATA_TRANSFER_EXTERNAL_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_SERPS": {
                    "type": "integer",
                    "example": 0
                  },
                  "PROXY_UNBLOCKER_UNITS": {
                    "type": "integer",
                    "example": 0
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}