Skip to content

Repository files navigation

Twitch API v2

Overview

The Twitch API enables you to develop your own applications using the rich feature set that we provide. Features include retrieving data about what streams are live, changing information about specific channels, and doing an SSO integration with Twitch. The following pages list the resources that the Twitch API provides. If you have any questions or need help in using this API, please visit the API Developers Group or Github Issues.

The Twitch API is comprised of two parts: the REST API and a JavaScript SDK that allows for easy integration of the Twitch features into any website. Most users will only need to use the JS SDK, but if you want a deeper integration (for example, for use with Python or PHP scripts), you may access the REST API directly. The RESTful Integration Guide provides additional information for using REST API.

API Versions and MIME Types

The current stable API version is v2. We allow clients to use any version of our API. Versioning is per-method so for example you can have v1 of /channels and v2 of /users.

We strongly recommend specifying a version, otherwise version updates might break your application if you've defaulted your requests to use the latest version.

When specifying a version for a request to the Twitch API, set the Accept HTTP header to the API version you prefer. This is done by appending a version specifier to our vendor specific MIME type. Responses will have an x-api-version header that will indicate which version you received.

You should specify the following MIME type:

application/vnd.twitchtv[.version]+json

The returned MIME type from requests is always

application/json
#### Example Requests

Specify a specific version (v2):

curl -i -H 'Accept: application/vnd.twitchtv.v2+json' 'https://api.twitch.tv/kraken/channels/hebo?client_id=axjhfp777tflhy0yjb5sftsil' HTTP/1.1 200 OK
...
x-api-version: 2
...
Front-End-Https: on
{ ...

The base URL for all API resources is https://api.twitch.tv/kraken.

All data is sent and received as JSON. Blank fields are included as null instead of being omitted.

JSON-P

All API methods support JSON-P by providing a callback parameter with the request.

curl -i https://api.twitch.tv/kraken?callback=foo

Self-Describing API

The API is self-describing and can be explored from the base URL:

curl -i https://api.twitch.tv/kraken

Every JSON response includes a _links object which allows you to navigate the API without having to hardcode any of our URLs.

{
"_links": {
"teams": "https://api.twitch.tv/kraken/teams",
"channel": "https://api.twitch.tv/kraken/channel",
"user": "https://api.twitch.tv/kraken/user",
"ingests": "https://api.twitch.tv/kraken/ingests",
"streams": "https://api.twitch.tv/kraken/streams",
"search": "https://api.twitch.tv/kraken/search"
},
...
}

Errors

All error responses are in the following format, delivered with the corresponding status code:

{
"message":"Invalid Token",
"status":401,
"error":"Unauthorized"
}

When using JSON-P, the status code will always be 200 to allow browsers to parse it. Check the body of the response for the actual error data.

Rate Limits

We require you to send your application's client_id with every request you make to ensure that your application is not rate limited. You should do so by sending the following HTTP header:

Client-ID: <client_id>
## Authentication

We use an OAuth 2.0, an authentication protocol designed to make accessing user accounts from third party clients easy and secure. Read our authentication guide to see how to connect with Twitch users from your own service.

Index

EndpointDescription
GET /users/:login/blocksGet user's block list
PUT /users/:user/blocks/:targetUpdate user's block list
DELETE /users/:user/blocks/:targetDelete target from user's block list
EndpointDescription
GET /channels/:channelGet channel object
GET /channelGet channel object
GET /channels/:channel/editorsGet channel's list of editors
PUT /channels/:channelUpdate channel object
GET /channels/:channel/videosGet channel's list of videos
GET /channels/:channel/followsGet channel's list of following users
DELETE /channels/:channel/stream_keyReset channel's stream key
POST /channels/:channel/commercialStart a commercial on channel
EndpointDescription
GET /chat/:channelGet links object to other chat endpoints
GET /chat/emoticonsGet list of every emoticon object
EndpointDescription
GET /channels/:channel/followsGet channel's list of following users
GET /users/:user/follows/channelsGet a user's list of followed channels
GET /users/:user/follows/channels/:targetGet status of follow relationship between user and target channel
PUT /users/:user/follows/channels/:targetFollow a channel
DELETE /users/:user/follows/channels/:targetUnfollow a channel
EndpointDescription
GET /games/topGet games by number of viewers
EndpointDescription
GET /ingestsGet list of ingests

[Root] (/v2_resources/root.md)

EndpointDescription
GET /Get top level links object and authorization status
EndpointDescription
GET /search/streamsFind streams
GET /search/gamesFind games
EndpointDescription
GET /streams/:channel/Get stream object
GET /streamsGet stream object
GET /streams/featuredGet a list of featured streams
GET /streams/summaryGet a summary of streams
GET /streams/followedGet a list of streams user is following
EndpointDescription
GET /channels/:channel/subscriptionsGet list of users subscribed to channel
GET /channels/:channel/subscriptions/:userCheck if channel has user subscribed
EndpointDescription
GET /teamsGet list of active team objects
GET /teams/:teamGet team object
EndpointDescription
GET /users/:userGet user object
GET /userGet user object
GET /streams/followedGet list of streams user is following
EndpointDescription
GET /videos/:idGet video object
GET /videos/topGet top videos by number of views
GET /channels/:channel/videosGet list of video objects belonging to channel

githalytics.com alpha

About

A home for details about our API

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors