> ## 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 XML string

> Validate a QTI XML file against the QTI 3.0 xsd specification.



## OpenAPI

````yaml /openapi/beyond-ai/qti-api.yaml post /validate
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 QTI compliant XSD files. XSD version
      supported is 3.0.0 (3p0)
  - 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:
    post:
      tags:
        - Validation
      summary: Validate a XML string
      description: Validate a QTI XML file against the QTI 3.0 xsd specification.
      operationId: validateXml
      requestBody:
        description: The XML string to validate along with its schema type
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                xml:
                  type: string
                  description: >-
                    The XML string to validate against the QTI 3.0 XSD
                    specification. If entityId is provided, this will be
                    ignored.
                schema:
                  type: string
                  enum:
                    - test
                    - item
                    - stimulus
                  description: >-
                    The schema represents Assessment Test, Assessment Item or
                    Stimulus and must be one of 'test', 'item', or 'stimulus'
                    types.
                entityId:
                  type: string
                  description: >-
                    The entity ID to validate the XML against. Must exist in the
                    database. If entityId is provided, the xml strings attached
                    will be ignored.
              required:
                - schema
              description: >-
                Validate a QTI XML string against the QTI 3.0 XSD specification.
                You can send Assessment Test, Assessment Item or Stimulus XML
                strings to be validated. If entityId is provided, the xml
                strings attached will be ignored.
            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>
              entityId:
                value:
                  schema: item
                  entityId: fake-item-id-1
      responses:
        '200':
          description: Successfully validated XML
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: string
                    enum:
                      - 'true'
                      - 'false'
                    description: Whether the XML string was validated successfully.
                  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
                  - xmlContent
                  - validationErrors
                  - message
        '404':
          description: Entity not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    const: false
                    description: >-
                      Indicates that the validation failed due to entity not
                      found.
                  entityId:
                    type: string
                    description: The entity ID that was not found in the database.
                  error:
                    type: string
                    const: Entity not found
                    description: Error type indicating the entity was not found.
                  message:
                    type: string
                    description: >-
                      Detailed error message describing which entity was not
                      found.
                required:
                  - success
                  - entityId
                  - error
                  - message
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error type identifier
                  message:
                    type: string
                    description: Human-readable error message
                  eventId:
                    type: string
                    description: Sentry event ID for error tracking
                  details:
                    type: string
                    description: Stack trace or additional error details
                required:
                  - error
                  - message
                  - details
                description: Internal server error response
components:
  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

````