Twitch Helix API: How to format URL requests?

Hey everyone! I’m trying to figure out the new Twitch Helix API. I used to work with the old V5 API using URL requests, not cURL. Now I’m stuck on how to format the URLs for Helix.

I tried this for getting followers:

https://api.twitch.tv/helix/users/follows?to_id=123456789

But I keep getting an ‘Unauthorized’ error. It says I need to provide a valid Client-ID or OAuth token.

In V5, I’d add these at the end of the URL like this:

https://api.twitch.tv/kraken/something?client_id=abc123&oauth_token=xyz789

I tried adding them to the Helix URL with ‘&’ but it didn’t work. I also tried putting them before the ‘to_id’ parameter, but no luck.

Can anyone help me understand how to format URLs for the Helix API? I feel like I’m missing something obvious. Thanks!

hey surfingwave, i had the same issue! for helix, you gotta put the client-id and oauth token in the request headers, not the url. use ‘Client-ID’ and ‘Authorization’ headers. the Authorization header should be like ‘Bearer your_oauth_token’. hope this helps!

I’ve been working with the Helix API for a while now and understand the challenges that come with the change from V5. The major shift is that authentication information is no longer appended to the URL; it must be included in the request headers. Your URL stays as https://api.twitch.tv/helix/users/follows?to_id=123456789, while your Client-ID and the Bearer token (in the Authorization header) carry the necessary credentials. It also helps to check that your OAuth token is recent and that you’re using the correct token type, as a mismatch can lead to unauthorized errors.

This approach has made my implementation more predictable.

I’ve been working with the Helix API recently and can confirm that the authentication method has considerably changed compared to the V5 API. Instead of appending your client ID and OAuth token to the URL, you need to include them as request headers. Use the ‘Client-ID’ header for your client ID and the ‘Authorization’ header with the value ‘Bearer your_oauth_token’ for the token. For instance, with the endpoint GET https://api.twitch.tv/helix/users/follows?to_id=123456789, set the headers accordingly. Make sure that your OAuth token has the proper scopes and your credentials are valid to avoid unauthorized errors.

yo surfingwave, im with ya. helix can be weird at first. the trick is to ditch query parameters and set auth headers only. use ‘client-id’ and ‘authorization’ with bearer token. once you sort that, it gets easier. good luck!

I’ve encountered similar issues when transitioning to Helix. The key difference is that authentication parameters are now sent in request headers, not the URL. Your base URL remains correct:

https://api.twitch.tv/helix/users/follows?to_id=123456789

Then, add two headers to your request:
‘Client-ID’: Your client ID
‘Authorization’: ‘Bearer your_oauth_token’

Ensure your OAuth token is valid and has the necessary scopes. Also, double-check that you’re using an App Access Token or User Access Token, not a deprecated OAuth client token.

This change enhances security by keeping sensitive information out of URLs. Once you adapt to this new method, you’ll find Helix quite straightforward to use.