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

# Enrollment

> Assign pensums and courses, and activate users.

A user takes **one course at a time**: the active one. Content for that course is delivered on the
user's days and hour. There are two ways to decide what a user takes.

## Assign a pensum (recommended)

A pensum is an ordered list of courses. When you enroll a user, hackU activates the first course of
the pensum they have not finished, and moves them to the next one as they complete each course.

```bash theme={null}
POST /clients/users/{user_id}/assign-pensum/
{ "pensum_id": 58, "is_active": true }
```

* `is_active: true` (default) makes this the user's current pensum and deactivates their other pensums.
* Calling it again with the same pensum updates the enrollment; it never duplicates it.
* If the user already finished every course of the pensum, no course is activated.

Your account manager gives you the ids of your company's pensums.

## Set a specific course and module

To place a user directly on a course, at a given module:

```bash theme={null}
POST /clients/users/{user_id}/set-module/
{ "route_pk": 731, "module_pk": 5120 }
```

The module must belong to the course. This replaces the user's active course: any other active
course is deactivated (its progress is kept). Get course and module ids from `GET /clients/routes/`.

## Activate the user

A user receives content only while active (`is_client: true`). When you create a user, hackU
activates them by default, using one of your company's seats:

* `send_welcome_message: true` also sends the WhatsApp welcome message.
* `silent_creation: true` creates the user without activating them.
* If your company has no seats left, the user is created but not activated. Check `is_client` with
  `GET /clients/users/{user_id}/` after creating users in bulk.

To activate or deactivate a user later:

```bash theme={null}
POST /clients/users/{user_id}/switch-client/
{ "active": true, "avoid_send_welcome": false }
```

Activating requires the user to have an active course (with an active module); the welcome message is sent unless
`avoid_send_welcome` is `true`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.