{
  "openapi": "3.0.1",
  "info": {
    "title": "YouTube Comments Scraper: Replies, Shorts, Channels",
    "description": "Scrape YouTube comments and replies from videos, Shorts, channels, playlists and search. Top or newest sort, keyword and date filters, pinned and creator-hearted flags, likes, reply counts, comment IDs and dates. Only delivered comments are charged.",
    "version": "1.0",
    "x-build-id": "GEj8xO1dUeomwR0Rx"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/zhtech~youtube-comments-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-zhtech-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/zhtech~youtube-comments-scraper/runs": {
      "post": {
        "operationId": "runs-sync-zhtech-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/zhtech~youtube-comments-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-zhtech-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": {
          "urls": {
            "title": "YouTube URLs or IDs",
            "type": "array",
            "description": "Video, Shorts or live URLs, youtu.be links, bare 11 character video IDs, channel URLs or @handles, playlist URLs, or YouTube search result URLs. For channels, playlists and searches the actor scrapes the comments of the first videos (see Max videos per channel, playlist or search).",
            "items": {
              "type": "string"
            }
          },
          "searchQueries": {
            "title": "Search queries",
            "type": "array",
            "description": "Search YouTube and scrape the comments of the top videos for each query.",
            "items": {
              "type": "string"
            }
          },
          "maxVideosPerSource": {
            "title": "Max videos per channel, playlist or search",
            "minimum": 0,
            "type": "integer",
            "description": "How many videos to take from each channel, playlist or search query. 0 means all. Single video URLs are always scraped.",
            "default": 10
          },
          "channelContentTypes": {
            "title": "Channel content",
            "type": "array",
            "description": "Which uploads of a channel to include, newest first. A channel URL that names a tab (for example /@name/shorts) uses only that tab.",
            "items": {
              "type": "string",
              "enum": [
                "videos",
                "shorts",
                "streams"
              ],
              "enumTitles": [
                "Videos",
                "Shorts",
                "Past live streams"
              ]
            },
            "default": [
              "videos",
              "shorts",
              "streams"
            ]
          },
          "searchSort": {
            "title": "Search sort order",
            "type": "string",
            "description": "Order of videos for search queries. These are the only two orders YouTube still applies. YouTube removed sorting by upload date and rating in 2025 (it silently ignores them): for recent videos use \"Only videos published after\". Old saved inputs with \"date\" run in relevance order and \"rating\" runs as popularity, with a note in the log.",
            "default": "relevance"
          },
          "videoPublishedAfter": {
            "title": "Only videos published after",
            "type": "string",
            "description": "For channels, playlists and searches: skip videos older than this (based on the upload age YouTube shows in listings). Example: 30 days."
          },
          "maxCommentsPerVideo": {
            "title": "Max comments per video",
            "minimum": 0,
            "type": "integer",
            "description": "Maximum top level comments per video. Replies do not count toward this limit (they have their own limit). 0 means all comments.",
            "default": 100
          },
          "sortBy": {
            "title": "Sort comments by",
            "enum": [
              "top",
              "newest"
            ],
            "type": "string",
            "description": "Top is the YouTube ranking. Newest first is best for monitoring and for date filters (the actor stops paging as soon as comments get older than your date).",
            "default": "top"
          },
          "includeReplies": {
            "title": "Include replies",
            "type": "boolean",
            "description": "Also scrape replies to each comment. Every reply is its own row with isReply = true and parentCommentId set, placed right after its parent comment.",
            "default": false
          },
          "maxRepliesPerThread": {
            "title": "Max replies per comment",
            "minimum": 0,
            "type": "integer",
            "description": "Maximum replies per top level comment when replies are on. 0 means all replies.",
            "default": 10
          },
          "keywords": {
            "title": "Only comments containing",
            "type": "array",
            "description": "Keep only comments whose text contains at least one of these words or phrases (not case sensitive). Non matching comments are skipped and not charged. With a keyword filter the actor scans up to 25 times your per video limit (at least 2,000 comments) per video.",
            "items": {
              "type": "string"
            }
          },
          "commentsPublishedAfter": {
            "title": "Only comments posted after",
            "type": "string",
            "description": "Skip comments older than this date or period (for example 7 days). Works best with Newest first, which stops paging early. YouTube only shows relative times such as 3 days ago, so the comparison uses that precision."
          },
          "skipPinnedComment": {
            "title": "Skip the pinned comment",
            "type": "boolean",
            "description": "Leave out the comment the creator pinned to the top.",
            "default": false
          },
          "includeErrorItems": {
            "title": "Include rows for videos without comments",
            "type": "boolean",
            "description": "Add a free (never charged) row for each video with comments turned off, no comments, or an error, so you can see why.",
            "default": true
          },
          "maxComments": {
            "title": "Max comments in total",
            "minimum": 0,
            "type": "integer",
            "description": "Stop the whole run after this many comment rows (comments plus replies). 0 means no limit. Your maximum cost per run setting is always respected too.",
            "default": 0
          },
          "maxConcurrency": {
            "title": "Videos in parallel",
            "minimum": 1,
            "maximum": 30,
            "type": "integer",
            "description": "How many videos to scrape at the same time.",
            "default": 8
          },
          "maxRetries": {
            "title": "Retries per request",
            "minimum": 0,
            "maximum": 10,
            "type": "integer",
            "description": "Retries with a fresh proxy session when YouTube refuses a request.",
            "default": 5
          },
          "proxyConfiguration": {
            "title": "Proxy",
            "type": "object",
            "description": "Apify Proxy datacenter IPs work for most runs. Requests that YouTube blocks are retried on residential IPs automatically (see below).",
            "default": {
              "useApifyProxy": true
            }
          },
          "residentialFallback": {
            "title": "Residential fallback",
            "type": "boolean",
            "description": "When YouTube blocks the datacenter proxy, retry those requests on residential IPs. Recommended.",
            "default": true
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}