{
  "openapi": "3.0.1",
  "info": {
    "title": "YouTube Scraper",
    "description": "Scrape YouTube searches, channels, playlists and videos without an API key or quota: views, duration, tags, subscribers, plus optional transcripts (text, SRT, VTT), comments, likes and engagement rate (these may need a residential proxy). Filtered or failed videos never billed. $3 per 1,000 results.",
    "version": "2.0",
    "x-build-id": "0EkTEV8GUEetL0W77"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/badr_xba~youtube-data-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-badr_xba-youtube-data-scraper",
        "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/badr_xba~youtube-data-scraper/runs": {
      "post": {
        "operationId": "runs-sync-badr_xba-youtube-data-scraper",
        "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/badr_xba~youtube-data-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-badr_xba-youtube-data-scraper",
        "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": {
          "searchQueries": {
            "title": "🔎 Search queries",
            "type": "array",
            "description": "Keywords as you would type them in YouTube search, one per line: \"lofi hip hop\", \"python tutorial\", \"iphone 17 review\". Leave empty if you only want channels, videos or playlists.",
            "items": {
              "type": "string"
            }
          },
          "channelUrls": {
            "title": "📺 Channels",
            "type": "array",
            "description": "Channel URLs, @handles or channel IDs: https://www.youtube.com/@LofiGirl, @LofiGirl, LofiGirl, UCSJ4gkVC6NrvII8umztf0Ow, /c/ or /user/ links. Returns the channel profile row plus its latest videos. You can paste several per line (comma or new line); duplicates are removed.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "videoUrls": {
            "title": "🎬 Videos",
            "type": "array",
            "description": "URLs or 11-character IDs of specific videos: https://www.youtube.com/watch?v=dQw4w9WgXcQ, https://youtu.be/dQw4w9WgXcQ, https://www.youtube.com/shorts/aqz-KE-bpKQ, live links or just dQw4w9WgXcQ. Several per line are fine.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "playlistUrls": {
            "title": "📃 Playlists",
            "type": "array",
            "description": "Playlist URLs or IDs: https://www.youtube.com/playlist?list=PL…, a watch link containing &list=PL…, or the bare PL… ID. Returns the playlist's videos.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "maxVideosPerSource": {
            "title": "Maximum videos per source",
            "minimum": 0,
            "maximum": 5000,
            "type": "integer",
            "description": "How many videos to read per search, channel or playlist. In full-detail mode each video is one request; list mode returns up to fifty videos per request.",
            "default": 10
          },
          "maxItems": {
            "title": "Maximum results for the whole run",
            "minimum": 0,
            "type": "integer",
            "description": "Hard ceiling on rows saved (and billed) for the whole run — videos, channel rows and comments together. 0 = no ceiling. The run also stops cleanly when your maximum cost per run is reached.",
            "default": 0
          },
          "videoDetails": {
            "title": "How much detail per video",
            "enum": [
              "full",
              "listing"
            ],
            "type": "string",
            "description": "YouTube returns a list of fifty videos in a single request, but without likes, comment counts or the exact publication date — those live on the video's own page, one request each. Full detail is the default; the list mode is about eighty times faster when you only need titles, views, durations and channels.",
            "default": "full"
          },
          "includeChannelDetails": {
            "title": "Add channel data to every video",
            "type": "boolean",
            "description": "Adds channel subscribers, the average views of its 30 latest videos, and performanceVsChannel to each video. One extra request per channel, cached.",
            "default": true
          },
          "includeComments": {
            "title": "Get comments",
            "type": "boolean",
            "description": "Adds the top comments of each video as separate rows (type \"comment\"): text, author, likes, date, pinned. Each comment row is a billed result.",
            "default": false
          },
          "maxCommentsPerVideo": {
            "title": "Maximum comments per video",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "How many comments to read per video, best ones first.",
            "default": 20
          },
          "commentsSort": {
            "title": "Comments order",
            "enum": [
              "top",
              "newest"
            ],
            "type": "string",
            "description": "Top comments (YouTube's default ranking) or the newest first.",
            "default": "top"
          },
          "includeReplies": {
            "title": "Include replies",
            "type": "boolean",
            "description": "Adds the replies of each comment as extra comment rows (isReply = true, parentCommentId). Each reply is a billed comment row.",
            "default": false
          },
          "maxRepliesPerComment": {
            "title": "Maximum replies per comment",
            "minimum": 1,
            "maximum": 50,
            "type": "integer",
            "description": "How many replies to keep under each comment when \"Include replies\" is on.",
            "default": 5
          },
          "startUrls": {
            "title": "🔗 Start URLs (any type)",
            "type": "array",
            "description": "One field for everything: video, Short, channel, playlist, hashtag or search-results links, @handles, video IDs — or plain words, which are searched like in the YouTube search bar. The type of each item is detected automatically; anything that is not YouTube is listed in FAILED_INPUTS (not billed).",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "maxResultsShorts": {
            "title": "Maximum Shorts",
            "minimum": 0,
            "type": "integer",
            "description": "Separate cap for Shorts. Empty means no specific cap."
          },
          "maxResultStreams": {
            "title": "Maximum live streams",
            "minimum": 0,
            "type": "integer",
            "description": "Separate cap for live streams and replays. Empty means no specific cap."
          },
          "hasSubtitles": {
            "title": "Only videos with subtitles",
            "type": "boolean",
            "description": "Keep only videos for which the channel published subtitles.",
            "default": false
          },
          "lengthFilter": {
            "title": "Duration",
            "enum": [
              "",
              "short",
              "medium",
              "long"
            ],
            "type": "string",
            "description": "Filter on video length: under 4 minutes, 4 to 20 minutes, or over 20 minutes. All keeps every length.",
            "default": ""
          },
          "includeTranscript": {
            "title": "Get the transcript",
            "type": "boolean",
            "description": "Adds the full spoken text, from the captions published on the video or, failing that (if allowed below), YouTube's automatic captions. captionSource says which one was used.",
            "default": false
          },
          "transcriptLanguage": {
            "title": "Transcript language",
            "pattern": "^\\s*([A-Za-z]{2,3}([-_][A-Za-z0-9]{2,8})*)?\\s*$",
            "type": "string",
            "description": "Two-letter language code (en, fr, ar…). Empty: the video language, then English, then the first available track.",
            "default": ""
          },
          "subtitlesFormat": {
            "title": "Transcript format",
            "enum": [
              "text",
              "srt",
              "vtt"
            ],
            "type": "string",
            "description": "Plain text for analysis and AI, SRT or VTT if you need timecodes.",
            "default": "text"
          },
          "preferAutoGeneratedSubtitles": {
            "title": "Prefer automatic subtitles",
            "type": "boolean",
            "description": "By default the channel’s own subtitles win. Switch on to use YouTube's automatic captions first, often closer to the spoken words.",
            "default": false
          },
          "saveSubsToKVS": {
            "title": "Save subtitles as files",
            "type": "boolean",
            "description": "Stores one subtitle file per video in the run's storage, in addition to the field in the results.",
            "default": false
          },
          "maxTranscriptChars": {
            "title": "Maximum transcript length",
            "minimum": 0,
            "type": "integer",
            "description": "0 means the whole text. Useful to keep files small on long videos.",
            "default": 0
          },
          "allowAutoCaptions": {
            "title": "Allow YouTube automatic captions",
            "type": "boolean",
            "description": "Captions published on the video are always used first. On (default): when there are none, YouTube's automatic captions are used (captionSource = \"auto\"). Off: videos without published captions get no transcript and no AI summary (aiError = \"noCaptions\", not charged as a summary).",
            "default": true
          },
          "includeTranscriptSegments": {
            "title": "Timestamped segments",
            "type": "boolean",
            "description": "Adds transcriptSegments: the caption lines with their start and end time in seconds, as JSON, plus availableCaptionLanguages. Capped at 5,000 segments and by \"Maximum transcript length\".",
            "default": false
          },
          "anonymizeComments": {
            "title": "Anonymise comments",
            "type": "boolean",
            "description": "Removes each comment author's name and link, keeping only the text. Switch on when your processing must contain no personal data (GDPR).",
            "default": false
          },
          "aiSummary": {
            "title": "AI summary and chapters",
            "type": "boolean",
            "description": "Writes a short summary, key points and chapters for each video with your own AI key (Claude, ChatGPT or Gemini). You pay the AI provider directly for the tokens; Apify adds a fee per summarized video. Only the caption text and the title are sent to the AI — never audio or video. Videos without captions are not summarized and not charged for a summary. Works with \"Full detail\" only. Available from a date to be announced: until then the option has no effect (the run log says so).",
            "default": false
          },
          "aiProvider": {
            "title": "AI provider",
            "enum": [
              "claude",
              "openai",
              "gemini"
            ],
            "type": "string",
            "description": "Whose API key you paste below.",
            "default": "claude"
          },
          "aiApiKey": {
            "title": "AI API key",
            "type": "string",
            "description": "Your own API key for the provider above (Anthropic, OpenAI or Google AI Studio). Stored encrypted by Apify, never written to logs or results. A wrong key or an empty account stops the run with a clear message, and no summary is charged."
          },
          "aiModel": {
            "title": "AI model",
            "pattern": "^\\s*([A-Za-z0-9._:\\-/]{1,80})?\\s*$",
            "type": "string",
            "description": "Empty = the cheapest default model of the provider (claude-haiku-5-5, gpt-6-luna or gemini-3.5-flash-lite). Any model id of the provider works if your key may use it.",
            "default": ""
          },
          "summaryLanguage": {
            "title": "Summary language",
            "pattern": "^\\s*([A-Za-z]{2,3}([-_][A-Za-z0-9]{2,8})*)?\\s*$",
            "type": "string",
            "description": "Language code of the summary and chapter titles (en, fr, de…). Empty = the language of the captions.",
            "default": ""
          },
          "maxChapters": {
            "title": "Maximum chapters",
            "minimum": 0,
            "maximum": 30,
            "type": "integer",
            "description": "How many chapters at most per video. Every chapter start is checked against the caption timestamps and the video duration; invalid ones are dropped.",
            "default": 8
          },
          "videoType": {
            "title": "Video type",
            "enum": [
              "all",
              "videos",
              "shorts",
              "live"
            ],
            "type": "string",
            "description": "Filter on format: long videos (over 60 s), Shorts, or live streams and their replays. All keeps everything.",
            "default": "all"
          },
          "minViews": {
            "title": "Minimum views",
            "minimum": 0,
            "type": "integer",
            "description": "Keep only videos with at least this many views. 0 keeps every video.",
            "default": 0
          },
          "minLikes": {
            "title": "Minimum likes",
            "minimum": 0,
            "type": "integer",
            "description": "Keep only videos with at least this many likes. 0 keeps every video. Not applied in the fast listing mode, which has no like counts.",
            "default": 0
          },
          "maxAgeDays": {
            "title": "Published within the last (days)",
            "minimum": 1,
            "type": "integer",
            "description": "For example 30 to keep only videos from the last month."
          },
          "publishedAfter": {
            "title": "Published after",
            "pattern": "^\\s*(\\d{4}-\\d{2}-\\d{2}([T ]\\d{2}:\\d{2}(:\\d{2}(\\.\\d+)?)?(Z|[+-]\\d{2}:?\\d{2})?)?)?\\s*$",
            "type": "string",
            "description": "Keep only videos published after this date, as an ISO date (2026-01-01) or timestamp (2026-01-01T12:00:00Z). Empty: no limit.",
            "default": ""
          },
          "titleKeywords": {
            "title": "Title contains",
            "type": "array",
            "description": "Keep only videos whose title contains one of these words (not case-sensitive). Empty: no title filter.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "excludeKeywords": {
            "title": "Title excludes",
            "type": "array",
            "description": "Exclude videos whose title contains one of these words (not case-sensitive). Empty: nothing excluded.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "order": {
            "title": "Sort searches",
            "enum": [
              "relevance",
              "date",
              "viewCount"
            ],
            "type": "string",
            "description": "Order of results for keyword searches.",
            "default": "relevance"
          },
          "searchUploadDate": {
            "title": "Search: upload date",
            "enum": [
              "",
              "hour",
              "today",
              "week",
              "month",
              "year"
            ],
            "type": "string",
            "description": "YouTube's own \"Upload date\" search filter, applied by YouTube before the list is returned, so you get N recent videos instead of N videos of which some are filtered out later. Applies to Search queries only. Any date (default) keeps the normal search.",
            "default": ""
          },
          "searchDuration": {
            "title": "Search: duration",
            "enum": [
              "",
              "short",
              "medium",
              "long"
            ],
            "type": "string",
            "description": "YouTube's own \"Duration\" search filter (under 4 minutes, 4 to 20 minutes, over 20 minutes). Applies to Search queries only. Any duration (default) keeps the normal search. The \"Duration\" filter above still checks every result afterwards.",
            "default": ""
          },
          "searchFeatures": {
            "title": "Search: features",
            "type": "array",
            "description": "YouTube's own \"Features\" search filters: only videos that have ALL the features you pick (HD, 4K, subtitles/CC, Creative Commons, live, 360°, VR180, 3D, HDR, location, purchased). Applies to Search queries only. Empty (default) keeps the normal search.",
            "items": {
              "type": "string",
              "enum": [
                "hd",
                "4k",
                "subtitles",
                "creativeCommons",
                "live",
                "360",
                "vr180",
                "3d",
                "hdr",
                "location",
                "purchased"
              ],
              "enumTitles": [
                "HD",
                "4K",
                "Subtitles/CC",
                "Creative Commons",
                "Live",
                "360°",
                "VR180",
                "3D",
                "HDR",
                "Location",
                "Purchased"
              ]
            },
            "default": []
          },
          "regionCode": {
            "title": "Country",
            "pattern": "^\\s*([A-Za-z]{2})?\\s*$",
            "type": "string",
            "description": "Two-letter country code to steer results (US, FR, MA…). Empty: YouTube's default for the request.",
            "default": ""
          },
          "language": {
            "title": "Language",
            "pattern": "^\\s*([A-Za-z]{2,3}([-_][A-Za-z0-9]{2,8})*)?\\s*$",
            "type": "string",
            "description": "Two-letter language code to steer results and texts (fr, ar, en…). Empty: YouTube's default.",
            "default": ""
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Optional. Off by default: the first attempt uses the run's own address and every retry a new Apify datacenter IP (up to 8 attempts within about a minute). Choose a proxy here to make every attempt go through it, each retry with a new IP. Residential proxies are not used (the price covers the datacenter proxy).",
            "default": {
              "useApifyProxy": false
            }
          },
          "maxConcurrency": {
            "title": "Videos read in parallel",
            "minimum": 1,
            "maximum": 16,
            "type": "integer",
            "description": "How many videos are read at the same time. Each video is one yt-dlp extraction, so this sets the pace. Above 8, raise the run memory as well.",
            "default": 8
          },
          "failRunOnError": {
            "title": "Mark the run as failed on input errors",
            "type": "boolean",
            "description": "Off (default): a run stopped by an input problem (AI key missing or refused, no usable link, nothing found for the links given) ends Succeeded, with the reason in the status message, RUN_SUMMARY and FAILED_INPUTS, and nothing charged. On: such runs end Failed, so your schedules, webhooks or integrations are alerted.",
            "default": false
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}