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

# Validate a batch of XML strings

> Validate a batch of QTI XML strings against the QTI 3.0 xsd specification.



## OpenAPI

````yaml /openapi/beyond-ai/qti-api.yaml post /validate/batch
openapi: 3.1.0
info:
  title: QTI API
  version: 1.0.0
  description: >-
    A robust assessment engine implementing the QTI 3.0 specification, designed
    for creating, managing, and delivering educational assessments.
servers:
  - url: https://qti.alpha-1edtech.ai/api
    description: Main Server
security:
  - OAuth2: []
  - MCP: []
tags:
  - name: Validation
    description: Validate XML strings against the QTI 3.0.1 schema
  - name: Feedback
    description: Feedback for questions and lessons
  - name: Assessment Test Management
    description: >-
      Enables the management of Assessment Tests. Assessment Tests are the main
      entities that contain Assessment Test Parts, Sections, and Assessment
      Items.
  - name: Test Part Management
    description: >-
      Enables the management of Test Parts. Assessment Test Parts are used to
      group sections inside of an Assessment Test.
  - name: Section Management
    description: >-
      Enables the management of Sections. Assessment Sections are used to group
      Assessment Items.
  - name: Assessment Item Management
    description: >-
      Enables the management of Assessment ITems. Assessment Items are made up
      of QTI Interactions (e.g. questions, multiple choice, etc.).
  - name: Stimulus Management
    description: >-
      Enables the management of Stimuli. Stimuli are shared content pieces
      (text, images, audio, video) that provide context for assessment items and
      can be referenced by multiple questions.
