{
  "openapi": "3.0.1",
  "info": {
    "title": "YouTube Comments Scraper: Comments, Replies, Authors",
    "description": "YouTube comments scraper: every comment and reply of a video by URL or ID, newest or top, with author, likes, reply count, pinned and hearted flags and an optional keyword filter. $0.40 per 1,000 comments. No login, no API key.",
    "version": "0.1",
    "x-build-id": "x5STeY6mZwcgh1m9U"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/datagleaner~youtube-comments-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-datagleaner-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/datagleaner~youtube-comments-scraper/runs": {
      "post": {
        "operationId": "runs-sync-datagleaner-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/datagleaner~youtube-comments-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-datagleaner-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": "Video URLs",
            "type": "array",
            "description": "YouTube video links: `https://www.youtube.com/watch?v=...`, `youtu.be`, Shorts or live URLs. 11-character video IDs also work here. Each video is read separately; videos that are private, removed or have comments turned off are skipped and not charged.",
            "items": {
              "type": "string"
            }
          },
          "videoIds": {
            "title": "Video IDs",
            "type": "array",
            "description": "11-character video IDs such as `dQw4w9WgXcQ`. Use this or the URL field, whichever your list has.",
            "items": {
              "type": "string"
            }
          },
          "datasetId": {
            "title": "Dataset ID from another run",
            "type": "string",
            "description": "Optional. Dataset ID of another run. The video is read from the first present field of `videoId`, `videoUrl`, `url`, `link`, `inputUrl`. Items that are not videos (channels, playlists) are skipped. Combine it with the URL fields if you like."
          },
          "maxDatasetItems": {
            "title": "Max dataset items",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "How many items to read from the dataset. Each video is then read up to `maxCommentsPerVideo` comments, so this also bounds the cost of a run.",
            "default": 100
          },
          "maxCommentsPerVideo": {
            "title": "Max comments per video",
            "minimum": 1,
            "maximum": 50000,
            "type": "integer",
            "description": "Stops after this many rows for each video. Replies count as rows too, so 100 with replies on means 100 comments and replies together. A row is billed only when it is returned. YouTube itself stops listing after a while on videos with millions of comments.",
            "default": 100
          },
          "sortBy": {
            "title": "Sort order",
            "enum": [
              "top",
              "newest"
            ],
            "type": "string",
            "description": "The order of YouTube's own Sort comments menu. `top` gives the pinned and most-liked comments first; `newest` gives the latest comments first, which is what you want for monitoring.",
            "default": "top"
          },
          "includeReplies": {
            "title": "Include replies",
            "type": "boolean",
            "description": "Also return the replies under each comment (`isReply` true, with `parentId`). Each reply is a billed row and counts toward `maxCommentsPerVideo`.",
            "default": false
          },
          "maxRepliesPerComment": {
            "title": "Max replies per comment",
            "minimum": 1,
            "maximum": 1000,
            "type": "integer",
            "description": "Only used when replies are on. Stops reading replies under one comment after this many.",
            "default": 20
          },
          "keywords": {
            "title": "Keep only comments containing",
            "type": "array",
            "description": "Optional. A comment is returned only if its text contains at least one of these words or phrases (not case sensitive). Comments that do not match are not returned and not billed. Matching rows carry `matchedKeywords`.",
            "items": {
              "type": "string"
            }
          },
          "commentsSince": {
            "title": "Only comments since (date)",
            "type": "string",
            "description": "Optional, `YYYY-MM-DD`. Comments older than this are left out and not billed. YouTube shows only a rounded age (`3 months ago`), so the cut is approximate. With newest-first order the Actor stops reading a video as soon as a page is older than the date."
          },
          "maxCommentsScanned": {
            "title": "Max comments read per video (filters)",
            "minimum": 1,
            "maximum": 200000,
            "type": "integer",
            "description": "Only used with a keyword or date filter. Filtered-out comments are free, but they still take time to read, so this caps how many comments are read per video while looking for matches.",
            "default": 5000
          },
          "country": {
            "title": "Country",
            "type": "string",
            "description": "Two-letter country code YouTube is asked for (`US`, `GB`, `DE`).",
            "default": "US"
          },
          "language": {
            "title": "Language",
            "type": "string",
            "description": "Interface language YouTube is asked for. Comment dates are only converted to `publishedAt` for English (`en`).",
            "default": "en"
          },
          "maxConcurrency": {
            "title": "Parallel requests",
            "minimum": 1,
            "maximum": 8,
            "type": "integer",
            "description": "How many requests run at once. Lower it if you see rate limiting.",
            "default": 4
          },
          "requestDelaySecs": {
            "title": "Pause between requests (seconds)",
            "minimum": 0,
            "maximum": 10,
            "type": "number",
            "description": "Minimum spacing between requests across the whole run, with random jitter. Raise it if you read many videos and see rate-limit warnings in the log.",
            "default": 0.25
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Optional. Off by default: YouTube answered Apify datacenter IPs in testing. Turn a proxy on if runs start getting refused at high volume; the Actor then switches to a fresh IP after repeated refusals."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}