{
  "openapi": "3.0.1",
  "info": {
    "title": "Youtube Live Chat Scraper",
    "description": "YouTube Live Chat Scraper extracts live chat from YouTube live streams and replays. Supports full replay chat (most reliable) and best-effort live polling. Outputs messages with timestamps, authors, badges (owner/mod/member), Super Chats/Stickers, and stream metadata for analytics and AI.",
    "version": "1.0",
    "x-build-id": "dcKP8I8Mfv8dhoOGv"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/coregent~youtube-live-chat-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-coregent-youtube-live-chat-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/coregent~youtube-live-chat-scraper/runs": {
      "post": {
        "operationId": "runs-sync-coregent-youtube-live-chat-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/coregent~youtube-live-chat-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-coregent-youtube-live-chat-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": {
          "videoRefs": {
            "title": "Video URLs or IDs",
            "type": "array",
            "description": "YouTube watch URLs or 11-character video IDs. Can include live streams or replays with chat enabled.",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "channelRefs": {
            "title": "Channel URLs or Handles",
            "type": "array",
            "description": "YouTube channel URLs, @handles, or channel IDs (UC...). The actor will auto-discover live streams and replays from these channels.",
            "items": {
              "type": "string"
            },
            "default": []
          },
          "channelDiscoveryMode": {
            "title": "Channel Discovery Mode",
            "enum": [
              "current_live_only",
              "latest_replays_only",
              "current_live_then_replays"
            ],
            "type": "string",
            "description": "Which videos to discover from channels. 'current_live_only' finds only active live streams. 'latest_replays_only' finds recent replays. 'current_live_then_replays' finds live first, then replays.",
            "default": "current_live_then_replays"
          },
          "maxVideosPerChannel": {
            "title": "Max Videos Per Channel",
            "minimum": 1,
            "maximum": 50,
            "type": "integer",
            "description": "Maximum number of videos to discover per channel.",
            "default": 5
          },
          "lookbackDays": {
            "title": "Lookback Days",
            "minimum": 0,
            "maximum": 365,
            "type": "integer",
            "description": "Only discover replays from the last N days. Set to 0 for no limit.",
            "default": 30
          },
          "includeUpcomingLives": {
            "title": "Include Upcoming Lives",
            "type": "boolean",
            "description": "Include scheduled/upcoming live streams in discovery results. These will likely have no chat yet.",
            "default": false
          },
          "includeMembersOnly": {
            "title": "Include Members-Only Streams",
            "type": "boolean",
            "description": "Include members-only streams in discovery results. Chat extraction may fail without membership.",
            "default": false
          },
          "mode": {
            "title": "Mode",
            "enum": [
              "replay",
              "live"
            ],
            "type": "string",
            "description": "Extraction mode. 'replay' extracts full chat replay (recommended). 'live' polls chat in near real-time (best-effort).",
            "default": "replay"
          },
          "maxMessagesPerVideo": {
            "title": "Max Messages Per Video",
            "minimum": 1,
            "maximum": 200000,
            "type": "integer",
            "description": "Maximum number of chat messages to extract per video. Actor returns partial results when this limit is reached.",
            "default": 5000
          },
          "maxTimePerVideoSecs": {
            "title": "Max Time Per Video (seconds)",
            "minimum": 30,
            "maximum": 7200,
            "type": "integer",
            "description": "Time budget per video in seconds. Actor returns partial results when reached.",
            "default": 600
          },
          "includeSuperChats": {
            "title": "Include Super Chats",
            "type": "boolean",
            "description": "Extract Super Chat and Super Sticker events when present.",
            "default": true
          },
          "includeMembershipEvents": {
            "title": "Include Membership Events",
            "type": "boolean",
            "description": "Track membership join/renew messages if shown in chat.",
            "default": true
          },
          "includeModerationEvents": {
            "title": "Include Moderation Events",
            "type": "boolean",
            "description": "Track system and moderation events if visible in chat.",
            "default": true
          },
          "language": {
            "title": "Language",
            "enum": [
              "en",
              "es",
              "fr",
              "de",
              "ja",
              "ko",
              "pt",
              "hi",
              "zh",
              "ar"
            ],
            "type": "string",
            "description": "Localization language code (hl parameter).",
            "default": "en"
          },
          "regionCode": {
            "title": "Region",
            "enum": [
              "US",
              "GB",
              "CA",
              "AU",
              "IN",
              "DE",
              "FR",
              "JP",
              "BR",
              "MX",
              "KR",
              "ES"
            ],
            "type": "string",
            "description": "Localization region code (gl parameter).",
            "default": "US"
          },
          "liveCaptureDurationSecs": {
            "title": "Live Capture Duration (seconds)",
            "minimum": 10,
            "maximum": 86400,
            "type": "integer",
            "description": "Total capture duration for live mode (e.g., 300 = 5 minutes). Only used in 'live' mode.",
            "default": 300
          },
          "pollIntervalMs": {
            "title": "Poll Interval (ms)",
            "minimum": 1000,
            "maximum": 10000,
            "type": "integer",
            "description": "Polling interval for new messages in live mode (milliseconds).",
            "default": 2000
          },
          "stopWhenStreamEnds": {
            "title": "Stop When Stream Ends",
            "type": "boolean",
            "description": "Automatically stop capture if 'stream ended' is detected. Only used in 'live' mode.",
            "default": true
          },
          "maxConcurrency": {
            "title": "Max Concurrency",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "Number of videos to process in parallel (1–10).",
            "default": 3
          },
          "useProxy": {
            "title": "Use Proxy",
            "type": "boolean",
            "description": "Use Apify residential proxy. Recommended for high-volume or batch runs.",
            "default": false
          },
          "proxyCountryCode": {
            "title": "Proxy Country",
            "enum": [
              "",
              "US",
              "GB",
              "CA",
              "AU",
              "IN",
              "DE",
              "FR",
              "JP",
              "BR",
              "MX"
            ],
            "type": "string",
            "description": "Route proxy traffic through a specific country. Only applies when proxy is enabled.",
            "default": ""
          },
          "requestTimeoutSecs": {
            "title": "Request Timeout (seconds)",
            "minimum": 10,
            "maximum": 120,
            "type": "integer",
            "description": "HTTP request timeout in seconds.",
            "default": 30
          },
          "maxRetries": {
            "title": "Max Retries",
            "minimum": 0,
            "maximum": 10,
            "type": "integer",
            "description": "Number of retries for failed requests (429/5xx errors).",
            "default": 3
          },
          "minDelayMs": {
            "title": "Min Delay Between Requests (ms)",
            "minimum": 0,
            "maximum": 5000,
            "type": "integer",
            "description": "Minimum delay between continuation requests to smooth rate limiting.",
            "default": 0
          },
          "debug": {
            "title": "Debug Mode",
            "type": "boolean",
            "description": "Enable verbose logging for debugging.",
            "default": false
          },
          "includeRaw": {
            "title": "Include Raw Data",
            "type": "boolean",
            "description": "Include minimal raw event fragments in output (increases data size).",
            "default": 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
                  }
                }
              },
              "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}