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.
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
Specify a specific version (v2):
curl -i -H 'Accept: application/vnd.twitchtv.v2+json'\
-H 'Client-ID: axjhfp777tflhy0yjb5sftsil'\
'https://api.twitch.tv/kraken/channels/hebo'
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.
All API methods support JSON-P by providing a callback
parameter with the request.
curl -i https://api.twitch.tv/kraken?callback=foo
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"
},
...
}
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.
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>
Please review our Terms of Service for the Twitch API.
## AuthenticationWe 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.
Endpoint | Description |
---|---|
GET /users/:login/blocks | Get user's block list |
PUT /users/:user/blocks/:target | Update user's block list |
DELETE /users/:user/blocks/:target | Delete target from user's block list |
Endpoint | Description |
---|---|
GET /channels/:channel | Get channel object |
GET /channel | Get channel object |
GET /channels/:channel/editors | Get channel's list of editors |
PUT /channels/:channel | Update channel object |
GET /channels/:channel/videos | Get channel's list of videos |
GET /channels/:channel/follows | Get channel's list of following users |
DELETE /channels/:channel/stream_key | Reset channel's stream key |
POST /channels/:channel/commercial | Start a commercial on channel |
Endpoint | Description |
---|---|
GET /chat/:channel | Get links object to other chat endpoints |
GET /chat/emoticons | Get list of every emoticon object |
Endpoint | Description |
---|---|
GET /channels/:channel/follows | Get channel's list of following users |
GET /users/:user/follows/channels | Get a user's list of followed channels |
GET /users/:user/follows/channels/:target | Get status of follow relationship between user and target channel |
PUT /users/:user/follows/channels/:target | Follow a channel |
DELETE /users/:user/follows/channels/:target | Unfollow a channel |
Endpoint | Description |
---|---|
GET /games/top | Get games by number of viewers |
Endpoint | Description |
---|---|
GET /ingests | Get list of ingests |
Endpoint | Description |
---|---|
GET / | Get top level links object and authorization status |
Endpoint | Description |
---|---|
GET /search/streams | Find streams |
GET /search/games | Find games |
Endpoint | Description |
---|---|
GET /streams/:channel/ | Get stream object |
GET /streams | Get stream object |
GET /streams/featured | Get a list of featured streams |
GET /streams/summary | Get a summary of streams |
GET /streams/followed | Get a list of streams user is following |
Endpoint | Description |
---|---|
GET /channels/:channel/subscriptions | Get list of users subscribed to channel |
GET /channels/:channel/subscriptions/:user | Check if channel has user subscribed |
Endpoint | Description |
---|---|
GET /teams | Get list of active team objects |
GET /teams/:team | Get team object |
Endpoint | Description |
---|---|
GET /users/:user | Get user object |
GET /user | Get user object |
GET /streams/followed | Get list of streams user is following |
Endpoint | Description |
---|---|
GET /videos/:id | Get video object |
GET /videos/top | Get top videos by number of views |
GET /channels/:channel/videos | Get list of video objects belonging to channel |