> For the complete documentation index, see [llms.txt](https://developerdocs.instructure.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developerdocs.instructure.com/services/canvas/resources/quiz_submission_events.md).

# Quiz Submission Events

#### A QuizSubmissionEvent object looks like: <a href="#quizsubmissionevent" id="quizsubmissionevent"></a>

```js
// An event passed from the Quiz Submission take page
{
  // a timestamp record of creation time
  "created_at": "2014-10-08T19:29:58Z",
  // the type of event being sent
  "event_type": "question_answered",
  // custom contextual data for the specific event type
  "event_data": {"answer":"42"}
}
```

## [Submit captured events](#method.quizzes/quiz_submission_events_api.create) <a href="#method.quizzes-quiz_submission_events_api.create" id="method.quizzes-quiz_submission_events_api.create"></a>

[Quizzes::QuizSubmissionEventsApiController#create](https://github.com/instructure/canvas-lms/blob/master/app/controllers/quizzes/quiz_submission_events_api_controller.rb)

#### `POST /api/v1/courses/:course_id/quizzes/:quiz_id/submissions/:id/events`

**Scope:** `url:POST|/api/v1/courses/:course_id/quizzes/:quiz_id/submissions/:id/events`

Store a set of events which were captured during a quiz taking session.

On success, the response will be 204 No Content with an empty body.

#### Request Parameters:

| Parameter                  | Type             | Description                          |
| -------------------------- | ---------------- | ------------------------------------ |
| `quiz_submission_events[]` | Required `Array` | The submission events to be recorded |

#### Example Request:

```bash
{
  "quiz_submission_events":
  [
    {
      "client_timestamp": "2014-10-08T19:29:58Z",
      "event_type": "question_answered",
      "event_data" : {"answer": "42"}
    }, {
      "client_timestamp": "2014-10-08T19:30:17Z",
      "event_type": "question_flagged",
      "event_data" : { "question_id": "1", "flagged": true }
    }
  ]
}
```

## [Retrieve captured events](#method.quizzes/quiz_submission_events_api.index) <a href="#method.quizzes-quiz_submission_events_api.index" id="method.quizzes-quiz_submission_events_api.index"></a>

[Quizzes::QuizSubmissionEventsApiController#index](https://github.com/instructure/canvas-lms/blob/master/app/controllers/quizzes/quiz_submission_events_api_controller.rb)

#### `GET /api/v1/courses/:course_id/quizzes/:quiz_id/submissions/:id/events`

**Scope:** `url:GET|/api/v1/courses/:course_id/quizzes/:quiz_id/submissions/:id/events`

Retrieve the set of events captured during a specific submission attempt.

#### Request Parameters:

| Parameter | Type      | Description                                                                                                           |
| --------- | --------- | --------------------------------------------------------------------------------------------------------------------- |
| `attempt` | `integer` | <p>The specific submission attempt to look up the events for. If unspecified,<br>the latest attempt will be used.</p> |

#### Example Response:

```js
{
  "quiz_submission_events": [
    {
      "id": "3409",
      "event_type": "page_blurred",
      "event_data": null,
      "created_at": "2014-11-16T13:37:21Z"
    },
    {
      "id": "3410",
      "event_type": "page_focused",
      "event_data": null,
      "created_at": "2014-11-16T13:37:27Z"
    }
  ]
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://developerdocs.instructure.com/services/canvas/resources/quiz_submission_events.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
