Create a video
POST/api/video/create
Create a video record before uploading media. This is step 1 of Upload a video file.
- fileName (string, required) - Display name, cut to 50 characters
- s3Key (string, required) - A new UUID v4. It becomes the video id and its storage folder; uploads only work with a UUID
- isExternalUpload (boolean) - Send
truefor an uploaded file, as the web upload does - uploadStatus (string) - Send
uploadingfor an upload - width, height (number, pixels) and duration (number, seconds) - Checked against your plan's resolution and duration limits
Plan limits return 402 with error set to subscription_required, video_limit_reached, storage_limit_exceeded, resolution_limit_exceeded or duration_limit_exceeded. A reused s3Key returns 409.
Examples
curl https://flare.link/api/video/create \
-H "Authorization: Bearer flr_pat_..." \
-H "Content-Type: application/json" \
-d '{
"fileName": "demo.mp4",
"s3Key": "6f1c2a3b-4d5e-4f60-8a7b-9c0d1e2f3a4b",
"isExternalUpload": true,
"uploadStatus": "uploading",
"source": "composite",
"width": 1920,
"height": 1080,
"duration": 120
}'const res = await fetch("https://flare.link/api/video/create", {
method: "POST",
headers: {
Authorization: "Bearer flr_pat_...",
"Content-Type": "application/json"
},
body: JSON.stringify({
fileName: "demo.mp4",
s3Key: crypto.randomUUID(),
isExternalUpload: true,
uploadStatus: "uploading",
source: "composite",
width: 1920,
height: 1080,
duration: 120
})
});
const data = await res.json();import requests
import uuid
payload = {
"fileName": "demo.mp4",
"s3Key": str(uuid.uuid4()),
"isExternalUpload": True,
"uploadStatus": "uploading",
"source": "composite",
"width": 1920,
"height": 1080,
"duration": 120
}
res = requests.post(
"https://flare.link/api/video/create",
headers={"Authorization": "Bearer flr_pat_..."},
json=payload
)
print(res.json())require "net/http"
require "json"
uri = URI("https://flare.link/api/video/create")
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer flr_pat_..."
req["Content-Type"] = "application/json"
req.body = { fileName: "demo.mp4", s3Key: "6f1c2a3b-4d5e-4f60-8a7b-9c0d1e2f3a4b", source: "composite" }.to_json
res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(req) }
puts res.bodypackage main
import (
"bytes"
"fmt"
"io"
"net/http"
)
func main() {
payload := []byte(`{"fileName":"demo.mp4","s3Key":"6f1c2a3b-4d5e-4f60-8a7b-9c0d1e2f3a4b","source":"composite"}`)
req, _ := http.NewRequest("POST", "https://flare.link/api/video/create", bytes.NewBuffer(payload))
req.Header.Set("Authorization", "Bearer flr_pat_...")
req.Header.Set("Content-Type", "application/json")
resp, _ := http.DefaultClient.Do(req)
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}<?php
$payload = json_encode([
"fileName" => "demo.mp4",
"s3Key" => "6f1c2a3b-4d5e-4f60-8a7b-9c0d1e2f3a4b",
"source" => "composite"
]);
$ch = curl_init("https://flare.link/api/video/create");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer flr_pat_...",
"Content-Type: application/json"
]);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
echo $response;using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "flr_pat_...");
var payload = JsonSerializer.Serialize(new { fileName = "demo.mp4", s3Key = "6f1c2a3b-4d5e-4f60-8a7b-9c0d1e2f3a4b", source = "composite" });
var res = await client.PostAsync("https://flare.link/api/video/create", new StringContent(payload, Encoding.UTF8, "application/json"));
var body = await res.Content.ReadAsStringAsync();Expected response
{
"success": true,
"video": {
"id": "6f1c2a3b-4d5e-4f60-8a7b-9c0d1e2f3a4b",
"uploadStatus": "uploading"
}
}