{
  "openapi": "3.0.1",
  "info": {
    "title": "YouTube Comments & Replies Scraper",
    "description": "YouTube Comments & Replies Scraper extracts comments from any public YouTube video or channel. Gather usernames, timestamps, likes, replies, and full comment text. Ideal for sentiment analysis, audience research, or content insights. Export clean structured data in JSON, CSV, or Excel.",
    "version": "1.0",
    "x-build-id": "dt4qlgcl4wne9BoJ9"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/scraper-engine~youtube-comments-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-scraper-engine-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/scraper-engine~youtube-comments-scraper/runs": {
      "post": {
        "operationId": "runs-sync-scraper-engine-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/scraper-engine~youtube-comments-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-scraper-engine-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",
        "required": [
          "startUrls"
        ],
        "properties": {
          "startUrls": {
            "title": "🔗 YouTube Video / Channel URLs or IDs",
            "type": "array",
            "description": "📋 Enter YouTube video URLs, 11-char video IDs, OR channel URLs (https://www.youtube.com/@handle, /channel/UC..., /c/name, /user/name). Channel URLs are expanded to their latest videos (see Max Videos per Channel).",
            "items": {
              "type": "string"
            }
          },
          "maxComments": {
            "title": "📊 Maximum Comments per Video",
            "minimum": 0,
            "type": "integer",
            "description": "🔢 Max TOP-LEVEL comments to scrape per video (replies are additional, controlled by Max Replies per Comment). Example: maxComments=10 + maxReplies=3 → up to 10 comments and up to 30 replies. Use 0 for no limit. Default is 10.",
            "default": 10
          },
          "sortOrder": {
            "title": "📑 Comment Sort Order",
            "enum": [
              "top",
              "newest"
            ],
            "type": "string",
            "description": "⬆️ 'top' = most liked first; 'newest' = most recent first. (Auto-switches to 'newest' when Oldest Comment Date is set.)",
            "default": "top"
          },
          "includeReplies": {
            "title": "↩️ Include Replies",
            "type": "boolean",
            "description": "Include reply comments (child comments). Turn off to only scrape top-level comments.",
            "default": true
          },
          "maxRepliesPerComment": {
            "title": "↩️ Max Replies per Comment",
            "minimum": 0,
            "type": "integer",
            "description": "Cap the number of replies collected per top-level comment. Use 0 for no limit.",
            "default": 0
          },
          "keywords": {
            "title": "🔍 Include Keywords",
            "type": "array",
            "description": "Only keep comments whose text contains at least one of these words/phrases (case-insensitive). Leave empty to keep all.",
            "items": {
              "type": "string"
            }
          },
          "excludeKeywords": {
            "title": "🚫 Exclude Keywords",
            "type": "array",
            "description": "Drop comments whose text contains any of these words/phrases (case-insensitive).",
            "items": {
              "type": "string"
            }
          },
          "minLikes": {
            "title": "👍 Minimum Likes",
            "minimum": 0,
            "type": "integer",
            "description": "Only keep comments with at least this many likes (voteCount).",
            "default": 0
          },
          "oldestCommentDate": {
            "title": "📅 Oldest Comment Date",
            "type": "string",
            "description": "Only keep comments newer than this. The date picker has a toggle to switch between an ABSOLUTE calendar date (e.g. 2026-01-15) and a RELATIVE period (e.g. '7 days', '3 months', '1 year'). Both are supported. Auto-switches sort to 'newest'."
          },
          "maxVideosPerChannel": {
            "title": "📺 Max Videos per Channel",
            "minimum": 1,
            "type": "integer",
            "description": "When a channel URL is provided, scrape comments from up to this many of its latest videos.",
            "default": 10
          },
          "aiEnhancement": {
            "title": "🤖 AI Enrichment (sentiment, emotion, language, topics, toxicity)",
            "type": "boolean",
            "description": "Add sentiment, emotion, detected language, topic tags, and a toxicity score to each comment using the AI provider you choose below. Requires an API key for that provider.",
            "default": false
          },
          "aiModel": {
            "title": "🤖 AI Model / Provider",
            "enum": [
              "claude-haiku-4-5",
              "claude-sonnet-4-6",
              "claude-sonnet-5",
              "claude-opus-4-6",
              "claude-opus-4-7",
              "claude-opus-4-8",
              "claude-fable-5",
              "gpt-4o-mini",
              "gpt-4o",
              "gpt-4.1-mini",
              "gpt-4.1",
              "o3-mini",
              "o1",
              "gemini-2.0-flash-lite",
              "gemini-2.0-flash",
              "gemini-1.5-flash",
              "gemini-1.5-pro",
              "gemini-2.5-flash",
              "gemini-2.5-pro",
              "grok-2-latest",
              "grok-2",
              "grok-3-mini",
              "grok-3",
              "grok-beta",
              "deepseek-chat",
              "deepseek-reasoner",
              "sonar",
              "sonar-pro",
              "sonar-reasoning",
              "mistral-small-latest",
              "mistral-large-latest"
            ],
            "type": "string",
            "description": "Pick the model. The provider is auto-detected from the name: claude-* = Anthropic, gpt-*/o1/o3 = OpenAI (ChatGPT), gemini-* = Google, grok-* = xAI, deepseek-* = DeepSeek, sonar* = Perplexity, mistral-* = Mistral. Cheaper 'mini'/'flash'/'haiku'/'lite' models are recommended for classification.",
            "default": "claude-haiku-4-5"
          },
          "aiApiKey": {
            "title": "🔑 AI Provider API Key",
            "type": "string",
            "description": "API key for the selected provider. Falls back to an env var: ANTHROPIC_API_KEY (Claude), OPENAI_API_KEY (ChatGPT), GEMINI_API_KEY/GOOGLE_API_KEY (Gemini), XAI_API_KEY/GROK_API_KEY (Grok), DEEPSEEK_API_KEY (DeepSeek), PERPLEXITY_API_KEY/PPLX_API_KEY (Perplexity), or MISTRAL_API_KEY (Mistral)."
          },
          "proxyConfiguration": {
            "title": "🌐 Proxy Configuration",
            "type": "object",
            "description": "🛡️ Proxy settings. Default: no proxy, with automatic fallback to datacenter then residential if blocked."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}