Skip to main content

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

1

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"
2

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"
  }'
3

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

ParameterTypeRequiredDescription
typestringYesMust be "class"
namestringNoVideo title
scriptstringYesThe narration text (10-5000 characters)
avatarIdstringYesAvatar to use as presenter
voiceIdstringYesVoice for narration
aspectRatiostringNoratio_9_16 (default) or ratio_16_9
captionsbooleanNoEnable auto-generated captions
musicstringNoBackground music track ID
webhookstringNoURL 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.