paths:
  /validate/batch:
    post:
      tags:
        - Validation
      summary: Validate a batch of XML strings
      description: >-
        Validate a batch of QTI XML strings against the QTI 3.0 xsd
        specification.
      operationId: validateBatch
      requestBody:
        description: The stimulus content to create.
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                schema:
                  type: string
                  enum:
                    - test
                    - item
                    - stimulus
                  description: >-
                    Which QTI schema to validate against: 'test', 'item' or
                    'stimulus'.
                xml:
                  type: array
                  items:
                    type: string
                  description: XML strings to validate.
                entityIds:
                  type: array
                  items:
                    type: string
                  description: Identifiers of stored documents whose rawXml to validate.
              required:
                - schema
              description: >-
                Validate several QTI XML documents, sent inline as `xml` or
                named by `entityIds` (which win when both are sent), against the
                QTI 3.0.1 schema for `schema`. Each result reports its own
                outcome; the response is 200 even when documents are invalid.
            examples:
              default:
                value:
                  schema: item
                  xml:
                    - |-
                      <?xml version="1.0" encoding="UTF-8"?>
                      <qti-assessment-item
                        xmlns="http://www.imsglobal.org/xsd/imsqtiasi_v3p0"
                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                        xsi:schemaLocation="http://www.imsglobal.org/xsd/imsqtiasi_v3p0 https://purl.imsglobal.org/spec/qti/v3p0/schema/xsd/imsqti_asiv3p0_v1p0.xsd"
                        identifier="xml-choice-item-1"
                        title="Sample Choice Question"
                        adaptive="false"
                        time-dependent="false">

                        <qti-response-declaration identifier="RESPONSE" cardinality="single" base-type="identifier">
                          <qti-correct-response>
                            <qti-value>B</qti-value>
                          </qti-correct-response>
                        </qti-response-declaration>

                        <qti-outcome-declaration identifier="FEEDBACK" cardinality="single" base-type="identifier"/>
                        <qti-outcome-declaration identifier="FEEDBACK-INLINE" cardinality="single" base-type="identifier"/>

                        <qti-assessment-stimulus-ref identifier="Stimulus1" href="stimuli/Stimulus1" title="Math Context"/>
                        <qti-assessment-stimulus-ref identifier="Stimulus2" href="stimuli/Stimulus2" title="Additional Context"/>

                        <qti-item-body>
                          <qti-choice-interaction response-identifier="RESPONSE" shuffle="false" max-choices="1">
                            <qti-prompt>What is 2 + 2?</qti-prompt>
                            <qti-simple-choice identifier="A">
                              3
                              <qti-feedback-inline outcome-identifier="FEEDBACK-INLINE" identifier="A" show-hide="show">
                                <span style="color: #D9534F;">Incorrect: Try counting again.</span>
                              </qti-feedback-inline>
                            </qti-simple-choice>
                            <qti-simple-choice identifier="B">
                              4
                              <qti-feedback-inline outcome-identifier="FEEDBACK-INLINE" identifier="B" show-hide="show">
                                <span style="color: #2E8B57;">Correct: Well done!</span>
                              </qti-feedback-inline>
                            </qti-simple-choice>
                          </qti-choice-interaction>
                        </qti-item-body>

                        <qti-response-processing template="match_correct">
                          <qti-response-condition>
                            <qti-response-if>
                              <qti-match>
                                <qti-variable identifier="RESPONSE"/>
                                <qti-correct identifier="RESPONSE"/>
                              </qti-match>
                              <qti-set-outcome-value identifier="FEEDBACK">
                                <qti-base-value base-type="identifier">CORRECT</qti-base-value>
                              </qti-set-outcome-value>
                            </qti-response-if>
                            <qti-response-else>
                              <qti-set-outcome-value identifier="FEEDBACK">
                                <qti-base-value base-type="identifier">INCORRECT</qti-base-value>
                              </qti-set-outcome-value>
                            </qti-response-else>
                          </qti-response-condition>
                        </qti-response-processing>

                        <qti-modal-feedback outcome-identifier="FEEDBACK" identifier="CORRECT" show-hide="show">
                          <qti-content-body>
                            <p><strong>Correct!</strong> Well done.</p>
                          </qti-content-body>
                        </qti-modal-feedback>

                        <qti-modal-feedback outcome-identifier="FEEDBACK" identifier="INCORRECT" show-hide="show">
                          <qti-content-body>
                            <p><strong>Incorrect.</strong> Please review and try again.</p>
                          </qti-content-body>
                        </qti-modal-feedback>
                      </qti-assessment-item>
                    - |-
                      <?xml version="1.0" encoding="UTF-8"?>
                      <qti-assessment-item
                        xmlns="http://www.imsglobal.org/xsd/imsqtiasi_v3p0"
                        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                        xsi:schemaLocation="http://www.imsglobal.org/xsd/imsqtiasi_v3p0 https://purl.imsglobal.org/spec/qti/v3p0/schema/xsd/imsqti_asiv3p0_v1p0.xsd"
                        identifier="xml-choice-item-1"
                        title="Sample Choice Question"
                        adaptive="false"
                        time-dependent="false">

                        <qti-response-declaration identifier="RESPONSE" cardinality="single" base-type="identifier">
                          <qti-correct-response>
                            <qti-value>B</qti-value>
                          </qti-correct-response>
                        </qti-response-declaration>

                        <qti-outcome-declaration identifier="FEEDBACK" cardinality="single" base-type="identifier"/>
                        <qti-outcome-declaration identifier="FEEDBACK-INLINE" cardinality="single" base-type="identifier"/>

                        <qti-assessment-stimulus-ref identifier="Stimulus1" href="stimuli/Stimulus1" title="Math Context"/>
                        <qti-assessment-stimulus-ref identifier="Stimulus2" href="stimuli/Stimulus2" title="Additional Context"/>

                        <qti-item-body>
                          <qti-choice-interaction response-identifier="RESPONSE" shuffle="false" max-choices="1">
                            <qti-prompt>What is 2 + 2?</qti-prompt>
                            <qti-simple-choice identifier="A">
                              3
                              <qti-feedback-inline outcome-identifier="FEEDBACK-INLINE" identifier="A" show-hide="show">
                                <span style="color: #D9534F;">Incorrect: Try counting again.</span>
                              </qti-feedback-inline>
                            </qti-simple-choice>
                            <qti-simple-choice identifier="B">
                              4
                              <qti-feedback-inline outcome-identifier="FEEDBACK-INLINE" identifier="B" show-hide="show">
                                <span style="color: #2E8B57;">Correct: Well done!</span>
                              </qti-feedback-inline>
                            </qti-simple-choice>
                          </qti-choice-interaction>
                        </qti-item-body>

                        <qti-response-processing template="match_correct">
                          <qti-response-condition>
                            <qti-response-if>
                              <qti-match>
                                <qti-variable identifier="RESPONSE"/>
                                <qti-correct identifier="RESPONSE"/>
                              </qti-match>
                              <qti-set-outcome-value identifier="FEEDBACK">
                                <qti-base-value base-type="identifier">CORRECT</qti-base-value>
                              </qti-set-outcome-value>
                            </qti-response-if>
                            <qti-response-else>
                              <qti-set-outcome-value identifier="FEEDBACK">
                                <qti-base-value base-type="identifier">INCORRECT</qti-base-value>
                              </qti-set-outcome-value>
                            </qti-response-else>
                          </qti-response-condition>
                        </qti-response-processing>

                        <qti-modal-feedback outcome-identifier="FEEDBACK" identifier="CORRECT" show-hide="show">
                          <qti-content-body>
                            <p><strong>Correct!</strong> Well done.</p>
                          </qti-content-body>
                        </qti-modal-feedback>

                        <qti-modal-feedback outcome-identifier="FEEDBACK" identifier="INCORRECT" show-hide="show">
                          <qti-content-body>
                            <p><strong>Incorrect.</strong> Please review and try again.</p>
                          </qti-content-body>
                        </qti-modal-feedback>
                      </qti-assessment-item>
              entityIds:
                value:
                  schema: test
                  entityIds:
                    - fake-test-id-1
                    - fake-test-id-2
      responses:
        '200':
          description: Successfully validated XML
          content:
            application/json:
              schema:
                type: object
                properties:
                  results:
                    type: array
                    items:
                      type: object
                      properties:
                        success:
                          type: boolean
                          description: Whether the document is valid.
                        entityId:
                          type: string
                          description: >-
                            The entity ID of the XML string that was validated.
                            If no entityId is provided, a random identifier will
                            be generated.
                        xmlContent:
                          type: string
                          description: >-
                            The XML string that was validated. If no xml is
                            provided, the xml string will be the rawXml string
                            that exists in the database.
                        validationErrors:
                          type: array
                          items:
                            type: string
                          description: >-
                            An array of validation errors that occurred during
                            the validation process. If no validation errors
                            occurred, this will be an empty array.
                        message:
                          type: string
                          description: >-
                            A message describing the validation process. If the
                            validation was successful this will read 'Valid XML'
                            else it will contain details on the error message.
                      required:
                        - success
                        - entityId
                        - message
                required:
                  - results
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
        '401':
          description: No bearer token, or an invalid one
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
        '403':
          description: >-
            The token lacks the required scope, or the caller does not own the
            resource
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
        '413':
          description: The request body is larger than 50 MB
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
        '503':
          description: Database unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorBody'
