Skip to main content
POST
/
api
/
v1
/
projects
/
{projectId}
/
export
{
  "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

projectId
string
required
The project ID to export

Headers

Authorization
string
required
Bearer token with your API key

Response

status
string
Export status: queued, processing, completed, or failed
message
string
Human-readable status message
estimated_time
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"

Response Example

{
  "status": "queued",
  "message": "Export started",
  "estimated_time": "2-5 minutes"
}

Error Responses

CONFLICT
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"
}
NOT_FOUND
404
Project not found
{
  "error": "Project not found",
  "code": "NOT_FOUND"
}
VALIDATION_ERROR
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

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');
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;
  }
}
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