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

# Post apiv1lessons generate



## OpenAPI

````yaml /api/openapi.json post /api/v1/lessons/{lessonId}/generate
openapi: 3.1.0
info:
  title: Tessera API
  version: '1'
servers:
  - url: https://tessera.edstratumlabs.ai
    description: Production
security: []
paths:
  /api/v1/lessons/{lessonId}/generate:
    post:
      tags:
        - ai
      operationId: generateElement
      parameters:
        - name: lessonId
          in: path
          required: true
          schema:
            type: string
            minLength: 1
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                type:
                  type: string
                  enum:
                    - text
                    - callout
                    - check
                    - document
                    - table
                    - scenario
                instruction:
                  type: string
                position:
                  type: integer
                  minimum: 0
                  maximum: 9007199254740991
              required:
                - type
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LessonDetail'
        '400':
          description: API error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorBody'
        '401':
          description: API error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorBody'
        '403':
          description: API error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorBody'
        '404':
          description: API error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorBody'
        '409':
          description: API error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorBody'
        '429':
          description: API error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiErrorBody'
      security:
        - bearerAuth: []
components:
  schemas:
    LessonDetail:
      type: object
      properties:
        lesson:
          $ref: '#/components/schemas/Lesson'
        moduleTitle:
          type: string
          minLength: 1
        courseTitle:
          type: string
          minLength: 1
        blocks:
          type: array
          items:
            $ref: '#/components/schemas/Block'
        readiness:
          $ref: '#/components/schemas/ReadinessReport'
      required:
        - lesson
        - moduleTitle
        - courseTitle
        - blocks
        - readiness
      additionalProperties: false
    ApiErrorBody:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              enum:
                - unauthenticated
                - forbidden
                - not-found
                - invalid
                - conflict
                - not-ready
                - ai-disabled
                - ai-failed
                - rate-limited
                - too-large
                - unsupported
            message:
              type: string
            details: {}
    Lesson:
      type: object
      properties:
        id:
          type: string
          minLength: 1
        moduleId:
          type: string
          minLength: 1
        courseId:
          type: string
          minLength: 1
        title:
          type: string
          minLength: 1
        minutes:
          type: integer
          minimum: 1
          maximum: 240
        position:
          type: integer
          minimum: 0
          maximum: 9007199254740991
        status:
          type: string
          enum:
            - draft
            - published
        publishedAt:
          anyOf:
            - type: string
              minLength: 1
            - type: 'null'
      required:
        - id
        - moduleId
        - courseId
        - title
        - minutes
        - position
        - status
        - publishedAt
      additionalProperties: false
    Block:
      anyOf:
        - type: object
          properties:
            id:
              type: string
              minLength: 1
            lessonId:
              type: string
              minLength: 1
            position:
              type: integer
              minimum: 0
              maximum: 9007199254740991
            origin:
              type: string
              enum:
                - human
                - ai
            aiState:
              anyOf:
                - type: string
                  enum:
                    - draft
                    - kept
                - type: 'null'
            provenance:
              anyOf:
                - $ref: '#/components/schemas/Provenance'
                - type: 'null'
            previous:
              anyOf:
                - $ref: '#/components/schemas/BlockContent'
                - type: 'null'
            updatedAt:
              type: string
              minLength: 1
            type:
              type: string
              const: heading
            level:
              anyOf:
                - type: number
                  const: 2
                - type: number
                  const: 3
            text:
              type: string
              minLength: 1
          required:
            - id
            - lessonId
            - position
            - origin
            - aiState
            - provenance
            - previous
            - updatedAt
            - type
            - level
            - text
          additionalProperties: false
        - type: object
          properties:
            id:
              type: string
              minLength: 1
            lessonId:
              type: string
              minLength: 1
            position:
              type: integer
              minimum: 0
              maximum: 9007199254740991
            origin:
              type: string
              enum:
                - human
                - ai
            aiState:
              anyOf:
                - type: string
                  enum:
                    - draft
                    - kept
                - type: 'null'
            provenance:
              anyOf:
                - $ref: '#/components/schemas/Provenance'
                - type: 'null'
            previous:
              anyOf:
                - $ref: '#/components/schemas/BlockContent'
                - type: 'null'
            updatedAt:
              type: string
              minLength: 1
            type:
              type: string
              const: text
            text:
              type: string
              minLength: 1
          required:
            - id
            - lessonId
            - position
            - origin
            - aiState
            - provenance
            - previous
            - updatedAt
            - type
            - text
          additionalProperties: false
        - type: object
          properties:
            id:
              type: string
              minLength: 1
            lessonId:
              type: string
              minLength: 1
            position:
              type: integer
              minimum: 0
              maximum: 9007199254740991
            origin:
              type: string
              enum:
                - human
                - ai
            aiState:
              anyOf:
                - type: string
                  enum:
                    - draft
                    - kept
                - type: 'null'
            provenance:
              anyOf:
                - $ref: '#/components/schemas/Provenance'
                - type: 'null'
            previous:
              anyOf:
                - $ref: '#/components/schemas/BlockContent'
                - type: 'null'
            updatedAt:
              type: string
              minLength: 1
            type:
              type: string
              const: callout
            tone:
              type: string
              enum:
                - info
                - tip
                - warning
            title:
              type: string
            text:
              type: string
          required:
            - id
            - lessonId
            - position
            - origin
            - aiState
            - provenance
            - previous
            - updatedAt
            - type
            - tone
            - title
            - text
          additionalProperties: false
        - type: object
          properties:
            id:
              type: string
              minLength: 1
            lessonId:
              type: string
              minLength: 1
            position:
              type: integer
              minimum: 0
              maximum: 9007199254740991
            origin:
              type: string
              enum:
                - human
                - ai
            aiState:
              anyOf:
                - type: string
                  enum:
                    - draft
                    - kept
                - type: 'null'
            provenance:
              anyOf:
                - $ref: '#/components/schemas/Provenance'
                - type: 'null'
            previous:
              anyOf:
                - $ref: '#/components/schemas/BlockContent'
                - type: 'null'
            updatedAt:
              type: string
              minLength: 1
            type:
              type: string
              const: image
            src:
              type: string
              minLength: 1
            alt:
              type: string
            decorative:
              type: boolean
            caption:
              type: string
          required:
            - id
            - lessonId
            - position
            - origin
            - aiState
            - provenance
            - previous
            - updatedAt
            - type
            - src
            - alt
            - decorative
            - caption
          additionalProperties: false
        - type: object
          properties:
            id:
              type: string
              minLength: 1
            lessonId:
              type: string
              minLength: 1
            position:
              type: integer
              minimum: 0
              maximum: 9007199254740991
            origin:
              type: string
              enum:
                - human
                - ai
            aiState:
              anyOf:
                - type: string
                  enum:
                    - draft
                    - kept
                - type: 'null'
            provenance:
              anyOf:
                - $ref: '#/components/schemas/Provenance'
                - type: 'null'
            previous:
              anyOf:
                - $ref: '#/components/schemas/BlockContent'
                - type: 'null'
            updatedAt:
              type: string
              minLength: 1
            type:
              type: string
              const: check
            question:
              type: string
            options:
              minItems: 2
              maxItems: 6
              type: array
              items:
                type: object
                properties:
                  id:
                    type: string
                    minLength: 1
                  text:
                    type: string
                required:
                  - id
                  - text
                additionalProperties: false
            correctOptionId:
              type: string
            feedbackCorrect:
              type: string
            feedbackIncorrect:
              type: string
          required:
            - id
            - lessonId
            - position
            - origin
            - aiState
            - provenance
            - previous
            - updatedAt
            - type
            - question
            - options
            - correctOptionId
            - feedbackCorrect
            - feedbackIncorrect
          additionalProperties: false
        - type: object
          properties:
            id:
              type: string
              minLength: 1
            lessonId:
              type: string
              minLength: 1
            position:
              type: integer
              minimum: 0
              maximum: 9007199254740991
            origin:
              type: string
              enum:
                - human
                - ai
            aiState:
              anyOf:
                - type: string
                  enum:
                    - draft
                    - kept
                - type: 'null'
            provenance:
              anyOf:
                - $ref: '#/components/schemas/Provenance'
                - type: 'null'
            previous:
              anyOf:
                - $ref: '#/components/schemas/BlockContent'
                - type: 'null'
            updatedAt:
              type: string
              minLength: 1
            type:
              type: string
              const: document
            title:
              type: string
              minLength: 1
            sections:
              minItems: 1
              maxItems: 40
              type: array
              items:
                type: object
                properties:
                  heading:
                    type: string
                    minLength: 1
                  text:
                    type: string
                    minLength: 1
                required:
                  - heading
                  - text
                additionalProperties: false
          required:
            - id
            - lessonId
            - position
            - origin
            - aiState
            - provenance
            - previous
            - updatedAt
            - type
            - title
            - sections
          additionalProperties: false
        - type: object
          properties:
            id:
              type: string
              minLength: 1
            lessonId:
              type: string
              minLength: 1
            position:
              type: integer
              minimum: 0
              maximum: 9007199254740991
            origin:
              type: string
              enum:
                - human
                - ai
            aiState:
              anyOf:
                - type: string
                  enum:
                    - draft
                    - kept
                - type: 'null'
            provenance:
              anyOf:
                - $ref: '#/components/schemas/Provenance'
                - type: 'null'
            previous:
              anyOf:
                - $ref: '#/components/schemas/BlockContent'
                - type: 'null'
            updatedAt:
              type: string
              minLength: 1
            type:
              type: string
              const: file
            fileId:
              type: string
              minLength: 1
            title:
              type: string
              minLength: 1
            description:
              type: string
          required:
            - id
            - lessonId
            - position
            - origin
            - aiState
            - provenance
            - previous
            - updatedAt
            - type
            - fileId
            - title
            - description
          additionalProperties: false
        - type: object
          properties:
            id:
              type: string
              minLength: 1
            lessonId:
              type: string
              minLength: 1
            position:
              type: integer
              minimum: 0
              maximum: 9007199254740991
            origin:
              type: string
              enum:
                - human
                - ai
            aiState:
              anyOf:
                - type: string
                  enum:
                    - draft
                    - kept
                - type: 'null'
            provenance:
              anyOf:
                - $ref: '#/components/schemas/Provenance'
                - type: 'null'
            previous:
              anyOf:
                - $ref: '#/components/schemas/BlockContent'
                - type: 'null'
            updatedAt:
              type: string
              minLength: 1
            type:
              type: string
              const: video
            src:
              type: string
              minLength: 1
            provider:
              type: string
              enum:
                - youtube
                - vimeo
                - upload
            title:
              type: string
              minLength: 1
            captionsFileId:
              default: null
              anyOf:
                - type: string
                  minLength: 1
                - type: 'null'
            transcript:
              type: string
            minutes:
              default: 0
              type: integer
              minimum: 0
              maximum: 600
          required:
            - id
            - lessonId
            - position
            - origin
            - aiState
            - provenance
            - previous
            - updatedAt
            - type
            - src
            - provider
            - title
            - captionsFileId
            - transcript
            - minutes
          additionalProperties: false
        - type: object
          properties:
            id:
              type: string
              minLength: 1
            lessonId:
              type: string
              minLength: 1
            position:
              type: integer
              minimum: 0
              maximum: 9007199254740991
            origin:
              type: string
              enum:
                - human
                - ai
            aiState:
              anyOf:
                - type: string
                  enum:
                    - draft
                    - kept
                - type: 'null'
            provenance:
              anyOf:
                - $ref: '#/components/schemas/Provenance'
                - type: 'null'
            previous:
              anyOf:
                - $ref: '#/components/schemas/BlockContent'
                - type: 'null'
            updatedAt:
              type: string
              minLength: 1
            type:
              type: string
              const: table
            caption:
              type: string
            headerRow:
              type: boolean
            rows:
              minItems: 1
              maxItems: 200
              type: array
              items:
                minItems: 1
                maxItems: 20
                type: array
                items:
                  type: string
          required:
            - id
            - lessonId
            - position
            - origin
            - aiState
            - provenance
            - previous
            - updatedAt
            - type
            - caption
            - headerRow
            - rows
          additionalProperties: false
        - type: object
          properties:
            id:
              type: string
              minLength: 1
            lessonId:
              type: string
              minLength: 1
            position:
              type: integer
              minimum: 0
              maximum: 9007199254740991
            origin:
              type: string
              enum:
                - human
                - ai
            aiState:
              anyOf:
                - type: string
                  enum:
                    - draft
                    - kept
                - type: 'null'
            provenance:
              anyOf:
                - $ref: '#/components/schemas/Provenance'
                - type: 'null'
            previous:
              anyOf:
                - $ref: '#/components/schemas/BlockContent'
                - type: 'null'
            updatedAt:
              type: string
              minLength: 1
            type:
              type: string
              const: scenario
            title:
              type: string
              minLength: 1
            setting:
              type: string
            nodes:
              minItems: 1
              maxItems: 60
              type: array
              items:
                type: object
                properties:
                  id:
                    type: string
                    minLength: 1
                  text:
                    type: string
                    minLength: 1
                  choices:
                    maxItems: 6
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          minLength: 1
                        text:
                          type: string
                          minLength: 1
                        nextNodeId:
                          type: string
                          minLength: 1
                        feedback:
                          type: string
                        quality:
                          type: string
                          enum:
                            - best
                            - okay
                            - poor
                      required:
                        - id
                        - text
                        - nextNodeId
                        - feedback
                        - quality
                      additionalProperties: false
                  outcome:
                    type: string
                required:
                  - id
                  - text
                  - choices
                  - outcome
                additionalProperties: false
            startNodeId:
              type: string
              minLength: 1
          required:
            - id
            - lessonId
            - position
            - origin
            - aiState
            - provenance
            - previous
            - updatedAt
            - type
            - title
            - setting
            - nodes
            - startNodeId
          additionalProperties: false
        - type: object
          properties:
            id:
              type: string
              minLength: 1
            lessonId:
              type: string
              minLength: 1
            position:
              type: integer
              minimum: 0
              maximum: 9007199254740991
            origin:
              type: string
              enum:
                - human
                - ai
            aiState:
              anyOf:
                - type: string
                  enum:
                    - draft
                    - kept
                - type: 'null'
            provenance:
              anyOf:
                - $ref: '#/components/schemas/Provenance'
                - type: 'null'
            previous:
              anyOf:
                - $ref: '#/components/schemas/BlockContent'
                - type: 'null'
            updatedAt:
              type: string
              minLength: 1
            type:
              type: string
              const: link
            href:
              type: string
              minLength: 1
              pattern: ^https?:\/\/
            text:
              type: string
              minLength: 1
            description:
              type: string
          required:
            - id
            - lessonId
            - position
            - origin
            - aiState
            - provenance
            - previous
            - updatedAt
            - type
            - href
            - text
            - description
          additionalProperties: false
    ReadinessReport:
      type: object
      properties:
        ready:
          type: boolean
        issues:
          type: array
          items:
            type: object
            properties:
              code:
                type: string
                enum:
                  - empty-lesson
                  - draft-block
                  - missing-alt
                  - heading-order
                  - check-incomplete
              blockId:
                anyOf:
                  - type: string
                    minLength: 1
                  - type: 'null'
              message:
                type: string
            required:
              - code
              - blockId
              - message
            additionalProperties: false
        aiBlocks:
          type: number
          minimum: 0
        keptAiBlocks:
          type: number
          minimum: 0
        accessPolicy:
          type: object
          properties:
            score:
              type: integer
              minimum: 0
              maximum: 100
            reasons:
              type: array
              items:
                type: string
          required:
            - score
            - reasons
          additionalProperties: false
      required:
        - ready
        - issues
        - aiBlocks
        - keptAiBlocks
      additionalProperties: false
    Provenance:
      type: object
      properties:
        model:
          type: string
          minLength: 1
        task:
          type: string
          enum:
            - brief
            - outline
            - lesson-draft
            - block-regenerate
            - announcement
            - feedback
            - alt-text
            - rewrite
            - link-text
            - element
            - tutor
            - tutor-summary
            - agent
        generatedAt:
          type: string
          minLength: 1
        sources:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
                minLength: 1
              name:
                type: string
                minLength: 1
            required:
              - id
              - name
            additionalProperties: false
        summary:
          type: string
      required:
        - model
        - task
        - generatedAt
        - sources
        - summary
      additionalProperties: false
    BlockContent:
      oneOf:
        - type: object
          properties:
            type:
              type: string
              const: heading
            level:
              anyOf:
                - type: number
                  const: 2
                - type: number
                  const: 3
            text:
              type: string
              minLength: 1
          required:
            - type
            - level
            - text
          additionalProperties: false
        - type: object
          properties:
            type:
              type: string
              const: text
            text:
              type: string
              minLength: 1
          required:
            - type
            - text
          additionalProperties: false
        - type: object
          properties:
            type:
              type: string
              const: callout
            tone:
              type: string
              enum:
                - info
                - tip
                - warning
            title:
              type: string
            text:
              type: string
          required:
            - type
            - tone
            - title
            - text
          additionalProperties: false
        - type: object
          properties:
            type:
              type: string
              const: image
            src:
              type: string
              minLength: 1
            alt:
              type: string
            decorative:
              type: boolean
            caption:
              type: string
          required:
            - type
            - src
            - alt
            - decorative
            - caption
          additionalProperties: false
        - type: object
          properties:
            type:
              type: string
              const: check
            question:
              type: string
            options:
              minItems: 2
              maxItems: 6
              type: array
              items:
                type: object
                properties:
                  id:
                    type: string
                    minLength: 1
                  text:
                    type: string
                required:
                  - id
                  - text
                additionalProperties: false
            correctOptionId:
              type: string
            feedbackCorrect:
              type: string
            feedbackIncorrect:
              type: string
          required:
            - type
            - question
            - options
            - correctOptionId
            - feedbackCorrect
            - feedbackIncorrect
          additionalProperties: false
        - type: object
          properties:
            type:
              type: string
              const: document
            title:
              type: string
              minLength: 1
            sections:
              minItems: 1
              maxItems: 40
              type: array
              items:
                type: object
                properties:
                  heading:
                    type: string
                    minLength: 1
                  text:
                    type: string
                    minLength: 1
                required:
                  - heading
                  - text
                additionalProperties: false
          required:
            - type
            - title
            - sections
          additionalProperties: false
        - type: object
          properties:
            type:
              type: string
              const: file
            fileId:
              type: string
              minLength: 1
            title:
              type: string
              minLength: 1
            description:
              type: string
          required:
            - type
            - fileId
            - title
            - description
          additionalProperties: false
        - type: object
          properties:
            type:
              type: string
              const: video
            src:
              type: string
              minLength: 1
            provider:
              type: string
              enum:
                - youtube
                - vimeo
                - upload
            title:
              type: string
              minLength: 1
            captionsFileId:
              default: null
              anyOf:
                - type: string
                  minLength: 1
                - type: 'null'
            transcript:
              type: string
            minutes:
              default: 0
              type: integer
              minimum: 0
              maximum: 600
          required:
            - type
            - src
            - provider
            - title
            - captionsFileId
            - transcript
            - minutes
          additionalProperties: false
        - type: object
          properties:
            type:
              type: string
              const: table
            caption:
              type: string
            headerRow:
              type: boolean
            rows:
              minItems: 1
              maxItems: 200
              type: array
              items:
                minItems: 1
                maxItems: 20
                type: array
                items:
                  type: string
          required:
            - type
            - caption
            - headerRow
            - rows
          additionalProperties: false
        - type: object
          properties:
            type:
              type: string
              const: scenario
            title:
              type: string
              minLength: 1
            setting:
              type: string
            nodes:
              minItems: 1
              maxItems: 60
              type: array
              items:
                type: object
                properties:
                  id:
                    type: string
                    minLength: 1
                  text:
                    type: string
                    minLength: 1
                  choices:
                    maxItems: 6
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          minLength: 1
                        text:
                          type: string
                          minLength: 1
                        nextNodeId:
                          type: string
                          minLength: 1
                        feedback:
                          type: string
                        quality:
                          type: string
                          enum:
                            - best
                            - okay
                            - poor
                      required:
                        - id
                        - text
                        - nextNodeId
                        - feedback
                        - quality
                      additionalProperties: false
                  outcome:
                    type: string
                required:
                  - id
                  - text
                  - choices
                  - outcome
                additionalProperties: false
            startNodeId:
              type: string
              minLength: 1
          required:
            - type
            - title
            - setting
            - nodes
            - startNodeId
          additionalProperties: false
        - type: object
          properties:
            type:
              type: string
              const: link
            href:
              type: string
              minLength: 1
              pattern: ^https?:\/\/
            text:
              type: string
              minLength: 1
            description:
              type: string
          required:
            - type
            - href
            - text
            - description
          additionalProperties: false
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Scoped tsk_… API token or Access JWT

````