> ## Documentation Index
> Fetch the complete documentation index at: https://docs.hooked.so/llms.txt
> Use this file to discover all available pages before exploring further.

# Class Video

> Create an educational class-style video with an AI avatar presenter

## 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

```javascript theme={null}
const response = await fetch('https://api.hooked.so/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

<Steps>
  <Step title="Get resources">
    Fetch available avatars and voices.

    ```bash theme={null}
    curl -X GET "https://api.hooked.so/v1/avatar/list" \
      -H "x-api-key: your_api_key_here"

    curl -X GET "https://api.hooked.so/v1/voice/list?language=English" \
      -H "x-api-key: your_api_key_here"
    ```
  </Step>

  <Step title="Create the video">
    ```bash theme={null}
    curl -X POST "https://api.hooked.so/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"
      }'
    ```
  </Step>

  <Step title="Receive webhook">
    When the video finishes processing (typically 2-5 minutes), your webhook receives:

    ```json theme={null}
    {
      "event": "project.completed",
      "projectId": "proj_abc123",
      "status": "completed",
      "video": {
        "url": "https://cdn.hooked.so/videos/xyz789.mp4",
        "duration": 45,
        "thumbnail": "https://cdn.hooked.so/thumbnails/xyz789.jpg"
      }
    }
    ```
  </Step>
</Steps>

## 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

<Tip>
  **Write natural scripts**: Use conversational language with natural pauses (commas, periods) for more authentic delivery.
</Tip>

<Tip>
  **Match voice to avatar**: Select voices that match the avatar's gender and age for the best results.
</Tip>

## Related

<CardGroup cols={2}>
  <Card title="Quickstart" icon="rocket" href="/quickstart">
    Get started in 5 minutes
  </Card>

  <Card title="Talking Avatar" icon="user" href="/examples/talking-avatar">
    UGC-style talking avatar videos
  </Card>

  <Card title="Script to Video" icon="scroll" href="/examples/script-to-video">
    Generate videos from scripts
  </Card>

  <Card title="Webhooks" icon="webhook" href="/guides/webhooks">
    Handle completion notifications
  </Card>
</CardGroup>
