Finish an upload
curl --request POST \
--url https://api.segmnt.cloud/v1/projects/{projectId}/uploads/{uploadId}/complete \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"parts": [
{
"partNumber": 5000,
"etag": "<string>"
}
]
}
'import requests
url = "https://api.segmnt.cloud/v1/projects/{projectId}/uploads/{uploadId}/complete"
payload = { "parts": [
{
"partNumber": 5000,
"etag": "<string>"
}
] }
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({parts: [{partNumber: 5000, etag: '<string>'}]})
};
fetch('https://api.segmnt.cloud/v1/projects/{projectId}/uploads/{uploadId}/complete', 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://api.segmnt.cloud/v1/projects/{projectId}/uploads/{uploadId}/complete",
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([
'parts' => [
[
'partNumber' => 5000,
'etag' => '<string>'
]
]
]),
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://api.segmnt.cloud/v1/projects/{projectId}/uploads/{uploadId}/complete"
payload := strings.NewReader("{\n \"parts\": [\n {\n \"partNumber\": 5000,\n \"etag\": \"<string>\"\n }\n ]\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://api.segmnt.cloud/v1/projects/{projectId}/uploads/{uploadId}/complete")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"parts\": [\n {\n \"partNumber\": 5000,\n \"etag\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.segmnt.cloud/v1/projects/{projectId}/uploads/{uploadId}/complete")
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 \"parts\": [\n {\n \"partNumber\": 5000,\n \"etag\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "vid_9xR4tL",
"projectId": "<string>",
"title": "Lesson 1 - Introduction",
"status": "uploading",
"durationSeconds": 123,
"qualities": [
"360p"
],
"sizeBytes": 123,
"failure": {
"code": "unsupported_codec",
"message": "<string>",
"retryable": true
},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"readyAt": "2023-11-07T05:31:56Z"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>",
"limit": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>",
"limit": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>",
"limit": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>",
"limit": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>",
"limit": "<string>"
}Uploads
Finish an upload
Joins the parts and starts encoding. The video moves to processing.
Safe to retry: if the upload was already completed, it returns 202 with
the current video.
A browser calls this with its upload token, and only for the upload that token created. A token cannot complete another upload.
Rate limits: a call that uses a project API key is not limited per IP.
Each key may make up to 1,000 create and complete calls a minute. A browser
that uses an upload token is limited to 60 calls a minute per IP address.
If a call returns
429 with a Retry-After header, wait that many seconds, then call
complete again. It is safe to repeat.
POST
/
v1
/
projects
/
{projectId}
/
uploads
/
{uploadId}
/
complete
Finish an upload
curl --request POST \
--url https://api.segmnt.cloud/v1/projects/{projectId}/uploads/{uploadId}/complete \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"parts": [
{
"partNumber": 5000,
"etag": "<string>"
}
]
}
'import requests
url = "https://api.segmnt.cloud/v1/projects/{projectId}/uploads/{uploadId}/complete"
payload = { "parts": [
{
"partNumber": 5000,
"etag": "<string>"
}
] }
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({parts: [{partNumber: 5000, etag: '<string>'}]})
};
fetch('https://api.segmnt.cloud/v1/projects/{projectId}/uploads/{uploadId}/complete', 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://api.segmnt.cloud/v1/projects/{projectId}/uploads/{uploadId}/complete",
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([
'parts' => [
[
'partNumber' => 5000,
'etag' => '<string>'
]
]
]),
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://api.segmnt.cloud/v1/projects/{projectId}/uploads/{uploadId}/complete"
payload := strings.NewReader("{\n \"parts\": [\n {\n \"partNumber\": 5000,\n \"etag\": \"<string>\"\n }\n ]\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://api.segmnt.cloud/v1/projects/{projectId}/uploads/{uploadId}/complete")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"parts\": [\n {\n \"partNumber\": 5000,\n \"etag\": \"<string>\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.segmnt.cloud/v1/projects/{projectId}/uploads/{uploadId}/complete")
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 \"parts\": [\n {\n \"partNumber\": 5000,\n \"etag\": \"<string>\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"id": "vid_9xR4tL",
"projectId": "<string>",
"title": "Lesson 1 - Introduction",
"status": "uploading",
"durationSeconds": 123,
"qualities": [
"360p"
],
"sizeBytes": 123,
"failure": {
"code": "unsupported_codec",
"message": "<string>",
"retryable": true
},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"readyAt": "2023-11-07T05:31:56Z"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>",
"limit": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>",
"limit": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>",
"limit": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>",
"limit": "<string>"
}{
"type": "<string>",
"title": "<string>",
"status": 123,
"code": "plan_limit_reached",
"detail": "<string>",
"limit": "<string>"
}Authorizations
apiKeysessionuploadToken
Path Parameters
Body
application/json
Response
Upload finished. Encoding started.