{
  "openapi": "3.0.1",
  "info": {
    "title": "YouTube Comments Scraper API",
    "description": "YouTube comments scraper for videos, Shorts, channels, playlists and search. Export comment/reply threads, authors, likes, dates, creator/hearted/pinned flags and video metadata; filter results, add insights. From $0.35 per 1,000 comments, platform usage included.",
    "version": "0.1",
    "x-build-id": "rx8jyaZ0KHahExrhz"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/zenomastro~youtube-comments-reliable/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-zenomastro-youtube-comments-reliable",
        "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/zenomastro~youtube-comments-reliable/runs": {
      "post": {
        "operationId": "runs-sync-zenomastro-youtube-comments-reliable",
        "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/zenomastro~youtube-comments-reliable/run-sync": {
      "post": {
        "operationId": "run-sync-zenomastro-youtube-comments-reliable",
        "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 URLs or video IDs",
            "minItems": 0,
            "maxItems": 500,
            "type": "array",
            "description": "YouTube video URLs or IDs, one per line, e.g. https://www.youtube.com/watch?v=dQw4w9WgXcQ. Watch, youtu.be, Shorts, Live and Embed links work. Up to 500 per run. Can be combined with channel, playlist and search sources below.",
            "items": {
              "type": "string"
            }
          },
          "sourceUrls": {
            "title": "Channel, playlist or search URLs",
            "maxItems": 50,
            "type": "array",
            "description": "Collect comments from the videos of a YouTube channel (e.g. https://www.youtube.com/@mkbhd or /@mkbhd/shorts), playlist or search-results page. Channels are read newest first, up to Maximum discovered videos. Shortcuts work too: @handle, a channel ID (UC...) or plain keywords (read as a search).",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "searchQueries": {
            "title": "Search keywords",
            "maxItems": 50,
            "type": "array",
            "description": "Search YouTube for these keywords, one search per line (e.g. iphone 17 review), and collect comments from the top video results, like searching on youtube.com with the Videos filter.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "sortBy": {
            "title": "Sort comments by",
            "enum": [
              "top",
              "newest"
            ],
            "type": "string",
            "description": "Top uses YouTube's ranked comments; Newest requests the most recent comments first (best for monitoring and date filters).",
            "default": "top"
          },
          "maxResultsPerVideo": {
            "title": "Maximum results per video",
            "minimum": 0,
            "maximum": 10000,
            "type": "integer",
            "description": "Maximum comment + reply rows returned (and billed) per video after filters, e.g. 200. Set 0 to collect all comments of each video, still capped by Maximum total results.",
            "default": 500
          },
          "maxTotalResults": {
            "title": "Maximum total results",
            "minimum": 1,
            "maximum": 100000,
            "type": "integer",
            "description": "Hard cap on comment + reply rows across all videos, to keep runtime and spend predictable.",
            "default": 5000
          },
          "includeReplies": {
            "title": "Include replies",
            "type": "boolean",
            "description": "Include replies in the output. Replies use the same per-result price as top-level comments.",
            "default": true
          },
          "maxRepliesPerComment": {
            "title": "Maximum replies per comment",
            "minimum": 0,
            "maximum": 10000,
            "type": "integer",
            "description": "Cap on replies returned per comment thread, e.g. 5, so one huge thread cannot use up the budget. Further reply pages are not loaded. 0 = no cap.",
            "default": 0
          },
          "minLikes": {
            "title": "Minimum likes",
            "minimum": 0,
            "type": "integer",
            "description": "Only emit comments with at least this many likes. Set 0 to disable. Filtered comments are not charged.",
            "default": 0
          },
          "keywords": {
            "title": "Comment contains any of these words",
            "maxItems": 100,
            "type": "array",
            "description": "Keep only comments that contain at least one of these words or phrases (case-insensitive), e.g. price, refund, battery life. Each row lists the ones it matched in matchedKeywords.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "excludeKeywords": {
            "title": "Skip comments containing",
            "maxItems": 100,
            "type": "array",
            "description": "Skip comments that contain any of these words or phrases (case-insensitive), e.g. telegram, whatsapp, http to drop spam.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "containsText": {
            "title": "Comment text contains",
            "type": "string",
            "description": "Optional single case-insensitive phrase that every returned comment must contain.",
            "default": ""
          },
          "publishedWithinDays": {
            "title": "Published within the last N days",
            "minimum": 0,
            "maximum": 3650,
            "type": "integer",
            "description": "Keep only comments from the last N days, counted from the run start, e.g. 7 for a weekly schedule. With Newest first sorting the scan stops at older comments, which saves time. 0 = off.",
            "default": 0
          },
          "publishedAfter": {
            "title": "Published after",
            "type": "string",
            "description": "Optional lower boundary: a date (2026-01-31), a date-time (2026-01-31T18:00:00Z) or a relative value such as \"24 hours\", \"7 days\", \"3 months\" or \"today\". Compared with YouTube's approximate comment time; dates without a time zone are read as UTC.",
            "default": ""
          },
          "publishedBefore": {
            "title": "Published before",
            "type": "string",
            "description": "Optional upper boundary: a date (2026-01-31 includes that whole day), a date-time or a relative value such as \"7 days\" or \"yesterday\". Compared with YouTube's approximate comment time.",
            "default": ""
          },
          "creatorOnly": {
            "title": "Creator comments only",
            "type": "boolean",
            "description": "Keep only comments and replies written by the video's creator (YouTube's creator badge).",
            "default": false
          },
          "heartedOnly": {
            "title": "Hearted only",
            "type": "boolean",
            "description": "Keep only comments the creator marked with a heart.",
            "default": false
          },
          "pinnedOnly": {
            "title": "Pinned only",
            "type": "boolean",
            "description": "Keep only the pinned comment. The scan stops right after it, so this run is fast and cheap.",
            "default": false
          },
          "verifiedOnly": {
            "title": "Verified authors only",
            "type": "boolean",
            "description": "Keep only comments and replies from channels with YouTube's verified badge.",
            "default": false
          },
          "authorFilter": {
            "title": "Comments by these authors",
            "maxItems": 100,
            "type": "array",
            "description": "Keep only comments and replies by these authors: @handles (e.g. @MrBeast), channel IDs (UC...) or channel URLs, one per line. Case-insensitive. Up to 50,000 comments are scanned per video to find them; only matching rows are billed.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "maxDiscoveredVideos": {
            "title": "Maximum discovered videos",
            "minimum": 1,
            "maximum": 500,
            "type": "integer",
            "description": "Total cap on videos taken from channel, playlist and search sources in one run (videos you list directly are not counted).",
            "default": 100
          },
          "maxVideosPerSource": {
            "title": "Maximum videos per source",
            "minimum": 0,
            "maximum": 500,
            "type": "integer",
            "description": "Cap for each channel, playlist or search, e.g. 5 = the 5 newest videos of every channel. 0 = no per-source cap (only the total maximum applies, so the first source can use it all).",
            "default": 0
          },
          "sourceContentTypes": {
            "title": "Channel tabs to include",
            "uniqueItems": true,
            "type": "array",
            "description": "For channel URLs without a tab (for example https://www.youtube.com/@name), which tabs to read: videos, shorts and/or live streams. Empty = all tabs (videos first, then live streams, then Shorts). Playlist, search and tab URLs such as /@name/shorts are read as given.",
            "items": {
              "type": "string",
              "enum": [
                "videos",
                "shorts",
                "streams"
              ],
              "enumTitles": [
                "Videos",
                "Shorts",
                "Live streams"
              ]
            },
            "default": []
          },
          "includeVideoMetadata": {
            "title": "Include video metadata",
            "type": "boolean",
            "description": "Add video title, channel, thumbnail, views, likes, comment count, channel subscribers, publish date, duration and channel ID to every row (likes, comment count and subscribers when YouTube shows them; they can be rounded, e.g. 2.4M). The per-video insights row also gets the video description and keywords.",
            "default": true
          },
          "includeCommentInsights": {
            "title": "Include comment insights",
            "type": "boolean",
            "description": "Add a free per-video summary row: reply, creator, heart and pin counts, unique authors, questions, top commenters, top keywords and hashtags, the video moments people mention (e.g. 2:15) and the most-liked comments, plus stopReason and truncated so you can see whether every comment was collected.",
            "default": true
          },
          "language": {
            "title": "YouTube interface language",
            "type": "string",
            "description": "Language code for YouTube-generated labels such as \"3 days ago\", for example en, it, es, de. Keep en for the most reliable approximate dates.",
            "default": "en"
          },
          "monitorName": {
            "title": "Comment monitor name",
            "type": "string",
            "description": "Reuse the same name on scheduled runs (e.g. my-channel-weekly) to remember comment IDs already seen; every row then says whether it is new (isNew).",
            "default": ""
          },
          "onlyNew": {
            "title": "Emit only new comments",
            "type": "boolean",
            "description": "With monitorName, output and bill only comments/replies not seen in prior runs.",
            "default": false
          },
          "requestTimeoutSecs": {
            "title": "Request timeout",
            "minimum": 5,
            "maximum": 90,
            "type": "integer",
            "description": "Maximum seconds for each YouTube HTTP request.",
            "default": 25
          },
          "retries": {
            "title": "Video retries",
            "minimum": 0,
            "maximum": 5,
            "type": "integer",
            "description": "Retry blocked or temporary failures with a fresh proxy session. Failed videos are never charged.",
            "default": 2
          },
          "autoProxyFallback": {
            "title": "Automatic proxy fallback",
            "type": "boolean",
            "description": "Try direct access first for speed, then switch retries to standard Apify Proxy if YouTube blocks or returns no comments.",
            "default": true
          },
          "proxyConfiguration": {
            "title": "Proxy configuration",
            "type": "object",
            "description": "Optional explicit proxy configuration. Leave disabled to use fast direct-first mode with automatic proxy fallback.",
            "default": {
              "useApifyProxy": false
            }
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}