{
  "openapi": "3.0.1",
  "info": {
    "title": "YouTube Comments Scraper",
    "description": "Export public YouTube and Shorts comments, replies, authors, likes, creator signals, and thread metadata with keyword filters, retries, and downloadable datasets.",
    "version": "0.1",
    "x-build-id": "2fjz2ZcL1Yk3uWYIu"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/fetch_cat~youtube-comments-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-fetch_cat-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/fetch_cat~youtube-comments-scraper/runs": {
      "post": {
        "operationId": "runs-sync-fetch_cat-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/fetch_cat~youtube-comments-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-fetch_cat-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",
            "type": "array",
            "description": "Public YouTube watch, Shorts, embed, or youtu.be URLs to scrape comments from.",
            "items": {
              "type": "string"
            }
          },
          "videoIds": {
            "title": "YouTube video IDs",
            "type": "array",
            "description": "Optional 11-character YouTube video IDs. Use this if you already have IDs instead of full URLs.",
            "items": {
              "type": "string"
            }
          },
          "maxCommentsPerVideo": {
            "title": "Maximum comments per video",
            "minimum": 1,
            "maximum": 5000,
            "type": "integer",
            "description": "Maximum combined number of comments and replies to save per video and sort. Choosing Top and newest applies this limit separately to each sort, and can return the same comment twice with different sort values.",
            "default": 20
          },
          "maxCommentsToScanPerVideo": {
            "title": "Maximum comments to inspect per video",
            "minimum": 1,
            "maximum": 50000,
            "type": "integer",
            "description": "Optional inspected-comment budget per video and sort for filtered runs. Must be at least the saved-row limit. When omitted, defaults to the smaller of 3 times the output limit and 5000. Increase for rare matches. Independently, at most 50000 combined comment/reply continuation pages are admitted per video and sort; outstanding work at that ceiling fails truthfully and preserves saved rows. The original run deadline and available pages can stop work earlier."
          },
          "includeKeywords": {
            "title": "Include keywords",
            "type": "array",
            "description": "Only save comments whose text or author contains at least one keyword. Matching is case-insensitive.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "excludeKeywords": {
            "title": "Exclude keywords",
            "type": "array",
            "description": "Skip comments whose text or author contains any listed keyword. Matching is case-insensitive.",
            "default": [],
            "items": {
              "type": "string"
            }
          },
          "connectionMode": {
            "title": "Connection",
            "enum": [
              "automatic",
              "direct"
            ],
            "type": "string",
            "description": "Automatic preserves the existing managed Apify Proxy route from the first request, which can incur proxy costs. It is not a direct-first fallback. Direct makes requests without a proxy and never falls back to a paid route. Explicit proxyConfiguration settings take precedence, including custom pools and proxy opt-outs. Both choices retain the same bounded request retries and run deadline.",
            "default": "automatic"
          },
          "sort": {
            "title": "Comment sort order",
            "enum": [
              "top",
              "newest",
              "both"
            ],
            "type": "string",
            "description": "Use top or newest comments when exposed by YouTube. Both runs two independent samples, each with its own row/scan cap. Overlapping comments are retained with different sort values and are billed as separate saved rows.",
            "default": "top"
          },
          "includeReplies": {
            "title": "Include replies",
            "type": "boolean",
            "description": "Also extract replies nested under top-level comments when available.",
            "default": true
          },
          "maxRepliesPerComment": {
            "title": "Maximum replies per comment",
            "minimum": 0,
            "maximum": 1000,
            "type": "integer",
            "description": "Safety cap for replies collected from any single thread. Set 0 to keep top-level comments only while leaving includeReplies enabled for reusable tasks.",
            "default": 20
          },
          "minLikes": {
            "title": "Minimum likes",
            "minimum": 0,
            "maximum": 1000000000,
            "type": "integer",
            "description": "Only save comments with at least this many visible likes.",
            "default": 0
          },
          "runTag": {
            "title": "Run tag",
            "maxLength": 200,
            "type": "string",
            "description": "Optional label copied to every output row for campaigns, schedules, or downstream joins."
          },
          "maxRunSeconds": {
            "title": "Safe run deadline",
            "minimum": 30,
            "maximum": 86400,
            "type": "integer",
            "description": "Processing budget from the original run start, independent of request retries. The deployed platform timeout is 300 seconds, so keep this below that timeout with time to save the summary. A larger value does not extend the platform timeout. Restart, resurrection and other continuations fail closed without new extraction or charges; they do not reset this budget. Start a NEW run for another attempt, retaining and reviewing any previous rows because abrupt storage/billing interruptions are not automatically reconciled. Reduce the workload if the deadline is reached.",
            "default": 270
          },
          "proxyConfiguration": {
            "title": "Existing or custom proxy settings",
            "type": "object",
            "description": "Optional managed groups/country, custom proxy pool or explicit useApifyProxy:false. When supplied, these settings override Connection, including its form defaults. Omit this object to use Connection. The selected pool stays in effect without substitution. A brief run notice confirms legacy settings remain active. Proxy costs depend on the selected pool and traffic."
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}