# Getting view count

**URL:** <https://discuss.dev.twitch.com/t/getting-view-count/22842>\
**Category:** API\
**Created:** [October 15, 2019, 1:14pm UTC](https://discuss.dev.twitch.com/t/getting-view-count/22842 "2019-10-15T13:14:18Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Celsiuss](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/celsiuss/32/7222_2.png) [@Celsiuss](https://discuss.dev.twitch.com/u/Celsiuss)\
**Post date:** [October 15, 2019, 1:14pm UTC](https://discuss.dev.twitch.com/t/getting-view-count/22842/1 "2019-10-15T13:14:18Z")

</div>

I can get the view count by making a GET request to `https://api.twitch.tv/helix/streams`, but I’m looking for a way to get an updated view count as it changes. I don’t really want to make anither GET request on an interval.  
I’ve traversed the docs, but neither the pubsub api or the helix webhook api has anything to offer.

I’ve found an undocumented pubsub topic under the name `video-playback-by-id.some-id`, however I’m not sure how Twitch views the use of undocumented APIs.  
Any inputs on this?

---

<div class="post-metadata">

**Author:** ![Dist](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/dist/32/7192_2.png) [@Dist](https://discuss.dev.twitch.com/u/Dist)\
**Post date:** [October 15, 2019, 1:59pm UTC](https://discuss.dev.twitch.com/t/getting-view-count/22842/2 "2019-10-15T13:59:18Z")

</div>

Polling the streams endpoint is the correct way to get the current view count. Because of caching you should limit polling to around once per minute or slower.

The stream changed webhook topic intentionally does not send notifications for viewer count changes, as this is a design choice by Twitch.

Use of undocumented endpoints can and will break/change at any time and without prior warning, and this does happen from time to time so general advice is don’t use undocumented pubsub topics for anything critical or long lasting.

---

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [October 15, 2019, 3:41pm UTC](https://discuss.dev.twitch.com/t/getting-view-count/22842/3 "2019-10-15T15:41:37Z")

</div>

> [@Celsiuss](#):
>
> I’ve found an undocumented pubsub topic under the name `video-playback-by-id.some-id` , however I’m not sure how Twitch views the use of undocumented APIs.

And you can _only_ subscribe to so many topics on pubsub.

So your best bet is to poll the API every minute.

---

<div class="post-metadata">

**Author:** ![Celsiuss](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/celsiuss/32/7222_2.png) [@Celsiuss](https://discuss.dev.twitch.com/u/Celsiuss)\
**Post date:** [October 15, 2019, 8:37pm UTC](https://discuss.dev.twitch.com/t/getting-view-count/22842/4 "2019-10-15T20:37:53Z")

</div>

Alright thanks! It just seems weird to poll the API every so often, but oh well.

---

<div class="post-metadata">

**Author:** ![system](https://d2opxh93rbxzdn.cloudfront.net/original/2X/0/05909729875cce3b53e59d5561c4d23bb14948fc.png) [@system](https://discuss.dev.twitch.com/u/system)\
**Post date:** [November 14, 2019, 8:37pm UTC](https://discuss.dev.twitch.com/t/getting-view-count/22842/5 "2019-11-14T20:37:54Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
