Get Twitch Stream Viewer Count by Channel Login
View all Twitch Channel, Clips, Videos & Stream Data endpoints →Returns the viewer-count information available for the current stream of one Twitch channel, as a snapshot taken at request time. Input: channel (required) is the channel login shown in the public Twitch URL, for example ninja, not a display title. Observed in a live probe for channel ninja while the channel was offline: HTTP 200 with the standard envelope {status, request_id, message, data}; status was 'ok', message was null, and data.user held id (a string), stream set to null and __typename 'User'. With a null stream there was no viewer figure in the response, which is a documented valid result. The populated live-stream branch was not observed in the probe, so the name of the viewer-count field is not documented here; inspect a response from a live channel before mapping it, and keep a missing value distinct from numeric zero. The number is the audience of the current stream, which is different from historical video views or total channel followers. The operation provides no audience history or time series, so record your own retrieval timestamp with every snapshot.
API Features
Live API Demo
🔒 Sign in to try it live
Log in to call this API with your own API key. New accounts get 100 free credits — no card required.
Log in / Sign upNo active API key found. Create one in your Dashboard, then reload this page. Dashboard →
/api/project/twitch-scraper/get-stream-viewer-count API Response (JSON)
{} curl -X GET 'https://api.opendata-api.com/api/project/twitch-scraper/get-stream-viewer-count?key=<API_KEY>&channel=ninja'
Query Result
Use Cases
- Write (channel, timestamp, viewers) rows every few minutes to compute peak and average audience later
- Audit a sponsored hour by sampling the streamer's viewers in the agreed window and keeping offline samples as NULL
- Raise a spike alert when a tracked channel's viewer snapshot jumps well above its recent samples
- Rank a small tracked roster by latest viewer snapshot and list offline channels in a separate section
- Design a schema that keeps live stream viewers apart from historical video views and total followers
Frequently asked questions
What does the viewer count call return for an offline channel?
In the probe for channel ninja the channel was offline and the response was status 'ok' with a null message and data.user.stream set to null. No viewer figure was present, so treat the value as unavailable rather than zero.
What is the name of the viewer-count field when a channel is live?
The populated live-stream branch was not observed in the probe, so the field name is not documented here. Call the endpoint while the channel is broadcasting and read the field from data.user.stream before you build your schema.
How do I record an offline sample?
Store NULL (or a separate offline flag) with the retrieval timestamp. Keep an absent or unavailable value distinct from numeric zero, because zero would claim that a live stream had no viewers.
Is this the same as total views or followers?
No. It reflects the audience of the current stream, which is different from historical video views and from the follower total returned by Get Channel Details. Keep them in separate columns.
Can I get viewer history or a time series from this endpoint?
No. It is a snapshot at request time and does not provide historical audience trends. Poll on your own schedule and store each result with the time you retrieved it.
Does the viewer count update in real time?
Treat it as a point-in-time value at the moment of the call. Channel offline status or Twitch availability can affect the result, so sample at an interval that suits your use case and do not assume continuity between calls.
What do I pass as the channel parameter?
Pass the channel login from the public Twitch URL, for example ninja. If you only know a display name, find the login with Search Channels first and reuse it here.