Create Chapter
curl --request POST \
--url https://api.example.com/api/v1/projects/{projectId}/chapters \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"name": "<string>",
"duration": 123
}
'import requests
url = "https://api.example.com/api/v1/projects/{projectId}/chapters"
payload = {
"name": "<string>",
"duration": 123
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "<content-type>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': '<content-type>'},
body: JSON.stringify({name: '<string>', duration: 123})
};
fetch('https://api.example.com/api/v1/projects/{projectId}/chapters', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/projects/{projectId}/chapters",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'duration' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/projects/{projectId}/chapters"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"duration\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "<content-type>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/projects/{projectId}/chapters")
.header("Authorization", "<authorization>")
.header("Content-Type", "<content-type>")
.body("{\n \"name\": \"<string>\",\n \"duration\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/projects/{projectId}/chapters")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = '<content-type>'
request.body = "{\n \"name\": \"<string>\",\n \"duration\": 123\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"project_id": "<string>",
"name": "<string>",
"duration": 123,
"created_at": "<string>",
"VALIDATION_ERROR": {},
"NOT_FOUND": {}
}Chapters
Create Chapter
Add a new chapter to a video project
POST
/
api
/
v1
/
projects
/
{projectId}
/
chapters
Create Chapter
curl --request POST \
--url https://api.example.com/api/v1/projects/{projectId}/chapters \
--header 'Authorization: <authorization>' \
--header 'Content-Type: <content-type>' \
--data '
{
"name": "<string>",
"duration": 123
}
'import requests
url = "https://api.example.com/api/v1/projects/{projectId}/chapters"
payload = {
"name": "<string>",
"duration": 123
}
headers = {
"Authorization": "<authorization>",
"Content-Type": "<content-type>"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<authorization>', 'Content-Type': '<content-type>'},
body: JSON.stringify({name: '<string>', duration: 123})
};
fetch('https://api.example.com/api/v1/projects/{projectId}/chapters', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/api/v1/projects/{projectId}/chapters",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'name' => '<string>',
'duration' => 123
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/api/v1/projects/{projectId}/chapters"
payload := strings.NewReader("{\n \"name\": \"<string>\",\n \"duration\": 123\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<authorization>")
req.Header.Add("Content-Type", "<content-type>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/api/v1/projects/{projectId}/chapters")
.header("Authorization", "<authorization>")
.header("Content-Type", "<content-type>")
.body("{\n \"name\": \"<string>\",\n \"duration\": 123\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/api/v1/projects/{projectId}/chapters")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<authorization>'
request["Content-Type"] = '<content-type>'
request.body = "{\n \"name\": \"<string>\",\n \"duration\": 123\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"project_id": "<string>",
"name": "<string>",
"duration": 123,
"created_at": "<string>",
"VALIDATION_ERROR": {},
"NOT_FOUND": {}
}Overview
Creates a new chapter within a project. Chapters are segments of your video that can have individual content and duration.Request
Path Parameters
string
required
The project ID
Headers
string
required
Bearer token with your API key
string
required
Must be
application/jsonBody
string
required
Chapter name (1-30 characters)
number
Optional duration in seconds (must be positive integer)
Response
string
Unique chapter identifier (format:
cht_[A-Za-z0-9]{21})string
Parent project ID
string
Chapter name
number
Duration in seconds
string
ISO 8601 timestamp when the chapter was created
Examples
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
}'
async function createChapter(
projectId: string,
name: string,
duration?: number
) {
const response = await fetch(
`https://api.babou.ai/api/v1/projects/${projectId}/chapters`,
{
method: 'POST',
headers: {
'Authorization': `Bearer ${process.env.BABOU_API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({ name, duration })
}
);
return await response.json();
}
const chapter = await createChapter('prj_abc123xyz', 'Introduction', 30);
console.log('Created chapter:', chapter.id);
import os
import requests
def create_chapter(project_id, name, duration=None):
response = requests.post(
f'https://api.babou.ai/api/v1/projects/{project_id}/chapters',
headers={
'Authorization': f'Bearer {os.environ["BABOU_API_KEY"]}',
'Content-Type': 'application/json'
},
json={'name': name, 'duration': duration}
)
return response.json()
chapter = create_chapter('prj_abc123xyz', 'Introduction', 30)
print(f'Created chapter: {chapter["id"]}')
Response Example
{
"id": "cht_def456uvw",
"project_id": "prj_abc123xyz",
"name": "Introduction",
"duration": 30,
"created_at": "2025-12-02T10:01:00Z"
}
Error Responses
400
Invalid request parameters
{
"error": "Validation failed",
"code": "VALIDATION_ERROR",
"hint": "Name must be between 1 and 30 characters"
}
404
Project not found
{
"error": "Project not found",
"code": "NOT_FOUND"
}
Next Steps
Submit Prompt
Add video content to this chapter
List Chapters
View all chapters in the project
⌘I