# Uploading Videos via API

To upload videos via API, there are at least 2 requests to be called in order:

  1. Make a request to create video(s).
  2. Using video keys from step 1 to upload video source file for each video.
  3. Wait for the video(s) to be ready.

# Authorization

Both APIs require authorization by sending this HTTP Authorization Header.

Authorization: Bearer <access_token_here>
1

Access token may be generated from Personal Access Token settings.

# Step 1 - Make a request to create video(s).

Let's start with creating videos, by making HTTP Post with video titles.

The response will include video key that require to use when uploading video files, and also streaming URLs that can be play on your application later.

# Request Endpoint

POST https://stream.byteark.com/api/v1/videos
1

# Request Parameters

Parameter Type Required Description
projectKey String Required Key of the project the video will be uploaded to.
videos []Object Required Information of videos to create, one entry for each video.
videos.*.title String Required Title of each video.
videos.*.tags []String - Tags of each video.

# Sample Request Parameters

{
  "projectKey": "your-project-key-here",
  "videos": [
    {
      "title": "Video 1 title here",
      "tags": ["tag1", "tag2"]
    },
    {
      "title": "Video 2 title here",
      "tags": ["tag3", "tag4"]
    }
  ]
}
1
2
3
4
5
6
7
8
9
10
11
12
13

# Sample Response

[
  {
    "key": "RuguHtZPJYm4",
    "title": "Video 1 title here",
    "primaryPlaybackUrl": {
      name: "playback",
      hls: {
        name: "Adaptive Bitrate",
        url: "https://your-playback-domain/streams/VideoKey/playlist.m3u8"
      }
    }
  },
  {
    "key": "RuguHtZPJYm5",
    "title": "Video 2 title here",
    "primaryPlaybackUrl": {
      name: "playback",
      hls: {
        name: "Adaptive Bitrate",
        url: "https://your-playback-domain/streams/VideoKey/playlist.m3u8"
      }
    }
  }
]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24

# Step 2 - Upload a video file

Uploading a video file for each video using multipart/form-data request, with file field.

# Sample Request Parameters

POST /api/upload/v1/form-data/videos/{videoKey}
1

# Request Parameters

Parameter Type Required Description
file Binary Required Video source file binary content.

# Step 3 - Wait for the video(s) to be ready

The video will be processed. You may wait for video ready by pooling the video API, or using webhook.