Skip to main content

Images and video

Submit a video job

Start an asynchronous video job, poll it by its id, then download the video.

posthttps://api.pre.dev/v1/videosTry it
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 5donecurl --fail-with-body "https://api.pre.dev/v1/videos/$ID/content" -H "Authorization: Bearer $PREDEV_API_KEY" -o video.mp4
const body = JSON.stringify({  "model": "bytedance/seedance-2.0-mini",  "prompt": "A paper boat drifting down a rain gutter",  "duration": 4,  "resolution": "480p"})fetch("https://api.pre.dev/v1/videos", {  method: "POST",  headers: {    "Content-Type": "application/json"  },  body})
package mainimport (  "fmt"  "net/http"  "io/ioutil"  "strings")func main() {  url := "https://api.pre.dev/v1/videos"  body := strings.NewReader(`{    "model": "bytedance/seedance-2.0-mini",    "prompt": "A paper boat drifting down a rain gutter",    "duration": 4,    "resolution": "480p"  }`)  req, _ := http.NewRequest("POST", url, body)  req.Header.Add("Content-Type", "application/json")  res, _ := http.DefaultClient.Do(req)  defer res.Body.Close()  body, _ := ioutil.ReadAll(res.Body)  fmt.Println(res)  fmt.Println(string(body))}
import requestsurl = "https://api.pre.dev/v1/videos"body = """{  "model": "bytedance/seedance-2.0-mini",  "prompt": "A paper boat drifting down a rain gutter",  "duration": 4,  "resolution": "480p"}"""response = requests.request("POST", url, data = body, headers = {  "Content-Type": "application/json"})print(response.text)
import java.net.URI;import java.net.http.HttpClient;import java.net.http.HttpRequest;import java.net.http.HttpResponse;import java.net.http.HttpResponse.BodyHandlers;import java.time.Duration;import java.net.http.HttpRequest.BodyPublishers;var body = BodyPublishers.ofString("""{  "model": "bytedance/seedance-2.0-mini",  "prompt": "A paper boat drifting down a rain gutter",  "duration": 4,  "resolution": "480p"}""");HttpClient client = HttpClient.newBuilder()  .connectTimeout(Duration.ofSeconds(10))  .build();HttpRequest.Builder requestBuilder = HttpRequest.newBuilder()  .uri(URI.create("https://api.pre.dev/v1/videos"))  .header("Content-Type", "application/json")  .POST(body)  .build();try {  HttpResponse<String> response = client.send(requestBuilder.build(), BodyHandlers.ofString());  System.out.println("Status code: " + response.statusCode());  System.out.println("Response body: " + response.body());} catch (Exception e) {  e.printStackTrace();}
using System;using System.Net.Http;using System.Text;var body = new StringContent("""{  "model": "bytedance/seedance-2.0-mini",  "prompt": "A paper boat drifting down a rain gutter",  "duration": 4,  "resolution": "480p"}""", Encoding.UTF8, "application/json");var client = new HttpClient();var response = await client.PostAsync("https://api.pre.dev/v1/videos", body);var responseBody = await response.Content.ReadAsStringAsync();
use reqwest::{Result, Client};async fn main() -> Result<()> {  let client = Client::new();  let url = "https://api.pre.dev/v1/videos";  let body = r#"{    "model": "bytedance/seedance-2.0-mini",    "prompt": "A paper boat drifting down a rain gutter",    "duration": 4,    "resolution": "480p"  }"#;  let res = client    .post(url)    .header("Content-Type", "application/json")    .body(body)    .send()    .await?    .text()    .await?;  println!("{}", res);  Ok(())}
{  "id": "YCXWQa200sQEi5GSnlfP",  "polling_url": "https://api.pre.dev/v1/videos/YCXWQa200sQEi5GSnlfP",  "status": "pending"}
POST
/v1/videos

Authorization

AuthorizationBearer <token>

The workspace API key (pdk_…) from Integrations → Built-in in the pre.dev dashboard.

In: header

Header Parameters

x-predev-project-id?string

Attribute this call to one of the workspace's projects. An id the workspace does not own is ignored.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

The job was accepted.

TypeScript Definitions

Use the response body type in TypeScript.

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

Was this page helpful?