# Viewcount for Games/Categories

**URL:** <https://discuss.dev.twitch.com/t/viewcount-for-games-categories/28475>\
**Category:** API\
**Created:** [October 5, 2020, 6:33pm UTC](https://discuss.dev.twitch.com/t/viewcount-for-games-categories/28475 "2020-10-05T18:33:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![TeaTime](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/teatime/32/10394_2.png) [@TeaTime](https://discuss.dev.twitch.com/u/TeaTime)\
**Post date:** [October 5, 2020, 6:33pm UTC](https://discuss.dev.twitch.com/t/viewcount-for-games-categories/28475/1 "2020-10-05T18:33:27Z")

</div>

Regarding [https://dev.twitch.tv/docs/api/reference#get-top-games](https://dev.twitch.tv/docs/api/reference#get-top-games) AND [https://dev.twitch.tv/docs/v5/reference/games#get-top-games](https://dev.twitch.tv/docs/v5/reference/games#get-top-games)

Is there ANY way to get a viewcount for a category in the current api?  
I know you can just use the Legacy Twitch API v5, but I want to be future proof.

---

<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 5, 2020, 6:42pm UTC](https://discuss.dev.twitch.com/t/viewcount-for-games-categories/28475/2 "2020-10-05T18:42:20Z")

</div>

You would need to use the Get Streams endpoint [https://dev.twitch.tv/docs/api/reference#get-streams](https://dev.twitch.tv/docs/api/reference#get-streams) with the `game_id` param for the game you wish to know the viewer count of, and page through the streams and sum the results yourself.

Game developers can access the Get Game Analytics endpoint [https://dev.twitch.tv/docs/api/reference/#get-game-analytics](https://dev.twitch.tv/docs/api/reference/#get-game-analytics) which will give accurate data, but for 3rd party developers the only option is to page through the Get Streams endpoint which is inherently inaccurate so you will always have some degree of error.

---

<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 5, 2020, 7:15pm UTC](https://discuss.dev.twitch.com/t/viewcount-for-games-categories/28475/3 "2020-10-05T19:15:25Z")

</div>

> [@Dist](#):
>
> You would need to use the Get Streams endpoint [Reference | Twitch Developers](https://dev.twitch.tv/docs/api/reference#get-streams) with the `game_id` param for the game you wish to know the viewer count of, and page through the streams and sum the results yourself.

Here is an example to demonstrate the logic

[https://barrycarlyon.github.io/twitch\_misc/examples/browse\_categories/](https://barrycarlyon.github.io/twitch_misc/examples/browse_categories/)

Uses implict auth for demo purposes

---

<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 4, 2020, 7:15pm UTC](https://discuss.dev.twitch.com/t/viewcount-for-games-categories/28475/4 "2020-11-04T19:15:27Z")

</div>

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