Twitch Analytics Endpoint 401 Error

I was wondering if anyone has been successful with the analytics endpoint. I cannot seem to get my code to work. I am able to successfully use my other functions to return games, users, etc…

 import requests

 def getAnalytics(gameId):
        header = {"Client-ID": "my-client-id"}
	    endpoint = 'https://api.twitch.tv/helix/analytics/games?game_id='+gameId
	    request = requests.get(endpoint, headers = header)
	    print(request)

A 401 would indicate you’re not using an authentication token, or the token you’re using lacks the required scope.

So can you make sure you’re using a token with the analytics:read:games scope and granted by the developers for the game you’re attempting to get analytics data for.

AKA the oAuth token has to be from the people that OWN the game.

Only the owners of a given game_id can get their analytics for their game.

1 Like

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