# Twitch Channel API - followers, live status & stats (`stas_k/twitch-channel-api`) Actor

Half the channel numbers scraped off Twitch are stale or missing: a channel that went dark still looks live and last-stream dates vanish. This actor asks Twitch's own public API for followers, live status, viewers and last broadcast, one row per channel. An unknown login costs nothing.

- **URL**: https://apify.com/stas_k/twitch-channel-api.md
- **Developed by:** [Stas K](https://apify.com/stas_k) (community)
- **Categories:** Social media, Developer tools, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 1 bookmarks
- **User rating**: No ratings yet

## Pricing

$1.00 / 1,000 channels

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Twitch Channel API

One row per public Twitch channel: who it is, how many followers it has, whether it is live
right now, how many people are watching and when it last went on air.

The source is Twitch's own public web API, the same one the site calls. No login, no token,
no scraping of the directory pages.

### What you get

Send a login (`shroud`), an `@handle` or a full channel link (`https://www.twitch.tv/pokimane`),
one per line. Every channel the source really answers becomes one row:

| field | meaning |
|---|---|
| `login` | the channel login the source confirmed (lower case) |
| `displayName` | the name Twitch shows |
| `id` | the numeric channel id |
| `url` | `https://www.twitch.tv/<login>` |
| `followers` | follower count as a number |
| `isLive` | true when the channel is streaming right now |
| `viewers` | current viewers, or `null` when the channel is offline |
| `streamStartedAt` | when the current stream started, ISO 8601 in UTC, or `null` |
| `lastBroadcastAt` | when the channel last went on air, ISO 8601 in UTC |
| `createdAt` | when the channel was created, ISO 8601 in UTC |
| `description` | the channel description, as published |
| `actorInput` | the line you sent, kept so a row can be traced back to your input |
| `actorIndex` | the position of that line in your list |

Twenty channels travel in one request, because the source answers batches. That is why a run
of two hundred channels takes about five seconds and not five minutes.

### What costs money

One delivered channel is one paid event, price `$0.001`.

Free, with a reason in the row and no channel data:

- `NOT_FOUND`: the source does not know that login.
- `INVALID_INPUT`: the line is not a channel (an empty line, a directory page such as
  `twitch.tv/directory`, a video page).
- `DUPLICATE`: the same channel arrived more than once (a login, an `@handle` and a link to
  the same channel are one channel, and only the first one is paid).
- `NOT_CHECKED_CAP`: the line was cut by `maxChannels`, by the time budget or by the spending
  limit before any request.
- `NOT_CHECKED_ERROR`: the source could not be read; this is a state of the source, not a
  verdict about your channel, and nothing is charged.

### Input

```json
{
  "channels": ["shroud", "@pokimane", "https://www.twitch.tv/xqc"],
  "maxChannels": 25
}
```

`maxChannels` defaults to 25 and can go up to 500. A value the source does not publish is
`null`, never invented: an offline channel shows `viewers: null` and not `0`, because zero
viewers and no broadcast are different facts.

### What this actor does not do

- It does not read chat, clips, videos or the follower list of a channel.
- It does not page through a directory: you name the channels, it reads them.
- It does not tell you why a channel is missing from Twitch: a login the source does not know
  is `NOT_FOUND` and nothing more.
- It does not guess: a login that is close to a real one is `NOT_FOUND` with the exact login
  you sent, so you can fix the line instead of paying for someone else's channel.

### Rate limits

The source answers twenty channels per request in well under a second. A batch that comes back
with HTTP 429 is retried once after the pause the source asks for; the counter `throttled` is
not used here because a retry never costs a channel. Two hundred channels in a row were read
without a single 429 in our measurement (16.11.2026).

### Data source

Public Twitch GQL endpoint, `https://gql.twitch.tv/gql`, with the public web client id. This
actor is not affiliated with or endorsed by Twitch.

# Actor input Schema

## `channels` (type: `array`):

A login (shroud), an @handle or a full channel link (https://www.twitch.tv/pokimane), one per line. Directory pages such as twitch.tv/directory and twitch.tv/videos are refused with a reason and cost nothing. The last line of the default list is a login nobody owns, so it comes back free.

## `maxChannels` (type: `integer`):

How many channels this run reads. Lines beyond the number come back as free NOT_CHECKED_CAP rows with a reason.

## Actor input object example

```json
{
  "channels": [
    "shroud",
    "pokimane",
    "xqc",
    "https://www.twitch.tv/kaicenat",
    "zzz_no_such_channel_9x"
  ],
  "maxChannels": 25
}
```

# Actor output Schema

## `dataset` (type: `string`):

One row per channel. A paid row carries login, displayName, id, url, followers, isLive, viewers (null when the channel is offline), streamStartedAt, lastBroadcastAt, createdAt, description, actorInput, actorIndex and source. Dates are ISO 8601 in UTC. A login the source does not know, a line that is not a channel and a channel cut by maxChannels or by time are never paid rows: they come back as free NOT_FOUND, INVALID_INPUT, NOT_CHECKED_CAP or NOT_CHECKED\_\* rows with a reason and no channel data. Status rows are written in batches, so sort by actorIndex to get the input order back. A value the source does not publish is null, never invented.

## `summary` (type: `string`):

Counters of the run: requested, attempted, delivered, rowsWritten, chargedEvents, itemsDelivered, deliveredUncharged, deliveredUnverified, chargeUncertain, writeErrors, cappedNotCharged, channelsNotFound, channelsInvalid, channelsDuplicate, cutByDeadline, cutByStop, cutByLimit, byStatus, counterMismatch, stopReason, datasetNote, firstFailure, billingActive, priceNote, eventName, maxChannels, source, startedAt, finishedAt and runId. The bare RUN_SUMMARY lives in the default store of the run; a copy under RUN_SUMMARY-<runId> is kept in the named store twitch-channel-summary, so two runs do not overwrite each other.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "channels": [
        "shroud",
        "pokimane",
        "xqc",
        "https://www.twitch.tv/kaicenat",
        "zzz_no_such_channel_9x"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("stas_k/twitch-channel-api").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "channels": [
        "shroud",
        "pokimane",
        "xqc",
        "https://www.twitch.tv/kaicenat",
        "zzz_no_such_channel_9x",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("stas_k/twitch-channel-api").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "channels": [
    "shroud",
    "pokimane",
    "xqc",
    "https://www.twitch.tv/kaicenat",
    "zzz_no_such_channel_9x"
  ]
}' |
apify call stas_k/twitch-channel-api --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,stas_k/twitch-channel-api"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/RKdDTxY0kdMiq6PSB/builds/9msDKaW927yV5E971/openapi.json
