Skip to main content
POST
/
api
/
v1
/
projects
/
{projectId}
/
chapters
/
{chapterId}
/
prompt
{
  "prompt_id": "<string>",
  "status": "<string>",
  "message": "<string>",
  "estimated_time": "<string>",
  "VALIDATION_ERROR": {},
  "CONFLICT": {},
  "NOT_FOUND": {}
}

Overview

Submit a text prompt to create AI-powered video content for a specific chapter. The system processes the prompt and automatically creates video 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": "Create an engaging introduction about AI-powered video creation. Include dynamic text animations and smooth transitions."
  }'

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 = `
Create a professional introduction video for a tech startup.
- Show the company logo with a zoom-in animation
- Display the tagline "Innovating the Future" in bold text
- Use a modern, clean aesthetic with blue and white colors
- Add smooth fade transitions between scenes
- Duration: 15 seconds
`;

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