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

# Course Modules

> Attach and detach modules from a course, and define their order and requirements.

# Course Modules

After creating a course and its modules separately, you must explicitly attach modules to the course. The attachment defines the module's position, whether it is required, and its workload within this specific course.

***

## List attachable modules

Returns modules that belong to the same institution and are not yet attached to this course.

```http theme={null}
GET /courses/{course_uuid}/attach/modules
```

<CodeGroup>
  ```bash cURL theme={null}
  curl "https://api.dokstamp.com/courses/c3d4e5f6-a7b8-9012-cdef-123456789012/attach/modules" \
    -H "Authorization: Bearer {TOKEN}" \
    -H "Accept: application/json" \
    -H "X-Tenant: {TENANT}"
  ```
</CodeGroup>

***

## Attach modules to a course

```http theme={null}
POST /courses/{course_uuid}/attach/modules
```

| Parameter                            | Type    | Required | Description                                            |
| ------------------------------------ | ------- | -------- | ------------------------------------------------------ |
| `modules`                            | array   | Yes      | Array of module attachment objects                     |
| `modules[].uuid`                     | string  | Yes      | Module UUID                                            |
| `modules[].order`                    | integer | No       | Position in the course curriculum                      |
| `modules[].is_required`              | boolean | No       | Override the module's default `is_required`            |
| `modules[].workload`                 | integer | No       | Override the module's default workload for this course |
| `modules[].course_module_group_uuid` | string  | No       | Assign to a module group                               |

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.dokstamp.com/courses/c3d4e5f6-a7b8-9012-cdef-123456789012/attach/modules" \
    -H "Authorization: Bearer {TOKEN}" \
    -H "Accept: application/json" \
    -H "Content-Type: application/json" \
    -H "X-Tenant: {TENANT}" \
    -d '{
      "modules": [
        {
          "uuid": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
          "order": 1,
          "is_required": true,
          "workload": 80
        },
        {
          "uuid": "c3d4e5f6-a7b8-9012-cdef-123456789013",
          "order": 2,
          "is_required": true,
          "workload": 60
        }
      ]
    }'
  ```
</CodeGroup>

***

## Detach modules from a course

```http theme={null}
DELETE /courses/{course_uuid}/detach/modules
```

| Parameter | Type  | Required | Description                     |
| --------- | ----- | -------- | ------------------------------- |
| `modules` | array | Yes      | Array of module UUIDs to detach |

```json theme={null}
{ "modules": ["b2c3d4e5-f6a7-8901-bcde-f12345678901"] }
```

<Warning>
  Detaching a module from a course does not delete the module itself — only the association is removed. The module remains available to attach to other courses.
</Warning>
