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

# GET /api/v3/admin/homeworks/{id} — Get Homework Details

> Retrieve a single homework class by its ID, with its assignment details and all student submissions. Returns 404 if the class is missing or has no homework.

This endpoint returns a single homework class by its ID, including all student submissions associated with that class. Use it to review the assignment details and the full list of student responses for a specific class.

## Endpoint

```
GET /api/v3/admin/homeworks/{id}
```

**Required role:** Admin

## Required Headers

| Header          | Value              |
| --------------- | ------------------ |
| `Authorization` | `Bearer <token>`   |
| `Accept`        | `application/json` |

## Path Parameters

<ParamField path="id" type="integer" required>
  The unique class ID. Must be a numeric value.
</ParamField>

<Note>
  This route only accepts numeric IDs. Passing a non-numeric value — for example, `/admin/homeworks/abc` — returns a standard `404` response.
</Note>

## Example Request

```bash theme={null}
curl -X GET https://app.example.com/api/v3/admin/homeworks/42 \
  -H "Authorization: Bearer your-token" \
  -H "Accept: application/json"
```

## Response

### 200 OK

The example below shows a class with two submissions: one that has been reviewed and graded, and one that is still pending review.

```json theme={null}
{
  "id": 42,
  "title": "Lesson 3 — Algebra",
  "course_id": 5,
  "course_title": "Math Grade 10",
  "has_assignment": true,
  "assignment_deadline": "30/06/2026 11:59 PM",
  "assignment_description": "Solve problems 1-10 from chapter 3.",
  "assignment_file_url": "https://cdn.example.com/media/10/homework.pdf",
  "created_at": "2026-06-01 10:00:00",
  "submissions": [
    {
      "id": 101,
      "student_id": 77,
      "student_name": "Ahmed Ali",
      "student_email": "ahmed@example.com",
      "rating": 8,
      "instructor_comment": "Good work, but check question 4.",
      "is_reviewed": true,
      "submitted_at": "2026-06-05 14:30:00",
      "files": [{"id": 55, "name": "my_homework.pdf", "url": "https://cdn.example.com/media/55/my_homework.pdf"}],
      "download_url": "https://app.example.com/api/v3/assignments/download/101"
    },
    {
      "id": 102,
      "student_id": 88,
      "student_name": "Sara Mohamed",
      "student_email": "sara@example.com",
      "rating": null,
      "instructor_comment": null,
      "is_reviewed": false,
      "submitted_at": "2026-06-06 09:10:00",
      "files": [],
      "download_url": null
    }
  ]
}
```

### Response Fields

<ResponseField name="id" type="integer">
  The unique class ID.
</ResponseField>

<ResponseField name="title" type="string">
  The title of the class.
</ResponseField>

<ResponseField name="course_id" type="integer">
  The ID of the parent course this class belongs to.
</ResponseField>

<ResponseField name="course_title" type="string | null">
  The title of the parent course. Returns `null` if the course has been deleted.
</ResponseField>

<ResponseField name="has_assignment" type="boolean">
  Indicates whether the class has a PDF homework assignment. Always `true` for classes returned by this endpoint.
</ResponseField>

<ResponseField name="assignment_deadline" type="string | null">
  The submission deadline for the assignment, formatted as `dd/MM/YYYY hh:mm AM|PM`. Returns `null` if no deadline was set.
</ResponseField>

<ResponseField name="assignment_description" type="string | null">
  The instructor's written homework instructions. Returns `null` if no description was provided.
</ResponseField>

<ResponseField name="assignment_file_url" type="string | null">
  The URL to the instructor's homework PDF file. Returns `null` if no file has been uploaded.
</ResponseField>

<ResponseField name="created_at" type="string">
  The timestamp when the class was created, formatted as `YYYY-MM-DD HH:mm:ss`.
</ResponseField>

<ResponseField name="submissions" type="array">
  Array of SubmissionObjects representing student homework submissions. Returns an empty array if no submissions exist.

  <Expandable title="SubmissionObject fields">
    <ResponseField name="id" type="integer">
      The unique submission ID.
    </ResponseField>

    <ResponseField name="student_id" type="integer">
      The user ID of the student who submitted the homework.
    </ResponseField>

    <ResponseField name="student_name" type="string | null">
      The full name of the student. Returns `null` if the user account has been deleted.
    </ResponseField>

    <ResponseField name="student_email" type="string | null">
      The email address of the student. Returns `null` if the user account has been deleted.
    </ResponseField>

    <ResponseField name="rating" type="integer | null">
      The grade awarded for this submission, on a scale of 1–10. Returns `null` if the submission has not yet been graded.
    </ResponseField>

    <ResponseField name="instructor_comment" type="string | null">
      Written feedback from the instructor. Returns `null` if no comment has been provided.
    </ResponseField>

    <ResponseField name="is_reviewed" type="boolean">
      Indicates whether the submission has been graded. `true` if a rating has been assigned.
    </ResponseField>

    <ResponseField name="submitted_at" type="string">
      The timestamp when the student submitted the homework, formatted as `YYYY-MM-DD HH:mm:ss`.
    </ResponseField>

    <ResponseField name="files" type="array">
      Array of FileObjects representing the files attached to this submission. Returns an empty array if the student did not upload any files.

      <Expandable title="FileObject fields">
        <ResponseField name="id" type="integer">
          The unique file ID.
        </ResponseField>

        <ResponseField name="name" type="string">
          The original filename of the uploaded file.
        </ResponseField>

        <ResponseField name="url" type="string">
          The direct URL to access or download the file.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="download_url" type="string | null">
      A URL to download all submission files as a ZIP archive. Returns `null` if no files are attached.
    </ResponseField>
  </Expandable>
</ResponseField>

## Error Responses

| Status | Message                  | Cause                                                                             |
| ------ | ------------------------ | --------------------------------------------------------------------------------- |
| `401`  | `UnauthorizedRequest`    | Missing or invalid token, or the authenticated user does not have the Admin role. |
| `404`  | `PDF Homework not found` | No class exists with the given ID, or the class has no PDF assignment attached.   |
