# How to get Twitch watchtime (like streamelements)

**URL:** <https://discuss.dev.twitch.com/t/how-to-get-twitch-watchtime-like-streamelements/31223>\
**Category:** API\
**Created:** [April 11, 2021, 9:34am UTC](https://discuss.dev.twitch.com/t/how-to-get-twitch-watchtime-like-streamelements/31223 "2021-04-11T09:34:57Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![VestalisDE](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/vestalisde/32/11874_2.png) [@VestalisDE](https://discuss.dev.twitch.com/u/VestalisDE)\
**Post date:** [April 11, 2021, 9:34am UTC](https://discuss.dev.twitch.com/t/how-to-get-twitch-watchtime-like-streamelements/31223/1 "2021-04-11T09:34:57Z")

</div>

Hey guys,

I am currently on developing a little [twitch.tv](http://twitch.tv) chatbot. I know, there are like a thousand of them but I would like to create my own, just to have a project - so this is not the point.

I was wondering, how the watchtime of a user could be calculated. Just as [streamelements.com](http://streamelements.com) does it with their `!watchtime` chat command. I did not find any API endpoint to get the users, which are currently viewing the stream. The only thing found is the current viewcount in [https://dev.twitch.tv/docs/api/reference#get-streams](https://dev.twitch.tv/docs/api/reference#get-streams) but there is no way to link to a specific user.

I’ve found a few postings, saying it is not possible but streamelements and other bots are proving this wrong, so I wanted to give it a new try.  
Anyone has any idea?

---

<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:** [April 11, 2021, 10:54am UTC](https://discuss.dev.twitch.com/t/how-to-get-twitch-watchtime-like-streamelements/31223/2 "2021-04-11T10:54:38Z")

</div>

There is no API to get Watch Time.

What bots like SE do is the pull the chatters list of the channel periodically and store that in their database and then calculate the watchtime from that.

It’s not `watchtime` but `time in chat`

See also

> **[Chatters / Viewers Helix API Endpoint](https://twitch.uservoice.com/forums/310213-developers/suggestions/39145294-chatters-viewers-helix-api-endpoint)**
>
> The existing API endpoint for getting chatters predates User IDs and only returns usernames. It's also part of TMI and not officially documented, which could result in it being removed at any point without any notice.
> 
> Many bots use the endpoint for...

---

<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:** [May 11, 2021, 10:54am UTC](https://discuss.dev.twitch.com/t/how-to-get-twitch-watchtime-like-streamelements/31223/3 "2021-05-11T10:54:43Z")

</div>

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