> For the complete documentation index, see [llms.txt](https://guide.fariaedu.com/integrations-portal/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://guide.fariaedu.com/integrations-portal/managebac/recipes/fetching-term-grades.md).

# Fetching Term Grades

The API endpoint "Get Term Grades for a Class" with no explicit parameters only returns records of current students currently enrolled into the class. In other words, only term grade records for students who are not archived and still a member of the class are returned.

Additional parameters permit the fetching of students who are either archived, no longer a member of a class, or both. The logic table below demonstrates the conditions and what effect the parameters have.

A check indicates that the records will be included under the given condition with the given parameters passed in the query:

| Condition                             | include\_archived\_students | unenrolled\_only | include\_archived\_students + unenrolled only |
| ------------------------------------- | --------------------------- | ---------------- | --------------------------------------------- |
| Student removed from class            | ❌                           | ✔️               | ✔️                                            |
| Student archived                      | ✔️                          | ❌                | ❌                                             |
| Student removed from class + archived | ❌                           | ❌                | ✔️                                            |

The same endpoint requires the archived parameter to be passed for archived classes. Otherwise, there will be a 404 error.

| Condition             | archived not passed | archived passed |
| --------------------- | ------------------- | --------------- |
| Class is not archived | ✔️                  | 404             |
| Class is archived     | 404                 | ✔️              |
