curl --request POST \
--url https://test-api.segmnt.cloud/v1/projects/{projectId}/uploads \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"title": "Lesson 1 - Introduction",
"fileName": "lesson-01.mp4",
"sizeBytes": 2147483648
}
'import requests
url = "https://test-api.segmnt.cloud/v1/projects/{projectId}/uploads"
payload = {
"title": "Lesson 1 - Introduction",
"fileName": "lesson-01.mp4",
"sizeBytes": 2147483648
}
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({
title: 'Lesson 1 - Introduction',
fileName: 'lesson-01.mp4',
sizeBytes: 2147483648
})
};
fetch('https://test-api.segmnt.cloud/v1/projects/{projectId}/uploads', 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://test-api.segmnt.cloud/v1/projects/{projectId}/uploads",
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([
'title' => 'Lesson 1 - Introduction',
'fileName' => 'lesson-01.mp4',
'sizeBytes' => 2147483648
]),
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://test-api.segmnt.cloud/v1/projects/{projectId}/uploads"
payload := strings.NewReader("{\n \"title\": \"Lesson 1 - Introduction\",\n \"fileName\": \"lesson-01.mp4\",\n \"sizeBytes\": 2147483648\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://test-api.segmnt.cloud/v1/projects/{projectId}/uploads")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"Lesson 1 - Introduction\",\n \"fileName\": \"lesson-01.mp4\",\n \"sizeBytes\": 2147483648\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://test-api.segmnt.cloud/v1/projects/{projectId}/uploads")
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 \"title\": \"Lesson 1 - Introduction\",\n \"fileName\": \"lesson-01.mp4\",\n \"sizeBytes\": 2147483648\n}"
response = http.request(request)
puts response.read_body{
"id": "upl_2bN6rD",
"video": {
"id": "vid_9xR4tL",
"projectId": "<string>",
"title": "Lesson 1 - Introduction",
"status": "uploading",
"durationSeconds": 123,
"qualities": [
"360p"
],
"sizeBytes": 123,
"failure": {
"code": "unsupported_codec",
"message": "<string>"
},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"readyAt": "2023-11-07T05:31:56Z"
},
"partSizeBytes": 104857600,
"parts": [
{
"partNumber": 2,
"url": "<string>"
}
],
"expiresAt": "2023-11-07T05:31:56Z"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>"
}Start an upload
Creates a video in uploading status and returns one pre-signed PUT URL
per part. The client sends each part straight to storage, keeps the ETag
response header of each part, then calls the complete route.
Part upload: PUT the raw bytes to the part URL. No auth header and no
other headers are needed (Content-Type is not checked). Storage CORS
allows PUT from any origin and exposes ETag, so a browser can read it.
URLs are for upload only. Playback never uses storage URLs. They work
until expiresAt, at least 24 hours after the start.
Plan limits are checked here with sizeBytes, and again later: on complete
(real file size) and before encoding (real duration). A file over the limit
ends as failed with failure.code = plan_limit_reached and is removed.
curl --request POST \
--url https://test-api.segmnt.cloud/v1/projects/{projectId}/uploads \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"title": "Lesson 1 - Introduction",
"fileName": "lesson-01.mp4",
"sizeBytes": 2147483648
}
'import requests
url = "https://test-api.segmnt.cloud/v1/projects/{projectId}/uploads"
payload = {
"title": "Lesson 1 - Introduction",
"fileName": "lesson-01.mp4",
"sizeBytes": 2147483648
}
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({
title: 'Lesson 1 - Introduction',
fileName: 'lesson-01.mp4',
sizeBytes: 2147483648
})
};
fetch('https://test-api.segmnt.cloud/v1/projects/{projectId}/uploads', 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://test-api.segmnt.cloud/v1/projects/{projectId}/uploads",
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([
'title' => 'Lesson 1 - Introduction',
'fileName' => 'lesson-01.mp4',
'sizeBytes' => 2147483648
]),
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://test-api.segmnt.cloud/v1/projects/{projectId}/uploads"
payload := strings.NewReader("{\n \"title\": \"Lesson 1 - Introduction\",\n \"fileName\": \"lesson-01.mp4\",\n \"sizeBytes\": 2147483648\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://test-api.segmnt.cloud/v1/projects/{projectId}/uploads")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"title\": \"Lesson 1 - Introduction\",\n \"fileName\": \"lesson-01.mp4\",\n \"sizeBytes\": 2147483648\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://test-api.segmnt.cloud/v1/projects/{projectId}/uploads")
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 \"title\": \"Lesson 1 - Introduction\",\n \"fileName\": \"lesson-01.mp4\",\n \"sizeBytes\": 2147483648\n}"
response = http.request(request)
puts response.read_body{
"id": "upl_2bN6rD",
"video": {
"id": "vid_9xR4tL",
"projectId": "<string>",
"title": "Lesson 1 - Introduction",
"status": "uploading",
"durationSeconds": 123,
"qualities": [
"360p"
],
"sizeBytes": 123,
"failure": {
"code": "unsupported_codec",
"message": "<string>"
},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"readyAt": "2023-11-07T05:31:56Z"
},
"partSizeBytes": 104857600,
"parts": [
{
"partNumber": 2,
"url": "<string>"
}
],
"expiresAt": "2023-11-07T05:31:56Z"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>"
}Authorizations
Project API key. Server-side only.
Headers
Any unique string. A retry with the same key within 24 hours returns the first result.
255Path Parameters
^prj_[A-Za-z0-9]+$Body
1 - 200"Lesson 1 - Introduction"
255"lesson-01.mp4"
File size. The plan sets the maximum.
x >= 12147483648
video/mp4, video/quicktime, video/webm, video/x-matroska