Documentation Index
Fetch the complete documentation index at: https://docs.babou.ai/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Check the progress of an export job for a project. When the export is complete, this endpoint returns a download URL for the final video.
Request
Path Parameters
Bearer token with your API key
Response
Current export status: queued, processing, completed, or failed
URL to download the completed video (only present when status is completed, otherwise null)
Error message if export failed (only present when status is failed)
Examples
curl https://api.babou.ai/api/v1/projects/prj_abc123xyz/export \
-H "Authorization: Bearer $BABOU_API_KEY"
Response Examples
Export in Progress
{
"status": "processing",
"download_url": null
}
Export Completed
{
"status": "completed",
"download_url": "https://assets.babou.ai/exports/prj_abc123xyz.mp4"
}
Export Failed
{
"status": "failed",
"error": "Failed to render chapter 2"
}
Polling for Completion
To wait for an export to complete, poll this endpoint periodically:
async function waitForExport(
projectId: string,
pollInterval = 5000,
timeout = 600000
) {
const startTime = Date.now();
while (Date.now() - startTime < timeout) {
const status = await getExportStatus(projectId);
if (status.status === 'completed') {
return status;
}
if (status.status === 'failed') {
throw new Error(`Export failed: ${status.error}`);
}
console.log(`Export ${status.status}... (${Math.round((Date.now() - startTime) / 1000)}s elapsed)`);
await new Promise(resolve => setTimeout(resolve, pollInterval));
}
throw new Error('Export timeout after 10 minutes');
}
// Use it
const result = await waitForExport('prj_abc123xyz');
console.log('✓ Video ready!');
console.log(`Download: ${result.download_url}`);
console.log(`Took ${result.duration_seconds} seconds`);
Downloading the Video
Once the export is complete, download the video file:
# Get the download URL
DOWNLOAD_URL=$(curl -s https://api.babou.ai/api/v1/projects/prj_abc123xyz/export \
-H "Authorization: Bearer $BABOU_API_KEY" | jq -r '.download_url')
# Download the video
curl -o video.mp4 "$DOWNLOAD_URL"
Error Responses
No export found for this project{
"error": "No export found for this project",
"code": "NOT_FOUND",
"hint": "Start an export first using POST /api/v1/projects/{projectId}/export"
}
Best Practices
Implement exponential backoff
Use increasing intervals when polling to reduce API load:async function waitForExportWithBackoff(projectId: string) {
let interval = 2000; // Start at 2 seconds
const maxInterval = 30000; // Cap at 30 seconds
const startTime = Date.now();
while (true) {
const status = await getExportStatus(projectId);
if (status.status === 'completed') return status;
if (status.status === 'failed') throw new Error('Export failed');
await new Promise(r => setTimeout(r, interval));
// Increase interval (exponential backoff)
interval = Math.min(interval * 1.5, maxInterval);
}
}
Handle download URL expiration
Download URLs may expire after a certain time. Download the video promptly:def download_with_retry(url, output_path, max_retries=3):
for attempt in range(max_retries):
try:
response = requests.get(url, timeout=60)
response.raise_for_status()
with open(output_path, 'wb') as f:
f.write(response.content)
return True
except Exception as e:
if attempt == max_retries - 1:
raise
print(f'Download failed, retrying... ({attempt + 1}/{max_retries})')
time.sleep(2 ** attempt)
Keep users informed during the export wait:async function exportWithProgress(projectId: string) {
console.log('Starting export...');
await startExport(projectId);
let lastStatus = '';
const result = await waitForExport(projectId, 5000, 600000);
console.log('✓ Export completed!');
console.log(` Duration: ${result.duration_seconds}s`);
console.log(` Download: ${result.download_url}`);
return result;
}
Next Steps
Start Export
Start a new export
Create New Project
Create another video project