Skip to main content
POST
/
api
/
v1
/
projects
/
{projectId}
/
chapters
/
{chapterId}
/
prompt
Submit Prompt
curl --request POST \
  --url https://api.example.com/api/v1/projects/{projectId}/chapters/{chapterId}/prompt \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: <content-type>' \
  --data '
{
  "content": "<string>",
  "force": true
}
'
{
  "prompt_id": "<string>",
  "status": "<string>",
  "message": "<string>",
  "estimated_time": "<string>",
  "VALIDATION_ERROR": {},
  "CONFLICT": {},
  "NOT_FOUND": {}
}

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

Submit a prompt to a chapter, describing what to build. The system processes the prompt and creates the chapter content, typically completing in 30-90 seconds.
If a chapter already has a prompt being processed, this endpoint returns a 409 Conflict error unless you set force: true to override.

Request

Path Parameters

projectId
string
required
The project ID
chapterId
string
required
The chapter ID

Headers

Authorization
string
required
Bearer token with your API key
Content-Type
string
required
Must be application/json

Body

content
string
required
The prompt text describing the video content you want to create (1-5000 characters)
force
boolean
default:"false"
Force processing even if another prompt is already being processed for this chapter

Response

prompt_id
string
Unique identifier for the submitted prompt
status
string
Processing status: processing, completed, or failed
message
string
Human-readable status message
estimated_time
string
Estimated processing time (e.g., “30-90 seconds”)

Examples

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": "30-second product launch ad for the new Team tier. Lead with the headline from our latest release notes, drop in the new pricing screenshot, and resolve brand colors and type from the catalog."
  }'

Response Example

{
  "prompt_id": "int_abc123xyz789",
  "status": "processing",
  "message": "Prompt processing started",
  "estimated_time": "30-90 seconds"
}

Error Responses

VALIDATION_ERROR
400
Invalid prompt content
{
  "error": "Validation failed",
  "code": "VALIDATION_ERROR",
  "hint": "Content must be between 1 and 5000 characters"
}
CONFLICT
409
Another prompt is already being processed for this chapter
{
  "error": "A prompt is already being processed for this chapter",
  "code": "CONFLICT",
  "hint": "Wait for the current prompt to complete or set force: true to override"
}
NOT_FOUND
404
Project or chapter not found
{
  "error": "Chapter not found",
  "code": "NOT_FOUND"
}

Best Practices

Be specific about what you want in your video. Include details about:
  • Visual style and aesthetics
  • Text content and messaging
  • Transitions and animations
  • Mood and tone
const prompt = `
30-second product launch ad for the new Team tier.
- Lead with the headline from our latest release notes
- Show the updated pricing screenshot at 5s
- Resolve brand colors and type from the catalog
- Close on a CTA matching the pricing page button
`;

await submitPrompt(projectId, chapterId, prompt);
After submitting a prompt, the video content is created asynchronously. Use the Get Chapter endpoint to check when processing is complete:
async function waitForPromptCompletion(
  projectId: string,
  chapterId: string,
  maxAttempts = 20
) {
  for (let i = 0; i < maxAttempts; i++) {
    const chapter = await getChapter(projectId, chapterId);
    const latestPrompt = chapter.prompts[chapter.prompts.length - 1];

    if (latestPrompt.status === 'completed') {
      return latestPrompt;
    }

    if (latestPrompt.status === 'failed') {
      throw new Error('Prompt processing failed');
    }

    await new Promise(r => setTimeout(r, 5000)); // Wait 5s
  }

  throw new Error('Timeout waiting for prompt completion');
}
If you get a 409 error, decide whether to:
  1. Wait for the current prompt to complete
  2. Override with force: true (use cautiously)
async function submitPromptSafe(
  projectId: string,
  chapterId: string,
  content: string
) {
  try {
    return await submitPrompt(projectId, chapterId, content);
  } catch (error: any) {
    if (error.message.includes('already being processed')) {
      console.log('Waiting for current prompt to complete...');
      await waitForPromptCompletion(projectId, chapterId);
      // Retry submission
      return await submitPrompt(projectId, chapterId, content);
    }
    throw error;
  }
}
If you’ve uploaded assets, reference them in your prompts:
// Upload asset first
const logo = await uploadAsset('./company-logo.png', 'image/png');

// Reference in prompt
const prompt = `
Create an intro video using the uploaded company logo (${logo.url}).
Animate the logo with a fade-in effect over 3 seconds.
Add the text "Welcome" below the logo.
`;

await submitPrompt(projectId, chapterId, prompt);

Next Steps

Get Chapter

Check processing status

Export Project

Export your completed video

Video Creation Guide

Learn more about creating videos