{
  "openapi": "3.0.1",
  "info": {
    "title": "Twitch Scraper — Streams, Channels & Directory",
    "description": "Scrape Twitch (twitch.tv) live streams, channels & directories into clean structured data — viewers, followers, categories, clips, archive videos. Browse a category, search channels, or pull full channel profiles. JSON/CSV, no login or API key.",
    "version": "1.0",
    "x-build-id": "EKdrF1eZQeM8WK50p"
  },
  "servers": [
    {
      "url": "https://api.apify.com/v2"
    }
  ],
  "paths": {
    "/acts/sian.agency~twitch-scraper/run-sync-get-dataset-items": {
      "post": {
        "operationId": "run-sync-get-dataset-items-sian.agency-twitch-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/sian.agency~twitch-scraper/runs": {
      "post": {
        "operationId": "runs-sync-sian.agency-twitch-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/sian.agency~twitch-scraper/run-sync": {
      "post": {
        "operationId": "run-sync-sian.agency-twitch-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": {
          "scrapeMode": {
            "title": "🧭 Scrape Mode",
            "enum": [
              "overview",
              "detail"
            ],
            "type": "string",
            "description": "**OVERVIEW** = cheap list mode. Get many live streams for a category, or search channels by keyword — fast, high-volume rows.\n\n**DETAIL** = full mode. Give specific channels (logins / channel URLs) and get the complete record — follower count, account age, partner/affiliate status, current live stream, last broadcast, recent clips, and optionally archive videos.",
            "default": "overview"
          },
          "sourceType": {
            "title": "📁 Overview Source (Overview mode)",
            "enum": [
              "directory",
              "search"
            ],
            "type": "string",
            "description": "In **Overview** mode, choose the list source:\n- **Directory** — live streams for a game/category (e.g. `VALORANT`, `Just Chatting`), sorted by viewers\n- **Search** — channels matching a text keyword\n\nIgnored in Detail mode.",
            "default": "directory"
          },
          "game": {
            "title": "🎮 Single Category / Game (Directory overview)",
            "type": "string",
            "description": "**DIRECTORY OVERVIEW:** A Twitch category or game name to pull live streams for. Sorted by viewers.\n\n**Examples:** `VALORANT`, `Just Chatting`, `League of Legends`, `Grand Theft Auto V`\n\n💡 **TIP:** Use the exact category name as shown on Twitch — the directory resolves the canonical name automatically.",
            "default": "VALORANT"
          },
          "games": {
            "title": "🚀 Bulk Categories / Games (Directory overview)",
            "uniqueItems": true,
            "type": "array",
            "description": "**BULK DIRECTORY:** Pull live streams for several categories in one go — each is fetched separately and all results land in the same dataset.\n\n**TIER-BASED LIMITS:**\n- **FREE users:** results capped per run\n- **PAID users:** unlimited\n\n💡 Click **Bulk edit** to paste one category per line.",
            "items": {
              "type": "string"
            }
          },
          "directoryUrl": {
            "title": "🔗 Directory URL (Directory overview, optional)",
            "type": "string",
            "description": "Paste a Twitch directory URL instead of a category name — the sort filter in the query string is preserved.\n\n**Example:** `https://www.twitch.tv/directory/category/valorant`\n\nWhen provided, this overrides the Category fields."
          },
          "searchTerm": {
            "title": "🔎 Search Term (Search overview)",
            "type": "string",
            "description": "**SEARCH OVERVIEW:** A keyword to search Twitch channels for. Returns matching channels with follower counts and live-stream status.\n\n**Examples:** `valorant`, `chess`, `speedrun`, `music`"
          },
          "searchTerms": {
            "title": "🚀 Bulk Search Terms (Search overview)",
            "uniqueItems": true,
            "type": "array",
            "description": "**BULK SEARCH:** Run several channel searches in one go — each term is searched separately and all results land in the same dataset.\n\n**TIER-BASED LIMITS:**\n- **FREE users:** results capped per run\n- **PAID users:** unlimited\n\n💡 Click **Bulk edit** to paste one term per line.",
            "items": {
              "type": "string"
            }
          },
          "searchUrl": {
            "title": "🔗 Search URL (Search overview, optional)",
            "type": "string",
            "description": "Paste a Twitch search URL instead of a term.\n\n**Example:** `https://www.twitch.tv/search?term=valorant`\n\nWhen provided, this overrides the Search Term fields."
          },
          "channel": {
            "title": "👤 Single Channel (Detail mode)",
            "type": "string",
            "description": "**DETAIL MODE:** A Twitch channel to fetch in full. Accepts a login or a channel URL.\n\n**Examples:**\n- `xqc`\n- `@xqc`\n- `https://www.twitch.tv/xqc`"
          },
          "channels": {
            "title": "🚀 Bulk Channels (Detail mode)",
            "uniqueItems": true,
            "type": "array",
            "description": "**BULK DETAIL:** A list of channels (logins / channel URLs) to fetch in full.\n\n**TIER-BASED LIMITS:**\n- **FREE users:** results capped per run\n- **PAID users:** unlimited\n\n💡 Click **Bulk edit** to paste one channel per line.",
            "items": {
              "type": "string"
            }
          },
          "includeVideos": {
            "title": "🎬 Also Pull Archive Videos (Detail mode)",
            "type": "boolean",
            "description": "In **Detail** mode, also fetch each channel's recent archive videos (past broadcasts) with view counts, duration and game. Adds the videos to each channel record.",
            "default": false
          },
          "clipsFirst": {
            "title": "🔢 Clips Per Channel (Detail mode)",
            "minimum": 0,
            "maximum": 100,
            "type": "integer",
            "description": "How many recent clips to fetch per channel in Detail mode.",
            "default": 20
          },
          "videosFirst": {
            "title": "🔢 Videos Per Channel (Detail mode)",
            "minimum": 1,
            "maximum": 100,
            "type": "integer",
            "description": "How many archive videos to fetch per channel when **Also Pull Archive Videos** is on.",
            "default": 20
          },
          "sort": {
            "title": "↕️ Stream Sort (Directory overview)",
            "enum": [
              "VIEWER_COUNT",
              "VIEWER_COUNT_ASC",
              "RECENT"
            ],
            "type": "string",
            "description": "Order for **directory** streams: by viewer count (high→low), viewer count ascending (low→high), or most recent.",
            "default": "VIEWER_COUNT"
          },
          "languages": {
            "title": "🌐 Stream Languages (Directory overview)",
            "uniqueItems": true,
            "type": "array",
            "description": "Restrict directory streams to one or more broadcast language codes, e.g. `en`, `es`, `fr`, `de`, `pt`. Leave empty for all languages.",
            "items": {
              "type": "string"
            }
          },
          "maxResults": {
            "title": "🔢 Max Records Per Run",
            "minimum": 1,
            "type": "integer",
            "description": "Hard cap on the total records saved this run. **FREE** runs are capped at 25 regardless of this value; **PAID** runs are unlimited.",
            "default": 100
          },
          "maxPages": {
            "title": "📄 Max Directory Pages",
            "minimum": 1,
            "maximum": 10,
            "type": "integer",
            "description": "How many directory pages to fetch per category (up to ~30 streams each). Page 1 is always available; deeper pagination may be gated by Twitch and stops cleanly.",
            "default": 1
          }
        }
      },
      "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
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}