> ## Documentation Index
> Fetch the complete documentation index at: https://docs.edpire.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Autosave Answers

> Persists the learner's current answers as drafts without grading or
submitting. Only valid for submissions that are `in_progress`.

Use this endpoint on a timed interval from your player to implement
crash recovery or resumable sessions, depending on the assessment's
`autosave_mode`:

- **`crash_recovery`** — save every 30–60 s; discard drafts on explicit
  submit. Lets learners recover from closed tabs.
- **`resumable`** — save on every answer change; let the learner log out
  and return later to pick up exactly where they left off.
- **`off`** — do not call this endpoint; answers are only recorded at
  final submit.

Existing draft rows for the same `(submission_id, question_id)` are
replaced atomically. A row's draft flag is cleared when the submission
is graded.




## OpenAPI

````yaml POST /submissions/{id}/save
openapi: 3.1.0
info:
  title: Edpire API
  description: >
    Edpire is a headless assessment engine. This API lets you manage
    assessments,

    submit answers for grading, retrieve results, manage collections, and
    configure

    webhooks for real-time notifications.


    All responses use a consistent envelope: `{ data, error, meta }`.
  version: 1.0.0
  contact:
    name: Edpire Support
    url: https://edpire.com
  license:
    name: Proprietary
servers:
  - url: https://edpire.com/api/v1
    description: Production
security:
  - BearerAuth: []
tags:
  - name: Assessments
    description: Create, list, update, publish, and grade assessments
  - name: Submissions
    description: Retrieve submission details
  - name: Learners
    description: Query learner results
  - name: Collections
    description: Manage ordered groups of assessments
  - name: Webhooks
    description: Register and manage webhook endpoints
  - name: Embed
    description: Mint tokens and load assessments for browser-side rendering
  - name: OpenAPI
    description: API specification
paths:
  /submissions/{id}/save:
    post:
      tags:
        - Submissions
      summary: Autosave in-progress answers
      description: |
        Persists the learner's current answers as drafts without grading or
        submitting. Only valid for submissions that are `in_progress`.

        Use this endpoint on a timed interval from your player to implement
        crash recovery or resumable sessions, depending on the assessment's
        `autosave_mode`:

        - **`crash_recovery`** — save every 30–60 s; discard drafts on explicit
          submit. Lets learners recover from closed tabs.
        - **`resumable`** — save on every answer change; let the learner log out
          and return later to pick up exactly where they left off.
        - **`off`** — do not call this endpoint; answers are only recorded at
          final submit.

        Existing draft rows for the same `(submission_id, question_id)` are
        replaced atomically. A row's draft flag is cleared when the submission
        is graded.
      operationId: autosaveSubmission
      parameters:
        - name: id
          in: path
          required: true
          description: Submission ID (must be in_progress)
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - answers
              properties:
                answers:
                  $ref: '#/components/schemas/AssessmentAnswers'
      responses:
        '200':
          description: Answers saved
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/Envelope'
                  - type: object
                    properties:
                      data:
                        type: object
                        properties:
                          ok:
                            type: boolean
                          saved_at:
                            type: string
                            format: date-time
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
      security:
        - BearerAuth:
            - write:submissions
components:
  schemas:
    AssessmentAnswers:
      type: object
      required:
        - exerciseAnswers
      properties:
        exerciseAnswers:
          type: array
          items:
            type: object
            required:
              - exerciseId
              - questionAnswers
            properties:
              exerciseId:
                type: string
              questionAnswers:
                type: array
                items:
                  type: object
                  required:
                    - questionId
                    - answers
                  properties:
                    questionId:
                      type: string
                    answers:
                      type: array
                      items:
                        type: object
                        additionalProperties: true
    Envelope:
      type: object
      properties:
        data: {}
        error:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/ErrorObject'
        meta:
          oneOf:
            - type: 'null'
            - type: object
    ErrorObject:
      type: object
      required:
        - message
      properties:
        message:
          type: string
    ErrorResponse:
      type: object
      properties:
        data:
          type: 'null'
        error:
          $ref: '#/components/schemas/ErrorObject'
        meta:
          type: 'null'
  responses:
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >
        API key starting with `edp_live_`. Pass via `Authorization: Bearer
        edp_live_xxx`.


        Scopes: `read:assessments`, `write:assessments`, `read:results`,
        `write:submissions`.

````