Presign an upload
POST/api/video/upload/presign
Generate a signed URL for direct upload to storage.
Examples
curl https://flare.link/api/video/upload/presign \
-H "Authorization: Bearer flr_pat_..." \
-H "Content-Type: application/json" \
-d '{
"videoId": "VIDEO_ID",
"fileName": "demo.mp4"
}'const res = await fetch("https://flare.link/api/video/upload/presign", {
method: "POST",
headers: {
Authorization: "Bearer flr_pat_...",
"Content-Type": "application/json"
},
body: JSON.stringify({ videoId: "VIDEO_ID", fileName: "demo.mp4" })
});
const data = await res.json();import requests
res = requests.post(
"https://flare.link/api/video/upload/presign",
headers={"Authorization": "Bearer flr_pat_..."},
json={ "videoId": "VIDEO_ID", "fileName": "demo.mp4" }
)
print(res.json())require "net/http"
require "json"
uri = URI("https://flare.link/api/video/upload/presign")
req = Net::HTTP::Post.new(uri)
req["Authorization"] = "Bearer flr_pat_..."
req["Content-Type"] = "application/json"
req.body = { videoId: "VIDEO_ID", fileName: "demo.mp4" }.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(`{"videoId":"VIDEO_ID","fileName":"demo.mp4"}`)
req, _ := http.NewRequest("POST", "https://flare.link/api/video/upload/presign", 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(["videoId" => "VIDEO_ID", "fileName" => "demo.mp4"]);
$ch = curl_init("https://flare.link/api/video/upload/presign");
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 { videoId = "VIDEO_ID", fileName = "demo.mp4" });
var res = await client.PostAsync("https://flare.link/api/video/upload/presign", new StringContent(payload, Encoding.UTF8, "application/json"));Expected response
{
"uploadUrl": "https://signed-upload-url",
"method": "PUT",
"headers": { "Content-Type": "video/mp4" },
"publicUrl": "https://videos.flare.link/VIDEO_ID/composite/demo.mp4"
}