Skip to main content

API - Helix

To make an application that uses the Twitch API, you first need to register your application on the Twitch developer site. When creating this app, enter your redirect URI, which is where your users are redirected after being authorized.

Once you create a developer application, you are assigned a client ID. Some authentication flows also require a client secret, which you can generate on the same page as the client ID.

  • Client IDs are public and can be shared (for example, embedded in the source of a Web page).
  • Client secrets are equivalent to a password for your application and must be kept confidential. Never expose it to users, even in an obscured form.

Because your client secret is confidential, we cannot show it to you once you leave the page, so make sure to record it somewhere safe. Also, generating a new client secret immediately invalidates the current one, which might make your API requests fail until your app is updated.

Warning: Client IDs should be unique for each application: do not re-use client IDs across multiple applications. Also, applications should request the appropriate set of scopes for the intended target APIs. Failure to adhere to these guidelines may result in the suspension of your application’s access to the Twitch API.

You can create new application on the Twitch Developer Console

To obtain user access tokens, you will need need to undergo an OAuth2 flow (excluding the client credentials flow): https://dev.twitch.tv/docs/authentication/getting-tokens-oauth/ Alternatively, it can be easier to utilize a generator website like https://twitchtokengenerator.com (if you use their client id, the token will not expire). User access tokens can be passed as the first argument to any TwitchHelix method, or you can specify withDefaultAuthToken(OAuth2Credential) on a module builder.

info

We recommend you utilize our JavaDocs for more updated documentation regarding the Helix API module.

As Module: Twitch4J

To use Helix you need to enable the Helix API when building the Twitch4J Instance, as shown below:

TwitchClient twitchClient = TwitchClientBuilder.builder()
...
.withEnableHelix(true)
...
.build();

Standalone

Initialize the Helix API as Standalone Module:

TwitchHelix client = TwitchHelixBuilder.builder()
.withClientId("clientId")
.withClientSecret("clientSecret")
.build();

API Methods

note

The following list is incomplete; Twitch4J implements all Helix endpoints, which is reflected in our javadocs.

Analytics:

Bits:

Clips:

Entitlements:

Games:

Moderation:

Streams:

Subscriptions:

Users:

Videos: