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

# Create an activity

> Create a single activity by type. Async — the body is generated by the AI unless you pass `questions` explicitly.

## Body

<ParamField body="lesson_id" type="string" required />

<ParamField body="type" type="enum" required>
  See [The Activity object](/api-reference/activities/object) for the
  full enum.
</ParamField>

<ParamField body="variant" type="string">Required for `type: "quiz"`.</ParamField>

<ParamField body="prompt" type="string">
  Free-text instruction. Defaults to a sensible derivation from the
  lesson context.
</ParamField>

<ParamField body="difficulty" type="enum">`easy` | `intermediate` | `hard`.</ParamField>
<ParamField body="count" type="integer">For quiz-like activities, number of questions to generate.</ParamField>

<ParamField body="questions" type="Question[]">
  Pass explicit questions to skip AI generation.
</ParamField>

## Examples

<CodeGroup>
  ```ts TypeScript theme={null}
  // AI-generated 5-item true/false quiz
  await hk.activities.create({
    lesson_id: "lsn_123",
    type: "quiz",
    variant: "true_false",
    count: 5,
    difficulty: "intermediate",
  });

  // Hand-authored short-answer
  await hk.activities.create({
    lesson_id: "lsn_123",
    type: "short_answer",
    questions: [{ prompt: "Define proper time in three sentences." }],
  });

  // Generate a 5-min audio recap
  await hk.activities.create({
    lesson_id: "lsn_123",
    type: "podcast",
  });
  ```

  ```php PHP theme={null}
  // AI-generated 5-item true/false quiz
  $hk->activities->create([
      'lesson_id' => 'lsn_123',
      'type' => 'quiz',
      'variant' => 'true_false',
      'count' => 5,
      'difficulty' => 'intermediate',
  ]);

  // Hand-authored short-answer
  $hk->activities->create([
      'lesson_id' => 'lsn_123',
      'type' => 'short_answer',
      'questions' => [['prompt' => 'Define proper time in three sentences.']],
  ]);

  // Generate a 5-min audio recap
  $hk->activities->create([
      'lesson_id' => 'lsn_123',
      'type' => 'podcast',
  ]);
  ```
</CodeGroup>

## Returns

An [Activity](/api-reference/activities/object) in `ai_status: "pending"`
unless you passed `questions` explicitly.
