{
  "openapi": "3.0.1",
  "info": {
    "title": "YouTube Comments Scraper With Reply Thread Expansion",
    "description": "YouTube Comments Scraper extracts YouTube comments with reply thread expansion, including comment text, authors, timestamps, likes, reply counts, nested replies, and video details. Ideal for sentiment analysis, audience research, engagement tracking, and content insights.",
    "version": "0.1",
    "x-build-id": "WA5s4h4Qt1502pPa3"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/scrapio~youtube-comments-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-scrapio-youtube-comments-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/scrapio~youtube-comments-scraper/runs": {
      "post": {
        "operationId": "runs-sync-scrapio-youtube-comments-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/scrapio~youtube-comments-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-scrapio-youtube-comments-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": {
          "videoUrls": {
            "title": "🔗 YouTube Video URLs or IDs",
            "type": "array",
            "description": "📋 The YouTube videos to scrape comments + full reply threads from. Full URLs (https://www.youtube.com/watch?v=VIDEO_ID or https://youtu.be/VIDEO_ID) or bare 11-character video IDs both work. Add multiple entries to process several videos in one run. (Also accepts the base actor's `startUrls` key.)",
            "items": {
              "type": "string"
            }
          },
          "maxTopLevelComments": {
            "title": "📊 Maximum Top-Level Comments per Video",
            "minimum": 0,
            "type": "integer",
            "description": "🔢 Caps the number of TOP-LEVEL (parent) comments scraped per video — replies are NOT counted against this limit, they are capped separately by 'Maximum Replies per Comment' below. Use 0 for no limit. Example: maxTopLevelComments=10 + maxRepliesPerComment=20 → up to 10 parent comments, each with up to 20 of its replies. Default is 50. (Also accepts the base actor's `maxComments` key — note: in the base, maxComments counted comments AND inline replies together; here it only counts parents.)"
          },
          "commentSortOrder": {
            "title": "📑 Comment Sort Order",
            "enum": [
              "top",
              "newest"
            ],
            "type": "string",
            "description": "⬆️ How top-level comments are ordered. • top — most liked/relevant first (YouTube's default). • newest — most recently posted first. (Also accepts the base actor's `sortOrder` key.)"
          },
          "fetchAllReplies": {
            "title": "↩️ Expand Full Reply Threads",
            "type": "boolean",
            "description": "🧵 When ON (default), follows EACH parent comment's own 'more replies' continuation token to fetch every reply YouTube is hiding behind the 'View N more replies' button — not just the 2-3 shown inline. When OFF, behaves like a normal comments scraper (inline-preview replies only, matching the base actor).",
            "default": true
          },
          "maxRepliesPerComment": {
            "title": "🔢 Maximum Replies per Comment",
            "minimum": 0,
            "type": "integer",
            "description": "🧢 Caps how many replies are KEPT per parent comment when 'Expand Full Reply Threads' is ON (counted after Include/Exclude Keyword filters are applied — a strict filter may page deeper into the thread to find that many matches). Use 0 for no limit (up to a 40-page safety valve per comment). Default is 50.",
            "default": 50
          },
          "includeKeywords": {
            "title": "🔍 Include Keywords",
            "type": "array",
            "description": "✅ Only keep rows (comments AND replies) whose text contains at least one of these keywords (case-insensitive substring match). Applied across the FULL thread — a matching reply is kept even if its parent comment doesn't match. Leave empty to keep everything.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "excludeKeywords": {
            "title": "🚫 Exclude Keywords",
            "type": "array",
            "description": "⛔ Drop any row (comment OR reply) whose text contains one of these keywords (case-insensitive substring match). Applied across the FULL thread, same scope as Include Keywords. Leave empty to disable.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "commentLanguage": {
            "title": "🌐 Language Code",
            "type": "string",
            "description": "Locale for YouTube's response (affects relative-date text like '2 years ago'). Default en-GB. (Also accepts the base actor's hidden `language` key.)"
          },
          "commentRegion": {
            "title": "🌍 Region Code",
            "type": "string",
            "description": "Country code used for the request. Default US. (Also accepts the base actor's hidden `region` key.)"
          },
          "proxyConfiguration": {
            "title": "🛡️ Proxy Configuration",
            "type": "object",
            "description": "Configure Apify Proxy. By default no proxy is used; the actor auto-escalates no-proxy → datacenter → residential on a block (403/429)."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}