components:
  schemas:
    ErrorBody:
      type: object
      properties:
        error:
          type: string
          description: The problem in one sentence (same as detail)
        code:
          type: string
          description: >-
            The reason phrase with the spaces removed, for every error:
            BadRequest, Unauthorized, Forbidden, NotFound, Conflict, Gone,
            ContentTooLarge, UnsupportedMediaType, UnprocessableContent,
            InternalServerError, ServiceUnavailable
        details:
          type: string
          description: The individual errors joined into one line, when there are any
        title:
          type: string
          description: The HTTP reason phrase (RFC 9457)
        status:
          type: integer
          description: The HTTP status code (RFC 9457)
        detail:
          type: string
          description: >-
            The problem in one sentence (RFC 9457); on a 500 it is the phrase
            and nothing more
        errors:
          type: array
          items:
            type: object
            properties:
              detail:
                type: string
              pointer:
                type: string
                description: JSON Pointer to the offending part of the request
            required:
              - detail
          description: Individual problems, for validation failures
        traceId:
          type: string
          pattern: ^[0-9a-f]{32}$
          description: W3C trace id of the request; absent when no trace was active
      required:
        - error
        - code
        - title
        - status
        - detail
      description: Error response
  securitySchemes:
    OAuth2:
      type: oauth2
      flows:
        clientCredentials:
          scopes:
            https://purl.imsglobal.org/spec/qti/v3/scope/readonly: Read access to QTI
            https://purl.imsglobal.org/spec/qti/v3/scope/createput: Create and update access to QTI
            https://purl.imsglobal.org/spec/qti/v3/scope/delete: Delete access to QTI
          tokenUrl: >-
            https://prod-beyond-timeback-api-2-idp.auth.us-east-1.amazoncognito.com/oauth2/token
    MCP:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: >-
            https://prod-beyond-timeback-api-2-idp.auth.us-east-1.amazoncognito.com/oauth2/authorize
          tokenUrl: >-
            https://prod-beyond-timeback-api-2-idp.auth.us-east-1.amazoncognito.com/oauth2/token
          scopes:
            https://purl.imsglobal.org/spec/qti/v3/scope/readonly: Read access to QTI

````