# /submit-quiz

**Input Parameters**

| Parameter    | Type                            | Description                                                                                                                                                                                                               |
| ------------ | ------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| quizId       | `String`                        | The unique identifier for the quiz.                                                                                                                                                                                       |
| primaryKey   | `String`                        | <p>The primary key for the student. <br><br><strong>Optional:</strong> If no PK then the submission will not be saved. Request will just return the graded submission.</p>                                                |
| studentInput | Array of `Strings` or `Numbers` | <p>The answers submitted by the student.<br><br><code>String</code> for <strong>free form</strong> questions.</p><p><br><code>Number</code> for <strong>index</strong> of <strong>multiple choice</strong> questions.</p> |

**Example Request**

```javascript
// Example to submit a quiz
fetch('https://api.arlinear.com/functions/v1/submit-quiz', {
    method: 'POST',
    headers: {
        'Authorization': '<Your API Key>',
    },
    body: JSON.stringify({
        'quizId': 'ba777045-7033-4701-b17b-da9e90dcd41e',
        'primaryKey': 'emily@school.com',
        'studentInput': [0, "the mitochondria is the powerhouse of the cell", ...] // see note below
    })
})

/*
  --- for studentInput ---
  
      for short answer questions: pass in a string for student input (i.e "the mitochondria is the powerhouse of the cell")
      
      for multiple choice questions: pass in mc 'choices' index for student input (i.e. 0, 1, 2, 3, etc...)
      
      Example: 
      if you want to use the first option as an answer, pass in "0" as the studentInput
      "choices": [
            {
                "value": " 11",
                "isCorrect": true,
                "type": "choice"
            },
            {
                "value": " 14",
                "isCorrect": false,
                "type": "choice"
            },
            {
                "value": " 9",
                "isCorrect": false,
                "type": "choice"
            }
        ]
*/
```

**Return Value**

* `score`: Total points scored.
* `scoreOutOf`: Maximum possible points.
* `percentage`: Percentage score.

```json
{
  "score": 8,
  "scoreOutOf": 10,
  "percentage": 80
}
```


---

# 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://arlinear.gitbook.io/documentation/api/submit-quiz.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.
