Skip to main content

Create Your First Video

Five minutes. Four API calls. One professional video. Let’s build it.
1

Get Your API Key

If you haven’t already, get your API key from the Babou dashboard and set it as an environment variable:
export BABOU_API_KEY=sk-bab-your-api-key-here
2

Create a Project

Every video starts with a project. Create one with a name and description:
curl -X POST https://api.babou.ai/api/v1/projects \
  -H "Authorization: Bearer $BABOU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "My First Video",
    "description": "A test video created with Babou"
  }'
Response:
{
  "id": "prj_abc123xyz",
  "name": "My First Video",
  "description": "A test video created with Babou",
  "created_at": "2025-12-02T10:00:00Z"
}
Save the project.id - you’ll need it for the next steps!
3

Add a Chapter

Videos are organized into chapters. Let’s add one:
curl -X POST https://api.babou.ai/api/v1/projects/prj_abc123xyz/chapters \
  -H "Authorization: Bearer $BABOU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Introduction",
    "duration": 30
  }'
Response:
{
  "id": "cht_def456uvw",
  "project_id": "prj_abc123xyz",
  "name": "Introduction",
  "duration": 30,
  "created_at": "2025-12-02T10:01:00Z"
}
4

Submit a Video Prompt

Now for the magic! Submit a text prompt to create video content:
curl -X POST https://api.babou.ai/api/v1/projects/prj_abc123xyz/chapters/cht_def456uvw/prompt \
  -H "Authorization: Bearer $BABOU_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content": "Create an engaging introduction video about AI-powered video creation. Include dynamic text animations and smooth transitions."
  }'
Response:
{
  "prompt_id": "int_abc123xyz789",
  "status": "processing",
  "message": "Prompt processing started",
  "estimated_time": "30-90 seconds"
}
The video creation process typically takes 30-90 seconds. The chapter will be updated with the video content automatically.
5

Export Your Video

Once processing is complete, export the final video:
curl -X POST https://api.babou.ai/api/v1/projects/prj_abc123xyz/export \
  -H "Authorization: Bearer $BABOU_API_KEY"
Response:
{
  "status": "queued",
  "message": "Export started",
  "estimated_time": "2-5 minutes"
}
6

Check Export Status

Poll the export endpoint to check when your video is ready:
curl https://api.babou.ai/api/v1/projects/prj_abc123xyz/export \
  -H "Authorization: Bearer $BABOU_API_KEY"
Response (when completed):
{
  "status": "completed",
  "download_url": "https://assets.babou.ai/exports/prj_abc123xyz.mp4",
  "started_at": "2025-12-02T10:05:00Z",
  "completed_at": "2025-12-02T10:08:00Z",
  "duration_seconds": 180
}

Complete Example

Here’s a complete script that creates a video from start to finish:
const BABOU_API_KEY = process.env.BABOU_API_KEY;
const BASE_URL = 'https://api.babou.ai/api/v1';

async function createVideo() {
  // 1. Create project
  const projectRes = await fetch(`${BASE_URL}/projects`, {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${BABOU_API_KEY}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      name: 'My First Video',
      description: 'Created via API'
    })
  });
  const project = await projectRes.json();
  console.log('✓ Project created:', project.id);

  // 2. Add chapter
  const chapterRes = await fetch(
    `${BASE_URL}/projects/${project.id}/chapters`,
    {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${BABOU_API_KEY}`,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        name: 'Introduction',
        duration: 30
      })
    }
  );
  const chapter = await chapterRes.json();
  console.log('✓ Chapter created:', chapter.id);

  // 3. Submit prompt
  const promptRes = await fetch(
    `${BASE_URL}/projects/${project.id}/chapters/${chapter.id}/prompt`,
    {
      method: 'POST',
      headers: {
        'Authorization': `Bearer ${BABOU_API_KEY}`,
        'Content-Type': 'application/json'
      },
      body: JSON.stringify({
        content: 'Create an engaging intro about AI video creation'
      })
    }
  );
  console.log('✓ Prompt submitted, processing...');

  // Wait for processing
  await new Promise(resolve => setTimeout(resolve, 60000));

  // 4. Export video
  await fetch(`${BASE_URL}/projects/${project.id}/export`, {
    method: 'POST',
    headers: { 'Authorization': `Bearer ${BABOU_API_KEY}` }
  });
  console.log('✓ Export started...');

  // 5. Wait for completion
  while (true) {
    const statusRes = await fetch(
      `${BASE_URL}/projects/${project.id}/export`,
      {
        headers: { 'Authorization': `Bearer ${BABOU_API_KEY}` }
      }
    );
    const status = await statusRes.json();

    if (status.status === 'completed') {
      console.log('✓ Video ready!');
      console.log('Download:', status.download_url);
      break;
    }

    await new Promise(resolve => setTimeout(resolve, 5000));
  }
}

createVideo();

Next Steps