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

# Generate activities

> Generate a mix of activities for one or more lessons in one call.

## Body

<ParamField body="lesson_id" type="string">Generate for one lesson.</ParamField>
<ParamField body="unit_id" type="string">Generate for every lesson in a unit.</ParamField>
<ParamField body="cohort_id" type="string">Generate for every lesson in a cohort.</ParamField>
<ParamField body="count" type="integer" default="5">Activities per lesson.</ParamField>

<ParamField body="types" type="string[]">
  Optional weighting. Defaults to a balanced mix:
  `["explain", "quiz", "flashcard", "remember"]`.
</ParamField>

Exactly one of `lesson_id`, `unit_id`, or `cohort_id` is required.

## Examples

<CodeGroup>
  ```ts TypeScript theme={null}
  // One lesson
  await hk.activities.generate({
    lesson_id: "lsn_123",
    count: 5,
    types: ["explain", "quiz", "flashcard"],
  });

  // Whole cohort
  await hk.activities.generate({ cohort_id: "coh_123", count: 5 });
  ```

  ```php PHP theme={null}
  // One lesson
  $hk->activities->generate([
      'lesson_id' => 'lsn_123',
      'count' => 5,
      'types' => ['explain', 'quiz', 'flashcard'],
  ]);

  // Whole cohort
  $hk->activities->generate(['cohort_id' => 'coh_123', 'count' => 5]);
  ```
</CodeGroup>

## Returns

A handle:

```json theme={null}
{
  "id": "gen_01HX9...",
  "status": "pending",
  "scope": { "cohort_id": "coh_123", "lesson_count": 12 },
  "estimated_ready_at": "2026-05-10T12:05:30Z"
}
```

[Poll or webhook-listen](/concepts/ai-generation) for completion.
