JOB=$(curl --fail-with-body -s https://api.pre.dev/v1/videos \
-H "Authorization: Bearer $PREDEV_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "bytedance/seedance-2.0-mini", "prompt": "A paper boat drifting down a rain gutter", "duration": 4, "resolution": "480p"}')
ID=$(echo "$JOB" | jq -r .id)
while :; do
STATUS=$(curl --fail-with-body -s "https://api.pre.dev/v1/videos/$ID" -H "Authorization: Bearer $PREDEV_API_KEY" | jq -r .status)
case "$STATUS" in completed|failed|cancelled|expired) break ;; esac
sleep 5
done
curl --fail-with-body "https://api.pre.dev/v1/videos/$ID/content" -H "Authorization: Bearer $PREDEV_API_KEY" -o video.mp4import requests
url = "https://api.pre.dev/v1/videos"
payload = { "model": "bytedance/seedance-2.0-mini" }
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({model: 'bytedance/seedance-2.0-mini'})
};
fetch('https://api.pre.dev/v1/videos', 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.pre.dev/v1/videos",
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([
'model' => 'bytedance/seedance-2.0-mini'
]),
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.pre.dev/v1/videos"
payload := strings.NewReader("{\n \"model\": \"bytedance/seedance-2.0-mini\"\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.pre.dev/v1/videos")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"bytedance/seedance-2.0-mini\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pre.dev/v1/videos")
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 \"model\": \"bytedance/seedance-2.0-mini\"\n}"
response = http.request(request)
puts response.read_body{
"id": "YCXWQa200sQEi5GSnlfP",
"polling_url": "https://api.pre.dev/v1/videos/YCXWQa200sQEi5GSnlfP",
"status": "pending"
}Submit a video job
Start an asynchronous video job, poll it by its id, then download the video.
JOB=$(curl --fail-with-body -s https://api.pre.dev/v1/videos \
-H "Authorization: Bearer $PREDEV_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "bytedance/seedance-2.0-mini", "prompt": "A paper boat drifting down a rain gutter", "duration": 4, "resolution": "480p"}')
ID=$(echo "$JOB" | jq -r .id)
while :; do
STATUS=$(curl --fail-with-body -s "https://api.pre.dev/v1/videos/$ID" -H "Authorization: Bearer $PREDEV_API_KEY" | jq -r .status)
case "$STATUS" in completed|failed|cancelled|expired) break ;; esac
sleep 5
done
curl --fail-with-body "https://api.pre.dev/v1/videos/$ID/content" -H "Authorization: Bearer $PREDEV_API_KEY" -o video.mp4import requests
url = "https://api.pre.dev/v1/videos"
payload = { "model": "bytedance/seedance-2.0-mini" }
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({model: 'bytedance/seedance-2.0-mini'})
};
fetch('https://api.pre.dev/v1/videos', 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.pre.dev/v1/videos",
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([
'model' => 'bytedance/seedance-2.0-mini'
]),
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.pre.dev/v1/videos"
payload := strings.NewReader("{\n \"model\": \"bytedance/seedance-2.0-mini\"\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.pre.dev/v1/videos")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"bytedance/seedance-2.0-mini\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pre.dev/v1/videos")
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 \"model\": \"bytedance/seedance-2.0-mini\"\n}"
response = http.request(request)
puts response.read_body{
"id": "YCXWQa200sQEi5GSnlfP",
"polling_url": "https://api.pre.dev/v1/videos/YCXWQa200sQEi5GSnlfP",
"status": "pending"
}Authorizations
The workspace API key (pdk_…) from Integrations → Built-in in the pre.dev dashboard.
Headers
Attribute this call to one of the workspace's projects. An id the workspace does not own is ignored.
Body
An id from GET /v1/videos/models.
"bytedance/seedance-2.0-mini"
What to generate. Optional for models that work from images alone.
Seconds. See the model row's supported_durations.
"480p"
"720p"
"1080p"
"16:9"
"9:16"
"1:1"
Exact pixels, such as 1280x720.
First or last frame images, on models that list supported_frame_images.
Reference images, audio or video, on models that accept them. An image can be a URL or data: URL string.
A URL or data: URL of a reference image.
Response
The job was accepted.
Job id. Poll GET /v1/videos/{id} and download from GET /v1/videos/{id}/content.
https://api.pre.dev/v1/videos/{id} for this job: the status URL, ending with the job's id.
pending, in_progress, completed, failed, cancelled, expired Present when the job has completed. Download through GET /v1/videos/{jobId}/content.
Why the job failed.
Was this page helpful?

