Contents

Get Started with the Twitch API

Introduction

The Twitch API provides tools for developing integrations with Twitch. Here, as a quick example to get you started, we make a basic request to get the top streams for a specific game, using the Search Channels endpoint.

Step 1: Setup

To make API calls, you need a client ID. To receive one, log into the Twitch developer console, select the Apps tab, and click Register Your Application. Enter an app name and your OAuth redirect URI (where your users are redirected after being authorized), and select an app category. Click Create, and the app is created and listed on the dashboard as one of your registered apps. Click Manage to see the client ID.

For more information about authentication see the Authentication Guide.

Note: App names must not include “Twitch” (as an exact or fuzzy match), or registration will fail.

Step 2: Sample Code

This request searches to see if A Seagull is live:

curl --location --request
GET 'https://api.twitch.tv/helix/search/channels?query=a_seagull' \
--header 'client-id: wbmytr93xzw8zbg0p1izqyzzc5mbiz' \
--header 'Authorization: Bearer 2gbdx6oar67tqtcmt49t3wpcgycthx'

This example uses a sample client ID. To try it out, copy and paste the example into your terminal, replacing the sample client ID with your client ID.

Step 3: Response

The response shows that the channel is live:

{
    "data": [
        {
            "broadcaster_language": "en",
            "display_name": "a_seagull",
            "game_id": "506442",
            "id": "19070311",
            "is_live": true,
            "tags_ids": [
                "6ea6bca4-4712-4ab9-a906-e3336a9d8039"
            ],
            "thumbnail_url": "https://static-cdn.jtvnw.net/jtv_user_pictures/a_seagull-profile_image-4d2d235688c7dc66-300x300.png",
            "title": "a_seagull",
            "started_at": "2020-03-18T17:56:00Z"
        }
    ],
    "pagination": {}
}

For descriptions of the response fields, see Search Channels.

What’s Next

For more information on the API (including webhooks), see:

See the Apps & Authentication Guide for information about using Twitch Authentication, which enables your application to take actions on behalf of a Twitch account or access certain data about a user’s account. Twitch supports OAuth 2.0 and OIDC.

Stop by our Developer Forums to join our community of Twitch developers.