# Learning Object Dates

{% hint style="warning" %}
**Welcome to Our New API Docs!** This is the new home for all things API (previously at [Canvas LMS REST API Documentation](https://api.instructure.com)).
{% endhint %}

## Learning Object Dates API

API for accessing date-related attributes on assignments, quizzes, modules, discussions, pages, and files. Note that support for files is not yet available.

**A LearningObjectDates object looks like:**

```js
{
  // the ID of the learning object (not present for checkpoints)
  "id": 4,
  // the due date for the learning object. returns null if not present or
  // applicable. never applicable for ungraded discussions, pages, and files
  "due_at": "2012-07-01T23:59:00-06:00",
  // the lock date (learning object is locked after this date). returns null if
  // not present
  "lock_at": "2012-07-01T23:59:00-06:00",
  // the reply_to_topic sub_assignment due_date. returns null if not present
  "reply_to_topic_due_at": "2012-07-01T23:59:00-06:00",
  // the reply_to_entry sub_assignment due_date. returns null if not present
  "required_replies_due_at": "2012-07-01T23:59:00-06:00",
  // the unlock date (learning object is unlocked after this date). returns null
  // if not present
  "unlock_at": "2012-07-01T23:59:00-06:00",
  // whether the learning object is only visible to overrides
  "only_visible_to_overrides": false,
  // whether the learning object is graded (and thus has a due date)
  "graded": true,
  // [exclusive to blueprint child content only] list of lock types
  "blueprint_date_locks": ["due_dates", "availability_dates"],
  // whether the learning object is visible to everyone
  "visible_to_everyone": true,
  // paginated list of AssignmentOverride objects
  "overrides": null,
  // list of Checkpoint objects, only present if a learning object has
  // subAssignments
  "checkpoints": null,
  // the tag identifying the type of checkpoint (only present for checkpoints)
  "tag": "reply_to_topic",
  // peer review sub assignment details. If a peer review sub assignment exists,
  // it is returned regardless of the Peer Review Allocation and Grading feature
  // state. If no peer review sub assignment exists, the feature must be enabled
  // to receive a null value; otherwise the key is omitted.
  "peer_review_sub_assignment": null
}
```

### [Get a learning object's date information](#method.learning_object_dates.show) <a href="#method.learning_object_dates.show" id="method.learning_object_dates.show"></a>

[LearningObjectDatesController#show](https://github.com/instructure/canvas-lms/blob/master/app/controllers/learning_object_dates_controller.rb)

**`GET /api/v1/courses/:course_id/modules/:context_module_id/date_details`**

**Scope:** `url:GET|/api/v1/courses/:course_id/modules/:context_module_id/date_details`

**`GET /api/v1/courses/:course_id/assignments/:assignment_id/date_details`**

**Scope:** `url:GET|/api/v1/courses/:course_id/assignments/:assignment_id/date_details`

**`GET /api/v1/courses/:course_id/quizzes/:quiz_id/date_details`**

**Scope:** `url:GET|/api/v1/courses/:course_id/quizzes/:quiz_id/date_details`

**`GET /api/v1/courses/:course_id/discussion_topics/:discussion_topic_id/date_details`**

**Scope:** `url:GET|/api/v1/courses/:course_id/discussion_topics/:discussion_topic_id/date_details`

**`GET /api/v1/courses/:course_id/pages/:url_or_id/date_details`**

**Scope:** `url:GET|/api/v1/courses/:course_id/pages/:url_or_id/date_details`

**`GET /api/v1/courses/:course_id/files/:attachment_id/date_details`**

**Scope:** `url:GET|/api/v1/courses/:course_id/files/:attachment_id/date_details`

Get a learning object’s date-related information, including due date, availability dates, override status, and a paginated list of all assignment overrides for the item.

**Request Parameters:**

| Parameter   | Type    | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           |
| ----------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `include[]` | `Array` | <p>Array of strings indicating what additional data to include in the response. Valid values:</p><p><br></p><ul><li><p><br></p><p>“peer\_review”: includes peer review sub assignment information and overrides in the response. If a peer review sub assignment exists, it is returned regardless of the Peer Review Allocation and Grading feature state. If no peer review sub assignment exists, the feature must be enabled to receive a null value; otherwise the key is omitted.</p><p><br></p></li><li><p><br></p><p>“child\_peer\_review\_override\_dates”: each assignment override will include a peer\_review\_dates field containing the matched peer review override data (id, due\_at, unlock\_at, lock\_at) for that override. The field will be present as null if no matching peer review override exists.</p><p><br></p></li></ul> |
| `exclude[]` | `Array` | <p>Array of strings indicating what data to exclude from the response. Valid values:</p><p><br></p><ul><li><p><br></p><p>“peer\_review\_overrides”: when include\[]=peer\_review is also specified, the peer\_review\_sub\_assignment object will not include the overrides array, reducing the response payload size. This is useful when using include\[]=child\_peer\_review\_override\_dates since the peer review override data is already embedded in the parent assignment overrides.</p><p><br></p></li><li><p><br></p><p>“child\_override\_due\_dates”: prevents the sub\_assignment\_due\_dates field from being included in assignment override responses, even when discussion checkpoints are enabled. This reduces response payload size when checkpoint due date information is not needed.</p><p><br></p></li></ul>                   |

Returns a [LearningObjectDates](#learningobjectdates) object.

### [Update a learning object's date information](#method.learning_object_dates.update) <a href="#method.learning_object_dates.update" id="method.learning_object_dates.update"></a>

[LearningObjectDatesController#update](https://github.com/instructure/canvas-lms/blob/master/app/controllers/learning_object_dates_controller.rb)

**`PUT /api/v1/courses/:course_id/assignments/:assignment_id/date_details`**

**Scope:** `url:PUT|/api/v1/courses/:course_id/assignments/:assignment_id/date_details`

**`PUT /api/v1/courses/:course_id/quizzes/:quiz_id/date_details`**

**Scope:** `url:PUT|/api/v1/courses/:course_id/quizzes/:quiz_id/date_details`

**`PUT /api/v1/courses/:course_id/discussion_topics/:discussion_topic_id/date_details`**

**Scope:** `url:PUT|/api/v1/courses/:course_id/discussion_topics/:discussion_topic_id/date_details`

**`PUT /api/v1/courses/:course_id/pages/:url_or_id/date_details`**

**Scope:** `url:PUT|/api/v1/courses/:course_id/pages/:url_or_id/date_details`

**`PUT /api/v1/courses/:course_id/files/:attachment_id/date_details`**

**Scope:** `url:PUT|/api/v1/courses/:course_id/files/:attachment_id/date_details`

Updates date-related information for learning objects, including due date, availability dates, override status, and assignment overrides.

Returns 204 No Content response code if successful.

**Request Parameters:**

| Parameter                              | Type       | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 |
| -------------------------------------- | ---------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `due_at`                               | `DateTime` | The learning object’s due date. Not applicable for ungraded discussions, pages, and files.                                                                                                                                                                                                                                                                                                                                                                                                                                  |
| `unlock_at`                            | `DateTime` | The learning object’s unlock date. Must be before the due date if there is one.                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| `lock_at`                              | `DateTime` | The learning object’s lock date. Must be after the due date if there is one.                                                                                                                                                                                                                                                                                                                                                                                                                                                |
| `only_visible_to_overrides`            | `boolean`  | Whether the learning object is only assigned to students who are targeted by an override.                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| `assignment_overrides[]`               | `Array`    | List of overrides to apply to the learning object. Overrides that already exist should include an ID and will be updated if needed. New overrides will be created for overrides in the list without an ID. Overrides not included in the list will be deleted. Providing an empty list will delete all of the object’s overrides. Keys for each override object can include: ‘id’, ‘title’, ‘due\_at’, ‘unlock\_at’, ‘lock\_at’, ‘student\_ids’, and ‘course\_section\_id’, ‘course\_id’, ‘noop\_id’, and ‘unassign\_item’. |
| `peer_review`                          | `Hash`     | Optional peer review configuration for assignments with peer reviews enabled. Requires the peer\_review\_allocation\_and\_grading feature flag. Keys can include: ‘due\_at’, ‘unlock\_at’, ‘lock\_at’, ‘peer\_review\_overrides’                                                                                                                                                                                                                                                                                            |
| `peer_review[due_at]`                  | `DateTime` | The peer review due date                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| `peer_review[unlock_at]`               | `DateTime` | The peer review unlock date (when peer reviews become available)                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| `peer_review[lock_at]`                 | `DateTime` | The peer review lock date (when peer reviews are no longer available)                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| `peer_review[peer_review_overrides][]` | `Array`    | List of peer review overrides. Each override can include: ‘id’, ‘due\_at’, ‘unlock\_at’, ‘lock\_at’, ‘student\_ids’, ‘course\_section\_id’, ‘course\_id’, ‘group\_id’, ‘unassign\_item’                                                                                                                                                                                                                                                                                                                                     |

**Example Request:**

```bash
curl https://<canvas>/api/v1/courses/:course_id/assignments/:assignment_id/date_details \
  -X PUT \
  -H 'Authorization: Bearer <token>' \
  -H 'Content-Type: application/json' \
  -d '{
        "due_at": "2012-07-01T23:59:00-06:00",
        "unlock_at": "2012-06-01T00:00:00-06:00",
        "lock_at": "2012-08-01T00:00:00-06:00",
        "only_visible_to_overrides": true,
        "assignment_overrides": [
          {
            "id": 212,
            "course_section_id": 3564
          },
          {
            "title": "an assignment override",
            "student_ids": [1, 2, 3]
          }
        ],
        "peer_review": {
          "due_at": "2012-07-05T23:59:00-06:00",
          "unlock_at": "2012-07-02T23:59:00-06:00",
          "lock_at": "2012-07-10T23:59:00-06:00",
          "peer_review_overrides": [
            {
              "id": 312,
              "course_section_id": 3564,
              "due_at": "2012-07-06T23:59:00-06:00"
            }
          ]
        }
      }'
```

***

This documentation is generated directly from the Canvas LMS source code, available [on Github](https://github.com/instructure/canvas-lms).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developerdocs.instructure.com/services/canvas/resources/learning_object_dates.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
