curl --request POST \
--url https://app.trackplay.io/api/v1/videos/{video}/upload/init \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"filename": "<string>",
"size": 2684354560,
"orientation": "landscape"
}
'import requests
url = "https://app.trackplay.io/api/v1/videos/{video}/upload/init"
payload = {
"filename": "<string>",
"size": 2684354560,
"orientation": "landscape"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({filename: '<string>', size: 2684354560, orientation: 'landscape'})
};
fetch('https://app.trackplay.io/api/v1/videos/{video}/upload/init', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.trackplay.io/api/v1/videos/{video}/upload/init",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'filename' => '<string>',
'size' => 2684354560,
'orientation' => 'landscape'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.trackplay.io/api/v1/videos/{video}/upload/init"
payload := strings.NewReader("{\n \"filename\": \"<string>\",\n \"size\": 2684354560,\n \"orientation\": \"landscape\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.trackplay.io/api/v1/videos/{video}/upload/init")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"filename\": \"<string>\",\n \"size\": 2684354560,\n \"orientation\": \"landscape\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.trackplay.io/api/v1/videos/{video}/upload/init")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"filename\": \"<string>\",\n \"size\": 2684354560,\n \"orientation\": \"landscape\"\n}"
response = http.request(request)
puts response.read_body{
"upload_id": "tpup_8f2c9a1b3e4d5f607182930a4b5c6d7e",
"chunk_size": 8388608,
"offset": 123,
"size": 123,
"expires_at": "2023-11-07T05:31:56Z",
"upload_url": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"message": "The given data was invalid.",
"errors": {}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Start a resumable upload
Starts a resumable upload session for one orientation of a video. Send the file in 8 MB chunks with PATCH /uploads/{upload}, then finish with POST /uploads/{upload}/complete. The session expires 24 hours after it is created.
For files under 100 MB, the single-shot upload endpoint is simpler.
Requires a token with the videos:write scope.
curl --request POST \
--url https://app.trackplay.io/api/v1/videos/{video}/upload/init \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"filename": "<string>",
"size": 2684354560,
"orientation": "landscape"
}
'import requests
url = "https://app.trackplay.io/api/v1/videos/{video}/upload/init"
payload = {
"filename": "<string>",
"size": 2684354560,
"orientation": "landscape"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({filename: '<string>', size: 2684354560, orientation: 'landscape'})
};
fetch('https://app.trackplay.io/api/v1/videos/{video}/upload/init', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.trackplay.io/api/v1/videos/{video}/upload/init",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'filename' => '<string>',
'size' => 2684354560,
'orientation' => 'landscape'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.trackplay.io/api/v1/videos/{video}/upload/init"
payload := strings.NewReader("{\n \"filename\": \"<string>\",\n \"size\": 2684354560,\n \"orientation\": \"landscape\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://app.trackplay.io/api/v1/videos/{video}/upload/init")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"filename\": \"<string>\",\n \"size\": 2684354560,\n \"orientation\": \"landscape\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.trackplay.io/api/v1/videos/{video}/upload/init")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"filename\": \"<string>\",\n \"size\": 2684354560,\n \"orientation\": \"landscape\"\n}"
response = http.request(request)
puts response.read_body{
"upload_id": "tpup_8f2c9a1b3e4d5f607182930a4b5c6d7e",
"chunk_size": 8388608,
"offset": 123,
"size": 123,
"expires_at": "2023-11-07T05:31:56Z",
"upload_url": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}{
"message": "The given data was invalid.",
"errors": {}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Authorizations
A scoped token minted in Settings → API tokens. Send it as Authorization: Bearer tplt_… or X-API-Key: tplt_….
Headers
Retry-safe key. The first response for a given key is cached for 24 hours and replayed on a repeat, with Idempotency-Replayed: true set.
Path Parameters
The video's numeric ID.
Body
255The file size in bytes. Capped at 5 GB (5,368,709,120 bytes), the same ceiling as the dashboard.
1 <= x <= 5368709120video/mp4, video/quicktime, video/x-m4v, video/x-msvideo, video/webm, video/ogg, video/3gpp, video/x-matroska Which of the video's two orientation slots this upload fills.
landscape, portrait Response
The upload session.
"tpup_8f2c9a1b3e4d5f607182930a4b5c6d7e"
Bytes to send per PATCH chunk (8,388,608, fixed by the server). The last chunk is whatever is left.
8388608
Bytes received so far. 0 at init.
The size you declared.
The session and its chunks expire after this time.
Where to PATCH chunks.