Start Export
curl --request POST \
--url https://api.example.com/api/v1/projects/{projectId}/export \
--header 'Authorization: <authorization>'import requests
url = "https://api.example.com/api/v1/projects/{projectId}/export"
headers = {"Authorization": "<authorization>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: '<authorization>'}};
fetch('https://api.example.com/api/v1/projects/{projectId}/export', 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.example.com/api/v1/projects/{projectId}/export",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/projects/{projectId}/export"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "<authorization>")
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.example.com/api/v1/projects/{projectId}/export")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/projects/{projectId}/export")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"status": "<string>",
"message": "<string>",
"estimated_time": "<string>",
"CONFLICT": {},
"NOT_FOUND": {},
"VALIDATION_ERROR": {}
}Exports
Start Export
Export a video project to a downloadable video file
POST
/
api
/
v1
/
projects
/
{projectId}
/
export
Start Export
curl --request POST \
--url https://api.example.com/api/v1/projects/{projectId}/export \
--header 'Authorization: <authorization>'import requests
url = "https://api.example.com/api/v1/projects/{projectId}/export"
headers = {"Authorization": "<authorization>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: '<authorization>'}};
fetch('https://api.example.com/api/v1/projects/{projectId}/export', 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.example.com/api/v1/projects/{projectId}/export",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/projects/{projectId}/export"
req, _ := http.NewRequest("POST", url, nil)
req.Header.Add("Authorization", "<authorization>")
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.example.com/api/v1/projects/{projectId}/export")
.header("Authorization", "<authorization>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/projects/{projectId}/export")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
response = http.request(request)
puts response.read_body{
"status": "<string>",
"message": "<string>",
"estimated_time": "<string>",
"CONFLICT": {},
"NOT_FOUND": {},
"VALIDATION_ERROR": {}
}Overview
Starts the export process for a complete video project. All chapters are rendered and combined into a single video file. The export typically takes 2-5 minutes depending on project complexity.Ensure all chapter prompts have completed processing before exporting. The export will only include completed chapters.
Request
Path Parameters
string
required
The project ID to export
Headers
string
required
Bearer token with your API key
Response
string
Export status:
queued, processing, completed, or failedstring
Human-readable status message
string
Estimated completion time (e.g., “2-5 minutes”)
Examples
curl -X POST https://api.babou.ai/api/v1/projects/prj_abc123xyz/export \
-H "Authorization: Bearer $BABOU_API_KEY"
async function startExport(projectId: string) {
const response = await fetch(
`https://api.babou.ai/api/v1/projects/${projectId}/export`,
{
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.BABOU_API_KEY}`
}
}
);
if (!response.ok) {
const error = await response.json();
throw new Error(`Export failed: ${error.error}`);
}
const result = await response.json();
console.log(`Export started: ${result.status}`);
console.log(`Estimated time: ${result.estimated_time}`);
return result;
}
await startExport('prj_abc123xyz');
import os
import requests
def start_export(project_id):
response = requests.post(
f'https://api.babou.ai/api/v1/projects/{project_id}/export',
headers={'Authorization': f'Bearer {os.environ["BABOU_API_KEY"]}'}
)
if not response.ok:
error = response.json()
raise Exception(f'Export failed: {error["error"]}')
result = response.json()
print(f'Export started: {result["status"]}')
print(f'Estimated time: {result["estimated_time"]}')
return result
start_export('prj_abc123xyz')
Response Example
{
"status": "queued",
"message": "Export started",
"estimated_time": "2-5 minutes"
}
Error Responses
409
Export already in progress for this project
{
"error": "An export is already in progress for this project",
"code": "CONFLICT",
"hint": "Wait for the current export to complete or check its status"
}
404
Project not found
{
"error": "Project not found",
"code": "NOT_FOUND"
}
400
Project has no completed chapters to export
{
"error": "Project has no completed chapters",
"code": "VALIDATION_ERROR",
"hint": "Add chapters and submit prompts before exporting"
}
Best Practices
Verify chapters are ready before exporting
Verify chapters are ready before exporting
Check that all chapters have completed processing:
async function ensureChaptersReady(projectId: string) {
const { chapters } = await listChapters(projectId);
if (chapters.length === 0) {
throw new Error('Project has no chapters');
}
for (const chapter of chapters) {
const fullChapter = await getChapter(projectId, chapter.id);
const latestPrompt = fullChapter.prompts?.[fullChapter.prompts.length - 1];
if (!latestPrompt || latestPrompt.status !== 'completed') {
throw new Error(`Chapter "${chapter.name}" is not ready for export`);
}
}
return true;
}
// Use before exporting
await ensureChaptersReady('prj_abc123xyz');
await startExport('prj_abc123xyz');
Handle existing exports
Handle existing exports
If an export is already in progress, wait for it to complete:
async function startExportSafe(projectId: string) {
try {
return await startExport(projectId);
} catch (error: any) {
if (error.message.includes('already in progress')) {
console.log('Export already running, checking status...');
return await getExportStatus(projectId);
}
throw error;
}
}
Poll for completion
Poll for completion
After starting an export, poll the status endpoint:
import time
def wait_for_export(project_id, max_wait=600):
"""Wait up to 10 minutes for export to complete"""
start_export(project_id)
start_time = time.time()
while time.time() - start_time < max_wait:
status = get_export_status(project_id)
if status['status'] == 'completed':
print(f'✓ Export complete: {status["download_url"]}')
return status
if status['status'] == 'failed':
raise Exception('Export failed')
print(f'Still processing... ({status["status"]})')
time.sleep(10) # Check every 10 seconds
raise Exception('Export timeout')
Next Steps
Get Export Status
Check export progress and get download URL
List Chapters
View chapters included in the export
⌘I