TodayFiles API
Upload, organise and publish video from your application.
From upload to ready.
Create a video, send the file, then receive an event when playback is ready. Your application stays in control.
- Waiting for upload
- Processing
- Ready
Your first request
Create a key in Developers. Keep it on your server and set TODAYFILES_API_KEY in your environment. Create your first video:
curl
response=$(curl --fail-with-body --request POST 'https://api.todayfiles.com/v1/videos' \
--header "Authorization: Bearer $TODAYFILES_API_KEY" \
--header 'Idempotency-Key: replace-with-a-unique-request-key' \
--header 'Content-Type: application/json' \
--data '{"title":"Launch trailer","source":{"type":"upload"}}')
printf '%s\n' "$response"Node
const response = await fetch("https://api.todayfiles.com/v1/videos", {
method: "POST",
headers: {
Authorization: "Bearer " + process.env.TODAYFILES_API_KEY,
"Idempotency-Key": "replace-with-a-unique-request-key",
"Content-Type": "application/json",
},
body: JSON.stringify({"title":"Launch trailer","source":{"type":"upload"}}),
});
if (!response.ok) throw new Error(await response.text());
const result = response.status === 204 ? null : await response.json();
console.log(result);Python
import json
import os
import requests
response = requests.request(
"POST", "https://api.todayfiles.com/v1/videos",
headers={
"Authorization": "Bearer " + os.environ["TODAYFILES_API_KEY"],
"Idempotency-Key": "replace-with-a-unique-request-key",
},
json=json.loads("{\"title\":\"Launch trailer\",\"source\":{\"type\":\"upload\"}}"),
timeout=30,
)
response.raise_for_status()
print(response.json() if response.content else None)PHP
<?php
$client = curl_init("https://api.todayfiles.com/v1/videos");
curl_setopt_array($client, [
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('TODAYFILES_API_KEY'),
'Idempotency-Key: replace-with-a-unique-request-key',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => "{\"title\":\"Launch trailer\",\"source\":{\"type\":\"upload\"}}",
]);
$body = curl_exec($client);
if ($body === false) throw new RuntimeException(curl_error($client));
$status = curl_getinfo($client, CURLINFO_RESPONSE_CODE);
curl_close($client);
if ($status >= 400) throw new RuntimeException($body);
$result = $body === '' ? null : json_decode($body, true, 512, JSON_THROW_ON_ERROR);
print_r($result);Go
package main
import (
"encoding/json"
"io"
"net/http"
"os"
"strings"
"time"
)
func main() {
request, err := http.NewRequest("POST", "https://api.todayfiles.com/v1/videos", strings.NewReader("{\"title\":\"Launch trailer\",\"source\":{\"type\":\"upload\"}}"))
if err != nil { panic(err) }
request.Header.Set("Authorization", "Bearer " + os.Getenv("TODAYFILES_API_KEY"))
request.Header.Set("Idempotency-Key", "replace-with-a-unique-request-key")
request.Header.Set("Content-Type", "application/json")
response, err := (&http.Client{Timeout: 30 * time.Second}).Do(request)
if err != nil { panic(err) }
defer response.Body.Close()
body, err := io.ReadAll(io.LimitReader(response.Body, 1 << 20))
if err != nil { panic(err) }
if response.StatusCode >= 400 { panic(string(body)) }
var result any
if len(body) > 0 {
if err := json.Unmarshal(body, &result); err != nil { panic(err) }
}
if err := json.NewEncoder(os.Stdout).Encode(result); err != nil { panic(err) }
}The response contains your video and a resumable upload target. Finish the three-step quickstart, then choose your next task.
Build your workflow
Upload videosSend large files with chunks, retries and resumable transfers.WebhooksReact to video processing with signed events and delivery logs.Folders and metadataKeep a growing video library easy to find and manage.Clone videosAdd permitted videos to your library, individually or in a job.AnalyticsQuery views, downloads and the audience watching now.Play and embedPut a ready video in your application or publish a player link.Every request, documented.
Parameters, objects, response examples and copyable code for all 29 operations.
Explore the API reference