---
title: "Update enrollments"
method: PATCH
path: "/v2/enrollments/"
tags: ["Enrollments"]
---

# Update enrollments

`PATCH /v2/enrollments/`

Partially update a batch of enrollments, each addressed by its id.

**Required OAuth scope:** `enrollments:write`

## Request body

- EnrollmentUpdateRequestEnvelope — JSON:API envelope for the bulk PATCH /v2/enrollments/ update.
  - `data` EnrollmentUpdateData[], required — List of enrollment items to update.
    - `type` 'enrollments', required — Must be "enrollments".
    - `id` string, required — Opaque enrollment ID.
    - `attributes` EnrollmentUpdateAttributes, required — Updatable attributes for a bulk enrollment update. Omitted fields are left unchanged.
      - `expires_at` string, date-time, nullable — Timestamp when access expires; null clears the expiry.
      - `due_at` string, date-time, nullable — Timestamp the course is due; null clears the due date.
      - `active` boolean, nullable — false deactivates the enrollment, true reactivates it (null is invalid; omit to leave unchanged).

## Response `200`

OK

- BatchResultEnvelopeEnrollmentWriteResource
  - `data` union[], required — Per-item results in request order.
    - union
      - BatchSucceededItemEnrollmentWriteResource
        - `status` 'succeeded'
        - `id` string, nullable — Resource ID of the created or updated resource.
        - `result` EnrollmentWriteResource, required — JSON:API resource object for an enrollment.
          - `type` string — Always "enrollments".
          - `id` string, required — Opaque enrollment ID.
          - `attributes` EnrollmentWriteAttributes, required — Attributes of the bulk-enroll (write) response resource. ``channel`` is intentionally absent from this write shape — it's an internal source-of-enrollment dimension that Pulse doesn't consume.
            - `enrolled_at` string, date-time, required — Timestamp when the student was enrolled.
            - `expires_at` string, date-time, nullable — Timestamp when access expires, or null for no expiry.
            - `due_at` string, date-time, nullable — Timestamp the course is due, or null when no due date.
            - `active` boolean, required — Whether the enrollment is currently active.
          - `relationships` object, nullable — Related student and published-course links.
          - `links` object, nullable — Self link.
      - BatchFailedItem — Wrapper for a failed item in a 207 batch response.
        - `status` 'failed'
        - `id` string, nullable — Echoed resource ID if the input identified a row.
        - `error` BatchItemError, required — Per-item error inside a 207 batch response. Aligned with JSON:API ``ErrorObject`` field naming (``code`` rather than ``reason``) so consumers can reuse error-handling logic across document-level errors (``ErrorObject`` in ``ErrorEnvelope``) and per-item errors (here). Differences from ``ErrorObject``: ``status``/``title`` are omitted because they're redundant for the 207-batch context (HTTP status is on the envelope, and the title is derivable from ``code``).
          - `code` 'duplicate_email' | 'duplicate_in_batch' | 'duplicate_name' | 'validation_error' | 'not_found' | 'internal_error' | 'not_in_domain' | 'already_enrolled' | 'already_published', required — Machine-readable error code.
          - `source` object, nullable — Pointer to the offending input slot, e.g. {"pointer": "/data/0/attributes/email"}.
          - `detail` string, nullable — Human-readable explanation of the error.
  - `summary` BatchSummary, required — Aggregate counts for a 207 batch response. Invariant: ``succeeded + failed == total``. Enforced by ``@model_validator``.
    - `total` integer, required — Total number of items submitted.
    - `succeeded` integer, required — Number of items that succeeded.
    - `failed` integer, required — Number of items that failed.

## Other responses

- `207` — Multi-Status
- `400` — Bad Request
- `401` — Unauthorized
- `403` — Forbidden
- `422` — Unprocessable Entity

---

[API](https://skmtc.net/skilljar/apis/skilljar-api-v2.md) · [All operations](https://skmtc.net/skilljar/apis/skilljar-api-v2/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/skilljar/skilljar-api-v2/revisions/f8025de20169/schema)
