Showing results for 
Show  only  | Search instead for 
Did you mean: 
Community Participant

How get all answers from a quiz using the API

I use the endpoint below to get all submissions from a specific course 

For each answer, I have a html_url, for example 

that is converted to 

I was able to see the user_id by the URL and all answers from that user on the HTML page.

Is there an API endpoint that I was able to see the answers from the student(including the answer that students write).

Labels (1)
Tags (1)
7 Replies
Community Champion


There is an documented switch that has the undocumented side effect of giving you the quiz responses.

Get the submissions (not quiz submissions) for the corresponding assignment and be sure to add the query parameter: include[]=submission_history.

Let's say that I have a quiz at /courses/896851/quizzes/3986251. If I GET /api/v1/courses/896851/quizzes/3986251, I see that the assignment_id is 13300109.

Then I GET /api/v1/courses/896851/assignments/13300109/submissions?include[]=submission_history.

It returns an array of users, and each user that has taken the quiz has a submission_history.submission_data array. That array contains an object for each question.

Here is an example (just the submission_data portion) from a quiz I gave.

"text":"<p>An ancient Egyptian casket.</p>",

The response to the essay question (question 2) was "An ancient Egyptian casket."

To make sense out of the first question, you need to get the information about the question from somewhere else.

I can do that with GET /api/v1/courses/896851/quizzes/3986251/questions

The first question had question_id=73065717 and was "What is the teacher's favorite color?". From the answers object, you can tell what response 5521 is. Do NOT look at the text property here, they didn't type 5521.

For the second question, id=73065719, the question_type was "essay_question" and the text was "Explain sarcasm." The text in this case is what the student typed.

See the appendix of question answer formats at the bottom of the Quiz Submission Questions API documentation for additional information.

0 Kudos
Community Participant

Thanks for the help, but I think this approach will not work for me.
I check my quiz id using the endpoint
On the quiz that I want the answers, the "assignment_id" is null. So, because of that, I can't use the endpoint below
Is there another way to get those answers?
0 Kudos

Hi  @fabiocunha ,

Did you tried to get all submissions for all assignments? And after that search for your quiz_id?

I had a similar issue in the past and  @jamesjonespa ‌ kindly helped me with excellent explanations on that post: 

Hope it helps!

0 Kudos
Community Champion

Is your quiz a practice quiz or ungraded survey? They may not have assignments associated with them. One thing you could do (untested) is to go to your beta instance, change it to be a graded assignment, and then get the results out of it as I described earlier.

0 Kudos

Quizzes that don't have an associated gradebook entry will not return an assignment_id. I would assume there is no way to get submission_history for them. 

0 Kudos

Hi James, I tried this but it didn't work. Can you verify that it's still working on your end? I am not seeing the submission_data portion in the response

0 Kudos
Community Champion


Sorry for the delay. Anymore, if people aren't at-tagging me, I'm not getting the message and may miss stuff.

Yes, this still works. I just created a brand new classic quiz, added an essay question to it, took it, and then retrieved the text of the essay answer.

The query I used was

GET /api/v1/courses/:courseId/assignments/:assignmentId/submissions?include[]=submission_history

Make sure you're using the assignment ID and not the quiz ID.

The submission_data is under submission_history.