{
  "openapi": "3.0.1",
  "info": {
    "title": "YouTube Scraper · Transcripts & Comments · $0.5/1k",
    "version": "0.0",
    "x-build-id": "P4HT98cbvVQ6hpkjy"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/alfalfa~youtube-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-alfalfa-youtube-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/alfalfa~youtube-scraper/runs": {
      "post": {
        "operationId": "runs-sync-alfalfa-youtube-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/alfalfa~youtube-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-alfalfa-youtube-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": "What to search for on YouTube, one query per line: <code>data engineering tutorial</code>, <code>iphone review</code>. Each query is one source of up to <b>Max videos</b> results.",
            "items": {
              "type": "string"
            }
          },
          "startUrls": {
            "title": "YouTube URLs",
            "type": "array",
            "description": "Video URLs (<code>youtube.com/watch?v=...</code>, <code>youtu.be/...</code>, <code>/shorts/...</code>), channel URLs (<code>youtube.com/@handle</code>, <code>/channel/UC...</code>, with <code>/videos</code>, <code>/shorts</code> or <code>/streams</code>), playlist URLs (<code>playlist?list=...</code>) or search result URLs. Each URL is one source on top of the search queries. A watch URL with a <code>list=</code> parameter counts as the video, not the playlist.",
            "items": {
              "type": "object",
              "required": [
                "url"
              ],
              "properties": {
                "url": {
                  "type": "string",
                  "title": "URL of a web page",
                  "format": "uri"
                }
              }
            }
          },
          "maxVideos": {
            "title": "Max videos per source",
            "minimum": 1,
            "type": "integer",
            "description": "Maximum videos per search query, channel or playlist. A search returns about 20 videos per page; channels and playlists can go into the thousands.",
            "default": 50
          },
          "scrapeDetails": {
            "title": "Include video details",
            "type": "boolean",
            "description": "Open every video for likes, exact publish date and time, category, full description and tags. One small extra request per video, no surcharge. Off = listing fields only (title, views, date text, duration), about twice as fast. Automatically on when transcripts, comments or counts are requested.",
            "default": true
          },
          "engagementCounts": {
            "title": "Include subscriber and comment counts",
            "type": "boolean",
            "description": "Add the channel's subscriber count and the video's comment count. One larger extra request per video, no surcharge; also filled automatically when comments are collected.",
            "default": false
          },
          "transcript": {
            "title": "Include transcript",
            "type": "boolean",
            "description": "Download the video's subtitles as timed segments and plain text (manual captions preferred, auto-generated as fallback). One extra request per video. Charged separately per video with a transcript, see the pricing.",
            "default": false
          },
          "transcriptLanguage": {
            "title": "Transcript language",
            "type": "string",
            "description": "Preferred language code of the transcript, e.g. <code>en</code>, <code>de</code>, <code>es</code>. When the video has no captions in that language, a manual track in another language is used, then the first available one; the language used is recorded in <code>transcriptLanguage</code>.",
            "default": "en"
          },
          "maxComments": {
            "title": "Max comments per video",
            "minimum": 0,
            "type": "integer",
            "description": "Comments to collect per video, saved as separate rows with <code>type</code> = <code>comment</code> and the video ID. 0 = no comments. Twenty comments per request.",
            "default": 0
          },
          "maxReplies": {
            "title": "Max replies per comment",
            "minimum": 0,
            "type": "integer",
            "description": "Replies to collect under each comment, as rows with <code>parentId</code> and <code>replyLevel</code> 1. 0 = no replies. Replies count towards <b>Max comments per video</b>. Ten replies per request.",
            "default": 0
          },
          "commentsSort": {
            "title": "Comments order",
            "enum": [
              "top",
              "newest"
            ],
            "type": "string",
            "description": "YouTube's Top comments or newest first.",
            "default": "top"
          },
          "channelDetails": {
            "title": "Include channel records",
            "type": "boolean",
            "description": "One extra row with <code>type</code> = <code>channel</code> per channel: description, country, joined date, total views, video and subscriber counts, handle, external links. For channel URLs the channel itself; for video URLs, searches and playlists every channel that appears (once per run). Charged separately per channel, see the pricing.",
            "default": false
          },
          "sortBy": {
            "title": "Search order",
            "enum": [
              "relevance",
              "date",
              "views",
              "rating"
            ],
            "type": "string",
            "description": "Order of search results (search queries and search URLs only).",
            "default": "relevance"
          },
          "uploadDate": {
            "title": "Upload date",
            "enum": [
              "any",
              "hour",
              "today",
              "week",
              "month",
              "year"
            ],
            "type": "string",
            "description": "Only search results uploaded within this window (search queries only).",
            "default": "any"
          },
          "channelTab": {
            "title": "Channel content",
            "enum": [
              "videos",
              "shorts",
              "live"
            ],
            "type": "string",
            "description": "Which tab of a channel URL to read when the URL itself does not say (<code>/videos</code>, <code>/shorts</code>, <code>/streams</code>).",
            "default": "videos"
          },
          "maxConcurrency": {
            "title": "Concurrency",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "Sources processed in parallel (default 5). Pages of one source are always read in order.",
            "default": 5
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Residential proxies are included in the price. Leave the default unless you want your own proxy servers.",
            "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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}