{
  "openapi": "3.0.1",
  "info": {
    "title": "YouTube Live Stream Real-Time Monitor",
    "description": "Monitor any YouTube livestream's concurrent viewers in real time. List currently-live & recent streams for any channel. Bulk poll 100s of stream IDs. For esports analytics, live-commerce, news-event tracking and brand-safety teams.",
    "version": "1.0",
    "x-build-id": "wgGQIy1ZiauBj3htD"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/sian.agency~youtube-live-stream-monitor/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-sian.agency-youtube-live-stream-monitor",
        "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/sian.agency~youtube-live-stream-monitor/runs": {
      "post": {
        "operationId": "runs-sync-sian.agency-youtube-live-stream-monitor",
        "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/sian.agency~youtube-live-stream-monitor/run-sync": {
      "post": {
        "operationId": "run-sync-sian.agency-youtube-live-stream-monitor",
        "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": [
          "operation"
        ],
        "properties": {
          "operation": {
            "title": "🎯 Operation — what do you want to scrape?",
            "enum": [
              "channelLiveStreams",
              "viewerSnapshot"
            ],
            "type": "string",
            "description": "🎯 **PICK ONE OPERATION PER RUN.** Each run produces one clean dataset matching the chosen mode.\n\n- **📺 Channel Live Streams** — pass a channel ID → get the paginated list of currently-live and recently-ended livestreams for that channel, with `streamState` (live / ended), concurrent viewers, titles and thumbnails.\n- **👁 Viewer Count Snapshot** — pass one or more livestream video IDs → get real-time concurrent viewer counts. The **real-time USP** — perfect for polling loops at 1–5 minute intervals.\n\n💡 **TIP:** Start with `Channel Live Streams` to discover currently-live videoIds for a channel. Then feed those IDs into repeated `Viewer Count Snapshot` runs (every N minutes) to build a time series of concurrent viewers per stream.",
            "default": "channelLiveStreams"
          },
          "channelId": {
            "title": "📺 Channel ID or YouTube channel URL",
            "type": "string",
            "description": "📺 **Required for `Channel Live Streams`.**\n\nAccepts any of:\n- Canonical channel ID: `UCSJ4gkVC6NrvII8umztf0Ow`\n- Channel URL: `https://www.youtube.com/channel/UCSJ4gkVC6NrvII8umztf0Ow`\n- Handle URL: `https://www.youtube.com/@LofiGirl`\n- Custom URL: `https://www.youtube.com/c/LofiGirl`\n\n💡 **TIP:** If you paste a handle or custom URL, the actor will resolve it to the canonical channel ID for you (consumes 1 extra upstream call — no extra charge)."
          },
          "videoIds": {
            "title": "👁 Video IDs to snapshot (one per line, or comma-separated)",
            "type": "string",
            "description": "👁 **Required for `Viewer Count Snapshot`.**\n\nOne or more 11-character YouTube video IDs. Each ID is polled with one upstream call → one dataset row with real-time `concurrentViewers`, `streamState`, `likeCount`.\n\nAccepts:\n- One ID per line: `JD-kMIpDfnY\\nEWrX250Zhko`\n- Comma-separated: `JD-kMIpDfnY, EWrX250Zhko`\n- Full URLs: `https://www.youtube.com/watch?v=JD-kMIpDfnY` (the actor will extract the ID)\n\n💡 **TIP:** Combine this with the Apify Scheduler to poll the same set of IDs every N minutes — build a real-time viewer-count time series."
          },
          "maxPages": {
            "title": "📄 Max pages to fetch",
            "minimum": 1,
            "maximum": 25,
            "type": "integer",
            "description": "📄 **Applies to `Channel Live Streams`.** Ignored for `Viewer Count Snapshot`.\n\nMost active channels return all current livestreams on page 1 (~16-30 rows). Channels with many recent ended streams (esports orgs, news networks) may paginate.\n\n- **Channel Live Streams:** ~16-30 streams per page\n\n⚠️ Hard cap: 25 pages to prevent runaway runs.",
            "default": 3
          },
          "geo": {
            "title": "🌍 Country (optional, ISO 3166-1 alpha-2)",
            "type": "string",
            "description": "🌍 **Optional.** Two-letter country code to localize results. Defaults to `US`.\n\nExamples: `US` (United States), `GB` (United Kingdom), `IN` (India), `BR` (Brazil), `DE` (Germany), `JP` (Japan), `KR` (Korea), `MX` (Mexico).",
            "default": "US"
          },
          "lang": {
            "title": "🗣 Language (optional, ISO 639-1)",
            "type": "string",
            "description": "🗣 **Optional.** Two-letter language code for localized labels. Defaults to `en`.\n\nExamples: `en`, `es`, `pt`, `hi`, `ja`, `ko`.",
            "default": "en"
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}