Overview
Class videos are educational-style videos where an AI avatar presents content with a script. They’re ideal for tutorials, onboarding, and course content.
Quick Example
const response = await fetch('https://api.hooked.ai/v1/project/create', {
method: 'POST',
headers: {
'x-api-key': 'your_api_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
type: 'class',
name: 'Product Tutorial',
script: `Hello! Welcome to this tutorial.
Today, I will show you how to use our product effectively.
Let me walk you through the key features step by step.`,
avatarId: 'avatar_sarah_01',
voiceId: 'tzX5paJ07p5hyWFcU3uG',
aspectRatio: 'ratio_9_16',
captions: true,
webhook: 'https://your-domain.com/webhook'
})
});
const data = await response.json();
console.log('Project ID:', data.data.projectId);
Step-by-Step
Get resources
Fetch available avatars and voices.curl -X GET "https://api.hooked.ai/v1/avatar/list" \
-H "x-api-key: your_api_key_here"
curl -X GET "https://api.hooked.ai/v1/voice/list?language=English" \
-H "x-api-key: your_api_key_here"
Create the video
curl -X POST "https://api.hooked.ai/v1/project/create" \
-H "x-api-key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"type": "class",
"name": "My Tutorial",
"script": "Hello! Welcome to this tutorial. Today I will show you how to use our product.",
"avatarId": "avatar_sarah_01",
"voiceId": "tzX5paJ07p5hyWFcU3uG",
"aspectRatio": "ratio_9_16",
"captions": true,
"webhook": "https://your-domain.com/webhook"
}'
Receive webhook
When the video finishes processing (typically 2-5 minutes), your webhook receives:{
"event": "project.completed",
"projectId": "proj_abc123",
"status": "completed",
"video": {
"url": "https://cdn.tryhooked.ai/videos/xyz789.mp4",
"duration": 45,
"thumbnail": "https://cdn.tryhooked.ai/thumbnails/xyz789.jpg"
}
}
Parameters
| Parameter | Type | Required | Description |
|---|
type | string | Yes | Must be "class" |
name | string | No | Video title |
script | string | Yes | The narration text (10-5000 characters) |
avatarId | string | Yes | Avatar to use as presenter |
voiceId | string | Yes | Voice for narration |
aspectRatio | string | No | ratio_9_16 (default) or ratio_16_9 |
captions | boolean | No | Enable auto-generated captions |
music | string | No | Background music track ID |
webhook | string | No | URL for completion notification |
Tips
Write natural scripts: Use conversational language with natural pauses (commas, periods) for more authentic delivery.
Match voice to avatar: Select voices that match the avatar’s gender and age for the best results.