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

# Matrículas

> Vincule estudantes a cursos e turmas. Matrículas rastreiam a progressão acadêmica e notas.

# Matrículas

Uma matrícula representa o registro de um estudante em um curso. Ela rastreia quando o estudante se matriculou, seu status de conclusão e sua nota final. Matrículas são opcionais para a emissão de certificados, mas fornecem rastreabilidade acadêmica completa quando incluídas.

***

## O objeto matrícula

```json theme={null}
{
  "uuid": "g7h8i9j0-k1l2-3456-mnop-567890123456",
  "completion_status": "completed",
  "grade": 8.75,
  "enrolled_at": "2024-02-01T00:00:00.000000Z",
  "completed_at": "2027-12-20T00:00:00.000000Z",
  "student": {
    "uuid": "f6a7b8c9-d0e1-2345-fghi-456789012345",
    "name": "Maria Fernanda Silva"
  },
  "course": {
    "uuid": "c3d4e5f6-a7b8-9012-cdef-123456789012",
    "name": "Bachelor of Computer Science"
  },
  "cohort": {
    "uuid": "e5f6a7b8-c9d0-1234-efgh-345678901234",
    "code": "BCS-2024-EVE"
  }
}
```

| Campo               | Tipo         | Descrição                                     |
| ------------------- | ------------ | --------------------------------------------- |
| `uuid`              | string       | Identificador único                           |
| `completion_status` | enum         | `enrolled`, `completed`, `dropped`            |
| `grade`             | decimal      | Nota final (0–10, 2 casas decimais), anulável |
| `enrolled_at`       | datetime     | Data de matrícula                             |
| `completed_at`      | datetime     | Data de conclusão/formatura, anulável         |
| `student`           | object       | O estudante matriculado                       |
| `course`            | object       | O curso                                       |
| `cohort`            | object\|null | A turma, se aplicável                         |

***

## Listar matrículas

```http theme={null}
GET /enrollments
```

<CodeGroup>
  ```bash cURL theme={null}
  # Listar todas as matrículas concluídas de um curso
  curl "https://api.dokstamp.com/enrollments?where[completion_status]=completed&where[course_uuid]=c3d4e5f6-a7b8-9012-cdef-123456789012" \
    -H "Authorization: Bearer {TOKEN}" \
    -H "Accept: application/json" \
    -H "X-Tenant: {TENANT}"
  ```
</CodeGroup>

***

## Criar uma matrícula

```http theme={null}
POST /enrollments
```

| Parâmetro           | Tipo    | Obrigatório | Descrição                                   |
| ------------------- | ------- | ----------- | ------------------------------------------- |
| `student_uuid`      | string  | Sim         | UUID do estudante                           |
| `course_uuid`       | string  | Sim         | UUID do curso                               |
| `enrolled_at`       | date    | Sim         | Data de matrícula (`YYYY-MM-DD`)            |
| `cohort_uuid`       | string  | Não         | UUID da turma                               |
| `completion_status` | enum    | Não         | `enrolled` (padrão), `completed`, `dropped` |
| `grade`             | decimal | Não         | Nota final (mínimo: 0)                      |
| `completed_at`      | date    | Não         | Data de conclusão                           |

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.dokstamp.com/enrollments \
    -H "Authorization: Bearer {TOKEN}" \
    -H "Accept: application/json" \
    -H "Content-Type: application/json" \
    -H "X-Tenant: {TENANT}" \
    -d '{
      "student_uuid": "f6a7b8c9-d0e1-2345-fghi-456789012345",
      "course_uuid": "c3d4e5f6-a7b8-9012-cdef-123456789012",
      "cohort_uuid": "e5f6a7b8-c9d0-1234-efgh-345678901234",
      "enrolled_at": "2024-02-01",
      "completion_status": "completed",
      "grade": 8.75,
      "completed_at": "2027-12-20"
    }'
  ```
</CodeGroup>

***

## Obter, atualizar, excluir

```http theme={null}
GET    /enrollments/{uuid}
PATCH  /enrollments/{uuid}
PUT    /enrollments/{uuid}
DELETE /enrollments/{uuid}
DELETE /enrollments/batch/destroy
```

<Info>
  O campo `enrollment_uuid` é opcional em `POST /certificates`. Incluí-lo vincula o certificado ao registro de matrícula específico, permitindo rastreabilidade completa desde a matrícula até a emissão da credencial.
</Info>
