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.
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." }'
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"}
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);
Wait for processing to complete
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');}
Handle conflicts gracefully
If you get a 409 error, decide whether to:
Wait for the current prompt to complete
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; }}
Reference uploaded assets
If you’ve uploaded assets, reference them in your prompts:
// Upload asset firstconst logo = await uploadAsset('./company-logo.png', 'image/png');// Reference in promptconst 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);