curl --request POST \
--url https://longstories.ai/api/v1/short \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"prompt": "Tell a heartwarming story about a small bakery that becomes the heart of its community",
"shortRequestEnhancer": false,
"directorNotes": "Warm, cozy lighting with focus on people interacting in the bakery",
"scriptConfig": {
"style": "default",
"targetLengthInWords": 70
},
"imageConfig": {
"model": "flux_schnell"
},
"voiceoverConfig": {
"enabled": true,
"voiceId": "zWDA589rUKXuLnPRDtAG"
},
"captionsConfig": {
"captionsEnabled": true,
"captionsStyle": "tiktok"
},
"effectsConfig": {
"transition": "fade",
"floating": true
},
"musicConfig": {
"musicSlug": "gentle_ambient_loop",
"enabled": true,
"volume": 0.3,
"loop": true
},
"videoConfig": {
"enabled": false,
"model": "luma_ray2"
},
"templateConfig": {
"templateId": "none"
},
"quality": "medium",
"aspectRatio": "9:16"
}
'import requests
url = "https://longstories.ai/api/v1/short"
payload = {
"prompt": "Tell a heartwarming story about a small bakery that becomes the heart of its community",
"shortRequestEnhancer": False,
"directorNotes": "Warm, cozy lighting with focus on people interacting in the bakery",
"scriptConfig": {
"style": "default",
"targetLengthInWords": 70
},
"imageConfig": { "model": "flux_schnell" },
"voiceoverConfig": {
"enabled": True,
"voiceId": "zWDA589rUKXuLnPRDtAG"
},
"captionsConfig": {
"captionsEnabled": True,
"captionsStyle": "tiktok"
},
"effectsConfig": {
"transition": "fade",
"floating": True
},
"musicConfig": {
"musicSlug": "gentle_ambient_loop",
"enabled": True,
"volume": 0.3,
"loop": True
},
"videoConfig": {
"enabled": False,
"model": "luma_ray2"
},
"templateConfig": { "templateId": "none" },
"quality": "medium",
"aspectRatio": "9:16"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: 'Tell a heartwarming story about a small bakery that becomes the heart of its community',
shortRequestEnhancer: false,
directorNotes: 'Warm, cozy lighting with focus on people interacting in the bakery',
scriptConfig: {style: 'default', targetLengthInWords: 70},
imageConfig: {model: 'flux_schnell'},
voiceoverConfig: {enabled: true, voiceId: 'zWDA589rUKXuLnPRDtAG'},
captionsConfig: {captionsEnabled: true, captionsStyle: 'tiktok'},
effectsConfig: {transition: 'fade', floating: true},
musicConfig: {musicSlug: 'gentle_ambient_loop', enabled: true, volume: 0.3, loop: true},
videoConfig: {enabled: false, model: 'luma_ray2'},
templateConfig: {templateId: 'none'},
quality: 'medium',
aspectRatio: '9:16'
})
};
fetch('https://longstories.ai/api/v1/short', 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://longstories.ai/api/v1/short",
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([
'prompt' => 'Tell a heartwarming story about a small bakery that becomes the heart of its community',
'shortRequestEnhancer' => false,
'directorNotes' => 'Warm, cozy lighting with focus on people interacting in the bakery',
'scriptConfig' => [
'style' => 'default',
'targetLengthInWords' => 70
],
'imageConfig' => [
'model' => 'flux_schnell'
],
'voiceoverConfig' => [
'enabled' => true,
'voiceId' => 'zWDA589rUKXuLnPRDtAG'
],
'captionsConfig' => [
'captionsEnabled' => true,
'captionsStyle' => 'tiktok'
],
'effectsConfig' => [
'transition' => 'fade',
'floating' => true
],
'musicConfig' => [
'musicSlug' => 'gentle_ambient_loop',
'enabled' => true,
'volume' => 0.3,
'loop' => true
],
'videoConfig' => [
'enabled' => false,
'model' => 'luma_ray2'
],
'templateConfig' => [
'templateId' => 'none'
],
'quality' => 'medium',
'aspectRatio' => '9:16'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://longstories.ai/api/v1/short"
payload := strings.NewReader("{\n \"prompt\": \"Tell a heartwarming story about a small bakery that becomes the heart of its community\",\n \"shortRequestEnhancer\": false,\n \"directorNotes\": \"Warm, cozy lighting with focus on people interacting in the bakery\",\n \"scriptConfig\": {\n \"style\": \"default\",\n \"targetLengthInWords\": 70\n },\n \"imageConfig\": {\n \"model\": \"flux_schnell\"\n },\n \"voiceoverConfig\": {\n \"enabled\": true,\n \"voiceId\": \"zWDA589rUKXuLnPRDtAG\"\n },\n \"captionsConfig\": {\n \"captionsEnabled\": true,\n \"captionsStyle\": \"tiktok\"\n },\n \"effectsConfig\": {\n \"transition\": \"fade\",\n \"floating\": true\n },\n \"musicConfig\": {\n \"musicSlug\": \"gentle_ambient_loop\",\n \"enabled\": true,\n \"volume\": 0.3,\n \"loop\": true\n },\n \"videoConfig\": {\n \"enabled\": false,\n \"model\": \"luma_ray2\"\n },\n \"templateConfig\": {\n \"templateId\": \"none\"\n },\n \"quality\": \"medium\",\n \"aspectRatio\": \"9:16\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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://longstories.ai/api/v1/short")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"Tell a heartwarming story about a small bakery that becomes the heart of its community\",\n \"shortRequestEnhancer\": false,\n \"directorNotes\": \"Warm, cozy lighting with focus on people interacting in the bakery\",\n \"scriptConfig\": {\n \"style\": \"default\",\n \"targetLengthInWords\": 70\n },\n \"imageConfig\": {\n \"model\": \"flux_schnell\"\n },\n \"voiceoverConfig\": {\n \"enabled\": true,\n \"voiceId\": \"zWDA589rUKXuLnPRDtAG\"\n },\n \"captionsConfig\": {\n \"captionsEnabled\": true,\n \"captionsStyle\": \"tiktok\"\n },\n \"effectsConfig\": {\n \"transition\": \"fade\",\n \"floating\": true\n },\n \"musicConfig\": {\n \"musicSlug\": \"gentle_ambient_loop\",\n \"enabled\": true,\n \"volume\": 0.3,\n \"loop\": true\n },\n \"videoConfig\": {\n \"enabled\": false,\n \"model\": \"luma_ray2\"\n },\n \"templateConfig\": {\n \"templateId\": \"none\"\n },\n \"quality\": \"medium\",\n \"aspectRatio\": \"9:16\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://longstories.ai/api/v1/short")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"Tell a heartwarming story about a small bakery that becomes the heart of its community\",\n \"shortRequestEnhancer\": false,\n \"directorNotes\": \"Warm, cozy lighting with focus on people interacting in the bakery\",\n \"scriptConfig\": {\n \"style\": \"default\",\n \"targetLengthInWords\": 70\n },\n \"imageConfig\": {\n \"model\": \"flux_schnell\"\n },\n \"voiceoverConfig\": {\n \"enabled\": true,\n \"voiceId\": \"zWDA589rUKXuLnPRDtAG\"\n },\n \"captionsConfig\": {\n \"captionsEnabled\": true,\n \"captionsStyle\": \"tiktok\"\n },\n \"effectsConfig\": {\n \"transition\": \"fade\",\n \"floating\": true\n },\n \"musicConfig\": {\n \"musicSlug\": \"gentle_ambient_loop\",\n \"enabled\": true,\n \"volume\": 0.3,\n \"loop\": true\n },\n \"videoConfig\": {\n \"enabled\": false,\n \"model\": \"luma_ray2\"\n },\n \"templateConfig\": {\n \"templateId\": \"none\"\n },\n \"quality\": \"medium\",\n \"aspectRatio\": \"9:16\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "run_abc123",
"projectId": "proj_123abc"
},
"requestId": "req_123abc"
}Generate a Video
Initiates an AI-assisted video generation (up to 10 minutes) using either a text prompt (for script + visuals) or a user-provided script (to skip script generation). Returns a Run ID used to query the status or results of the generation process.
curl --request POST \
--url https://longstories.ai/api/v1/short \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"prompt": "Tell a heartwarming story about a small bakery that becomes the heart of its community",
"shortRequestEnhancer": false,
"directorNotes": "Warm, cozy lighting with focus on people interacting in the bakery",
"scriptConfig": {
"style": "default",
"targetLengthInWords": 70
},
"imageConfig": {
"model": "flux_schnell"
},
"voiceoverConfig": {
"enabled": true,
"voiceId": "zWDA589rUKXuLnPRDtAG"
},
"captionsConfig": {
"captionsEnabled": true,
"captionsStyle": "tiktok"
},
"effectsConfig": {
"transition": "fade",
"floating": true
},
"musicConfig": {
"musicSlug": "gentle_ambient_loop",
"enabled": true,
"volume": 0.3,
"loop": true
},
"videoConfig": {
"enabled": false,
"model": "luma_ray2"
},
"templateConfig": {
"templateId": "none"
},
"quality": "medium",
"aspectRatio": "9:16"
}
'import requests
url = "https://longstories.ai/api/v1/short"
payload = {
"prompt": "Tell a heartwarming story about a small bakery that becomes the heart of its community",
"shortRequestEnhancer": False,
"directorNotes": "Warm, cozy lighting with focus on people interacting in the bakery",
"scriptConfig": {
"style": "default",
"targetLengthInWords": 70
},
"imageConfig": { "model": "flux_schnell" },
"voiceoverConfig": {
"enabled": True,
"voiceId": "zWDA589rUKXuLnPRDtAG"
},
"captionsConfig": {
"captionsEnabled": True,
"captionsStyle": "tiktok"
},
"effectsConfig": {
"transition": "fade",
"floating": True
},
"musicConfig": {
"musicSlug": "gentle_ambient_loop",
"enabled": True,
"volume": 0.3,
"loop": True
},
"videoConfig": {
"enabled": False,
"model": "luma_ray2"
},
"templateConfig": { "templateId": "none" },
"quality": "medium",
"aspectRatio": "9:16"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
prompt: 'Tell a heartwarming story about a small bakery that becomes the heart of its community',
shortRequestEnhancer: false,
directorNotes: 'Warm, cozy lighting with focus on people interacting in the bakery',
scriptConfig: {style: 'default', targetLengthInWords: 70},
imageConfig: {model: 'flux_schnell'},
voiceoverConfig: {enabled: true, voiceId: 'zWDA589rUKXuLnPRDtAG'},
captionsConfig: {captionsEnabled: true, captionsStyle: 'tiktok'},
effectsConfig: {transition: 'fade', floating: true},
musicConfig: {musicSlug: 'gentle_ambient_loop', enabled: true, volume: 0.3, loop: true},
videoConfig: {enabled: false, model: 'luma_ray2'},
templateConfig: {templateId: 'none'},
quality: 'medium',
aspectRatio: '9:16'
})
};
fetch('https://longstories.ai/api/v1/short', 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://longstories.ai/api/v1/short",
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([
'prompt' => 'Tell a heartwarming story about a small bakery that becomes the heart of its community',
'shortRequestEnhancer' => false,
'directorNotes' => 'Warm, cozy lighting with focus on people interacting in the bakery',
'scriptConfig' => [
'style' => 'default',
'targetLengthInWords' => 70
],
'imageConfig' => [
'model' => 'flux_schnell'
],
'voiceoverConfig' => [
'enabled' => true,
'voiceId' => 'zWDA589rUKXuLnPRDtAG'
],
'captionsConfig' => [
'captionsEnabled' => true,
'captionsStyle' => 'tiktok'
],
'effectsConfig' => [
'transition' => 'fade',
'floating' => true
],
'musicConfig' => [
'musicSlug' => 'gentle_ambient_loop',
'enabled' => true,
'volume' => 0.3,
'loop' => true
],
'videoConfig' => [
'enabled' => false,
'model' => 'luma_ray2'
],
'templateConfig' => [
'templateId' => 'none'
],
'quality' => 'medium',
'aspectRatio' => '9:16'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://longstories.ai/api/v1/short"
payload := strings.NewReader("{\n \"prompt\": \"Tell a heartwarming story about a small bakery that becomes the heart of its community\",\n \"shortRequestEnhancer\": false,\n \"directorNotes\": \"Warm, cozy lighting with focus on people interacting in the bakery\",\n \"scriptConfig\": {\n \"style\": \"default\",\n \"targetLengthInWords\": 70\n },\n \"imageConfig\": {\n \"model\": \"flux_schnell\"\n },\n \"voiceoverConfig\": {\n \"enabled\": true,\n \"voiceId\": \"zWDA589rUKXuLnPRDtAG\"\n },\n \"captionsConfig\": {\n \"captionsEnabled\": true,\n \"captionsStyle\": \"tiktok\"\n },\n \"effectsConfig\": {\n \"transition\": \"fade\",\n \"floating\": true\n },\n \"musicConfig\": {\n \"musicSlug\": \"gentle_ambient_loop\",\n \"enabled\": true,\n \"volume\": 0.3,\n \"loop\": true\n },\n \"videoConfig\": {\n \"enabled\": false,\n \"model\": \"luma_ray2\"\n },\n \"templateConfig\": {\n \"templateId\": \"none\"\n },\n \"quality\": \"medium\",\n \"aspectRatio\": \"9:16\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
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://longstories.ai/api/v1/short")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"prompt\": \"Tell a heartwarming story about a small bakery that becomes the heart of its community\",\n \"shortRequestEnhancer\": false,\n \"directorNotes\": \"Warm, cozy lighting with focus on people interacting in the bakery\",\n \"scriptConfig\": {\n \"style\": \"default\",\n \"targetLengthInWords\": 70\n },\n \"imageConfig\": {\n \"model\": \"flux_schnell\"\n },\n \"voiceoverConfig\": {\n \"enabled\": true,\n \"voiceId\": \"zWDA589rUKXuLnPRDtAG\"\n },\n \"captionsConfig\": {\n \"captionsEnabled\": true,\n \"captionsStyle\": \"tiktok\"\n },\n \"effectsConfig\": {\n \"transition\": \"fade\",\n \"floating\": true\n },\n \"musicConfig\": {\n \"musicSlug\": \"gentle_ambient_loop\",\n \"enabled\": true,\n \"volume\": 0.3,\n \"loop\": true\n },\n \"videoConfig\": {\n \"enabled\": false,\n \"model\": \"luma_ray2\"\n },\n \"templateConfig\": {\n \"templateId\": \"none\"\n },\n \"quality\": \"medium\",\n \"aspectRatio\": \"9:16\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://longstories.ai/api/v1/short")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"prompt\": \"Tell a heartwarming story about a small bakery that becomes the heart of its community\",\n \"shortRequestEnhancer\": false,\n \"directorNotes\": \"Warm, cozy lighting with focus on people interacting in the bakery\",\n \"scriptConfig\": {\n \"style\": \"default\",\n \"targetLengthInWords\": 70\n },\n \"imageConfig\": {\n \"model\": \"flux_schnell\"\n },\n \"voiceoverConfig\": {\n \"enabled\": true,\n \"voiceId\": \"zWDA589rUKXuLnPRDtAG\"\n },\n \"captionsConfig\": {\n \"captionsEnabled\": true,\n \"captionsStyle\": \"tiktok\"\n },\n \"effectsConfig\": {\n \"transition\": \"fade\",\n \"floating\": true\n },\n \"musicConfig\": {\n \"musicSlug\": \"gentle_ambient_loop\",\n \"enabled\": true,\n \"volume\": 0.3,\n \"loop\": true\n },\n \"videoConfig\": {\n \"enabled\": false,\n \"model\": \"luma_ray2\"\n },\n \"templateConfig\": {\n \"templateId\": \"none\"\n },\n \"quality\": \"medium\",\n \"aspectRatio\": \"9:16\"\n}"
response = http.request(request)
puts response.read_body{
"data": {
"id": "run_abc123",
"projectId": "proj_123abc"
},
"requestId": "req_123abc"
}Base URL
https://longstories.ai/api/v1
Check Styles, Music, Captions…
You can check the styles, music, captions, effects, and other parameters you have available for your video generation at longstories.ai/resources. Note: Despite the endpoint being named/short, this API supports generating videos up to 10 minutes in length.Authorizations
Your API key for authenticating requests. Example: 'x-api-key: MY_SECRET_KEY'
Body
Parameters used to initiate video creation. Provide at least one of prompt or script.
- Option 1
- Option 2
A textual description of what you want your video to depict or explain. Used to generate the script, scenes, and voiceover. MUTUALLY EXCLUSIVE with 'script' field - only provide one of 'prompt' or 'script'.
A fully-written script to skip AI script generation. MUTUALLY EXCLUSIVE with 'prompt' field - only provide one of 'prompt' or 'script'.
Prompt for the image generation engine. Example: 'Warm lighting' or 'Make the first image very impactful'
Experimental: if true, we choose a better framework for you and add Director Notes if necessary. It doesn't overwrite your settings.
Parameters for still-image generation used as video backgrounds or scenes.
Show child attributes
Show child attributes
Enables and customizes an AI voiceover for the generated script content.
Show child attributes
Show child attributes
Controls visual styling and position of text captions derived from the voiceover.
Show child attributes
Show child attributes
Controls visual transitions and animations applied between scenes. 'Random' picks a dynamic effect per scene.
Show child attributes
Show child attributes
Specifies a background music track and how it should be mixed with voiceover.
Show child attributes
Show child attributes
Configures video generation for each scene using an image-to-video model.
Show child attributes
Show child attributes
Internal use only - Template configuration for LongStories branding.
Show child attributes
Show child attributes
Video resolution & encoding quality. Higher quality takes longer to render and results in a larger file size. Note: Different quality levels will have different costs in the future, but currently only affect file size and visual quality.
high, medium, low Video aspect ratio - vertical (9:16) or horizontal (16:9)
9:16, 16:9 Response
Creation request accepted. Returns a generation Run ID used to fetch status or results later.