Viewer_count & uptime

Dear Developer Community,
first of all I am not a developer, I am from the upper management level of a company.

We would like to store our livestream uptime (on-air time) and the average count of viewers in a database.

Now we have been told by the developers that the Twitch API cannot retrieve historical data. So how can we retrieve the above data?

Could we make a query every minute and store the data in a local database? How many queries per minute does the Twitch API allow?

Thank you in advance for your help!

You would need to call the Get Streams endpoint https://dev.twitch.tv/docs/api/reference/#get-streams, as this contains the viewer_count, and also will only return stream data while the stream is live so can be used to calculate uptime.

Yes, this is exactly how many apps do it. How frequently you poll the endpoint depends on the needs of your app, although because all Twitch endpoints use caching there is no point requesting the same data faster than once per minute.

The default rate limit is 800 requests per minute, but as I previously mentioned there is caching so just for getting a single streams data there’s no need to use more than 1 request per minute.

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