Get active subscription information

I want to use Twitch’s API to check whether a user’s subscription is active or not.

  1. To fetch the user, I used:
    ***https://api.twitch.tv/helix/users?login=<USERNAME>***
    The response includes an id in the data, which I believe is the Broadcaster ID, correct?
    SS:- Screenshot-from-2024-11-25-16-16-14-png-1366×768-11-25-2024_04_18_PM-png-1306×583--11-25-2024_04_31_PM.png - Google Drive

  2. Then, I passed that id to:
    `https://api.twitch.tv/helix/subscriptions/?broadcaster_id=id
    SS:- Screenshot-from-2024-11-25-16-23-58-png-1366×768--11-25-2024_04_29_PM.png - Google Drive
    However, the result I’m getting is empty.

Please also let me know if the ID I am using as the Broadcaster ID is correct or not. If it is incorrect, please advise me where I can get the correct Broadcaster ID.

Am I doing something wrong in this flow? If yes, please guide me.

That’ll be the ID of the login you request to look up

So if you want to look up the subscribers of cohhcarnage first I’ll need cohhcarnage Twitch ID via calling Get Users

I’d call https://api.twitch.tv/helix/users?login=cohhcarnage which would return an ID of 26610234

Then to get cohhcarnage subscribers I pass that to Get Broadcaster Subscriptions

https://api.twitch.tv/helix/subscriptions?broadcaster_id=26610234

To Get if I barrycarlyon is a subscriber of cohhcarnage

Get Users - https://api.twitch.tv/helix/users?login=barrycarlyon for an ID of 15185913

And thus to 1 to 1 subscriber lookup is https://api.twitch.tv/helix/subscriptions?broadcaster_id=26610234&user_id=15185913

That’ll return an data array of one or no items to represent if barrycarlyon is a paid subscriber of cohhcarnage

The calls to Get users will take any token the call to Get Broadcaster Subscriptions assumes you are using a token for the broadcaster with the relevant scopes (ignoring Twitch Extension Clients here for simplicity)

You omitted/censored the ID’s so I can’t help to see what/whom you’ve called

Your screenshot suggests you convert a login to an ID and that user doens’t have any subscriptions

This indicates you

  • converted a login to an ID
  • got a token for that ID with the required scopes
  • called get broadcaster subscriptions with that token and the ID and no results were returned indicating the user id in the broadcaster_id key has no subscribers (or is not enrolled in the subscribers program)

As shown in the first screenshot the broadcaster_type is blank, so you are getting a blank response as they can’t have subscribers

Your approach is correct, just the user you looked up cannot have paid subscribers and thus doesn’t have any paid subscribers