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

## Body

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

<ParamField body="type" type="enum" required>`essay` | `upload` | `code` | `oral` | `project`.</ParamField>

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

<ParamField body="description" type="string" />

<ParamField body="due_at" type="string">ISO 8601.</ParamField>

<ParamField body="rubric" type="Rubric" required />

## Examples

<CodeGroup>
  ```ts TypeScript theme={null}
  await hk.assignments.create({
    lesson_id: "lsn_123",
    type: "essay",
    title: "Explain mass-energy equivalence",
    rubric: {
      scale: { min: 0, max: 10 },
      criteria: [
        { name: "clarity",  weight: 0.4 },
        { name: "accuracy", weight: 0.4 },
        { name: "sources",  weight: 0.2 },
      ],
    },
  });
  ```

  ```php PHP theme={null}
  $hk->assignments->create([
      'lesson_id' => 'lsn_123',
      'type' => 'essay',
      'title' => 'Explain mass-energy equivalence',
      'rubric' => [
          'scale' => ['min' => 0, 'max' => 10],
          'criteria' => [
              ['name' => 'clarity',  'weight' => 0.4],
              ['name' => 'accuracy', 'weight' => 0.4],
              ['name' => 'sources',  'weight' => 0.2],
          ],
      ],
  ]);
  ```
</CodeGroup>

## Returns

An [Assignment](/api-reference/assignments/object).
