Contents

Video Upload Guide

Introduction

With video upload endpoints, you can upload videos directly to Twitch. These video endpoints enable developers to create tools for creating and managing videos on Twitch. Broadcasters often like to add their personal branding (for intros and outros) and create compilation videos from their streams. With the video endpoints, you can enable those experiences and upload the end result directly to Twitch.

Video Formats

When uploading a video, the API accepts the following formats:

Rate Limits

There is a rate limit of 5 simultaneous uploads per user, with a maximum of 100 uploads in 24 hours.

How to Upload a Video

1. Get an Authentication Token

You need an OAuth token with the channel_editor scope for the channel where the video will live. Once you have the token, you add it to the Authorization header when you create the video.

For information about getting OAuth access tokens, see the Apps & Authentication Guide.

2. Create a Video

See the Create Video endpoint.

This example creates a video entitled “Test video” in the 44322889 channel.

curl -H 'Accept: application/vnd.twitchtv.v5+json' \
-H 'Authorization: OAuth cfabdegwdoklmawdzdo98xt2fo512y' \
-H 'Client-ID: uo6dggojyb8d6soh92zknwmi5ej1q2' \
-X POST 'https://api.twitch.tv/kraken/videos?channel_id=44322889&title=Test video'

The response will include the following information, which is used in subsequent steps:

3. Upload Video Parts

See the Upload Video Part endpoint.

This uploads the first part of video 106400740, created in the prior step.

curl -H 'Content-Length: 8896493' \
--data-binary "@test.mp4" \
-X PUT 'https://uploads.twitch.tv/upload/106400740?part=1&upload_token=7_STl2gsKwDy1mHj2k95ld3aodDl3E_NzzQdSlN9ll0p6Ct0xFhvrO5bWu7tGUKEH5jtD_hjB9q3X4vTOQ000B1UcmMxduT30FuHhAmFYgYf7DoJE9PVvGRZqk9WQAR2ZGphUpj_237smnjE2gMoaQ--'

4. Complete the Video Upload

See the Complete Video Upload endpoint.

This example completes the upload of video 106400740.

curl -X POST 'https://uploads.twitch.tv/upload/106400740/complete?upload_token=7_STl2gsKwDy1mHj2k95ld3aodDl3E_NzzQdSlN9ll0p6Ct0xFhvrO5bWu7tGUKEH5jtD_hjB9q3X4vTOQ000B1UcmMxduT30FuHhAmFYgYf7DoJE9PVvGRZqk9WQAR2ZGphUpj_237smnjE2gMoaQ--'