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

# Replace Assignment

> Replace assignment through SoluDesks APIs.

This resource is tenant-only. Tenant API keys can use it when the key has the required LearnHub permissions. Service-provider API keys are not supported for this resource.



## OpenAPI

````yaml api-reference/openapi.json PUT /v1/external/learnhub/assignments/{id}
openapi: 3.0.3
info:
  title: SoluDesks APIs
  version: 1.0.0
  description: >-
    REST API reference for documented SoluDesks API families. This generated
    file currently includes the LearnHub external endpoints.
servers:
  - url: https://staging.api.soludesks.com
    description: SoluDesks staging API
security:
  - apiKeyAuth: []
tags:
  - name: Categories
  - name: Courses
  - name: Sections
  - name: Lessons
  - name: Assessments
  - name: Assignments
  - name: Quizzes
  - name: Uploads
paths:
  /v1/external/learnhub/assignments/{id}:
    put:
      tags:
        - Assignments
      summary: Replace assignment
      description: >-
        Replace assignment through SoluDesks APIs.


        This resource is tenant-only. Tenant API keys can use it when the key
        has the required LearnHub permissions. Service-provider API keys are not
        supported for this resource.
      operationId: v1_external_learnhub_assignments_update
      parameters:
        - in: path
          name: id
          schema:
            type: string
            format: uuid
          required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/ExternalLearnHubAssignmentCreateUpdateRequest
            examples:
              assignment:
                summary: Assignment
                value:
                  title: Final project
                  description: Submit your work.
                  questions: []
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/ExternalLearnHubAssignmentUpdateExternalLearnHubAPIResponse
          description: ''
        '400':
          description: Bad request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExternalLearnHubErrorResponse'
              examples:
                error:
                  summary: Bad request.
                  value:
                    status: 400
                    success: false
                    code: REQUEST_FAILED
                    message: Bad request.
                    data: null
                    errors: []
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExternalLearnHubErrorResponse'
              examples:
                error:
                  summary: Missing or invalid API key.
                  value:
                    status: 401
                    success: false
                    code: REQUEST_FAILED
                    message: Missing or invalid API key.
                    data: null
                    errors: []
        '403':
          description: >-
            Permission denied, inactive service provider, or unsupported key
            mode.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExternalLearnHubErrorResponse'
              examples:
                error:
                  summary: >-
                    Permission denied, inactive service provider, or unsupported
                    key mode.
                  value:
                    status: 403
                    success: false
                    code: REQUEST_FAILED
                    message: >-
                      Permission denied, inactive service provider, or
                      unsupported key mode.
                    data: null
                    errors: []
        '404':
          description: Resource not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExternalLearnHubErrorResponse'
              examples:
                error:
                  summary: Resource not found.
                  value:
                    status: 404
                    success: false
                    code: REQUEST_FAILED
                    message: Resource not found.
                    data: null
                    errors: []
        '409':
          description: Idempotency conflict or request already in progress.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExternalLearnHubErrorResponse'
              examples:
                error:
                  summary: Idempotency conflict or request already in progress.
                  value:
                    status: 409
                    success: false
                    code: REQUEST_FAILED
                    message: Idempotency conflict or request already in progress.
                    data: null
                    errors: []
        '422':
          description: Validation failed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExternalLearnHubErrorResponse'
              examples:
                error:
                  summary: Validation failed.
                  value:
                    status: 422
                    success: false
                    code: REQUEST_FAILED
                    message: Validation failed.
                    data: null
                    errors: []
        '429':
          description: Rate limit exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExternalLearnHubErrorResponse'
              examples:
                error:
                  summary: Rate limit exceeded.
                  value:
                    status: 429
                    success: false
                    code: REQUEST_FAILED
                    message: Rate limit exceeded.
                    data: null
                    errors: []
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExternalLearnHubErrorResponse'
              examples:
                error:
                  summary: Internal server error.
                  value:
                    status: 500
                    success: false
                    code: REQUEST_FAILED
                    message: Internal server error.
                    data: null
                    errors: []
      security:
        - apiKeyAuth: []
components:
  schemas:
    ExternalLearnHubAssignmentCreateUpdateRequest:
      type: object
      properties:
        title:
          type: string
          minLength: 1
          maxLength: 255
        description:
          type: string
          minLength: 1
        duration_hours:
          type: integer
          maximum: 2147483647
          minimum: 0
        duration_minutes:
          type: integer
          maximum: 2147483647
          minimum: 0
        status:
          $ref: '#/components/schemas/Status0b2Enum'
        submission_date:
          type: string
          format: date
          nullable: true
        class_id:
          type: string
          format: uuid
          writeOnly: true
        course_id:
          type: string
          format: uuid
          writeOnly: true
          nullable: true
        questions:
          type: array
          items:
            $ref: '#/components/schemas/AssignmentQuestionBulkUpdateItemRequest'
      required:
        - class_id
        - description
        - title
    ExternalLearnHubAssignmentUpdateExternalLearnHubAPIResponse:
      type: object
      properties:
        status:
          type: integer
        success:
          type: boolean
        code:
          type: string
        message:
          type: string
        data:
          $ref: '#/components/schemas/ExternalLearnHubAssignmentResponse'
        errors:
          type: array
          items:
            type: object
            additionalProperties: {}
      required:
        - code
        - data
        - errors
        - message
        - status
        - success
    ExternalLearnHubErrorResponse:
      type: object
      required:
        - status
        - success
        - code
        - message
        - data
        - errors
      properties:
        status:
          type: integer
          example: 422
        success:
          type: boolean
          example: false
        code:
          type: string
          example: VALIDATION_ERROR
        message:
          type: string
          example: Some fields contain invalid values.
        data:
          nullable: true
          example: null
        errors:
          type: array
          items:
            $ref: '#/components/schemas/ExternalLearnHubErrorItem'
    Status0b2Enum:
      enum:
        - DRAFT
        - PUBLISHED
        - ARCHIVED
      type: string
      description: |-
        * `DRAFT` - Draft
        * `PUBLISHED` - Published
        * `ARCHIVED` - Archived
    AssignmentQuestionBulkUpdateItemRequest:
      type: object
      properties:
        id:
          type: string
          format: uuid
          nullable: true
        question_text:
          type: string
          minLength: 1
        points:
          type: string
          format: decimal
          pattern: ^-?\d{0,8}(?:\.\d{0,2})?$
        question_type:
          $ref: '#/components/schemas/QuestionTypeEf3Enum'
        options:
          nullable: true
        correct_answer:
          nullable: true
        order:
          type: integer
    ExternalLearnHubAssignmentResponse:
      type: object
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
        title:
          type: string
          readOnly: true
        description:
          type: string
          readOnly: true
        duration_hours:
          type: integer
          readOnly: true
        duration_minutes:
          type: integer
          readOnly: true
        status:
          allOf:
            - $ref: '#/components/schemas/Status0b2Enum'
          readOnly: true
        total_points:
          type: string
          format: decimal
          pattern: ^-?\d{0,8}(?:\.\d{0,2})?$
          readOnly: true
        submission_date:
          type: string
          format: date
          readOnly: true
          nullable: true
        class_id:
          type: string
          format: uuid
          readOnly: true
        learning_class:
          allOf:
            - $ref: '#/components/schemas/AssignmentClassSummary'
          readOnly: true
        course_id:
          type: string
          format: uuid
          readOnly: true
        course:
          allOf:
            - $ref: '#/components/schemas/ExternalLearnHubCourseResponse'
          readOnly: true
        questions_count:
          type: string
          readOnly: true
        created_datetime:
          type: string
          format: date-time
          readOnly: true
          description: datetime of object creation
        updated_datetime:
          type: string
          format: date-time
          readOnly: true
          description: datetime of object update
        questions:
          type: string
          readOnly: true
      required:
        - class_id
        - course
        - course_id
        - created_datetime
        - description
        - duration_hours
        - duration_minutes
        - id
        - learning_class
        - questions
        - questions_count
        - status
        - submission_date
        - title
        - total_points
        - updated_datetime
    ExternalLearnHubErrorItem:
      type: object
      properties:
        field:
          type: string
          example: title
        code:
          type: string
          example: required
        message:
          type: string
          example: This field is required.
    QuestionTypeEf3Enum:
      enum:
        - MULTIPLE_CHOICE
        - SINGLE_CHOICE
        - SHORT_ANSWER
        - LONG_ANSWER
      type: string
      description: |-
        * `MULTIPLE_CHOICE` - Multiple Choice
        * `SINGLE_CHOICE` - Single Choice
        * `SHORT_ANSWER` - Short Answer
        * `LONG_ANSWER` - Long Answer
    AssignmentClassSummary:
      type: object
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
        name:
          type: string
          readOnly: true
        status:
          allOf:
            - $ref: '#/components/schemas/AssignmentClassSummaryStatusEnum'
          readOnly: true
      required:
        - id
        - name
        - status
    ExternalLearnHubCourseResponse:
      type: object
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
        name:
          type: string
          readOnly: true
        level:
          allOf:
            - $ref: '#/components/schemas/LevelEnum'
          readOnly: true
        description:
          type: string
          readOnly: true
        source:
          readOnly: true
          nullable: true
          oneOf:
            - $ref: '#/components/schemas/Source41fEnum'
            - $ref: '#/components/schemas/NullEnum'
        requirements:
          type: string
          readOnly: true
          description: Optional prerequisites or requirements for the course.
        status:
          allOf:
            - $ref: '#/components/schemas/Status0b2Enum'
          readOnly: true
        categories:
          type: array
          items:
            $ref: '#/components/schemas/CourseCategoryResponse'
          readOnly: true
        has_enrollments:
          type: boolean
          readOnly: true
        quizzes_count:
          type: integer
          readOnly: true
        cover_image_url:
          type: string
          readOnly: true
        preview_video_url:
          type: string
          readOnly: true
        preview_video_status:
          type: string
          readOnly: true
        preview_video_ready:
          type: string
          readOnly: true
        preview_video_error:
          type: string
          nullable: true
          readOnly: true
        preview_video_has_subtitles:
          type: boolean
          readOnly: true
        preview_video_playback_endpoint:
          type: string
          nullable: true
          readOnly: true
        instructors:
          type: string
          readOnly: true
        overall_duration_seconds:
          type: integer
          readOnly: true
        created_datetime:
          type: string
          format: date-time
          readOnly: true
          description: datetime of object creation
        updated_datetime:
          type: string
          format: date-time
          readOnly: true
          description: datetime of object update
      required:
        - categories
        - cover_image_url
        - created_datetime
        - description
        - has_enrollments
        - id
        - instructors
        - level
        - name
        - overall_duration_seconds
        - preview_video_error
        - preview_video_has_subtitles
        - preview_video_playback_endpoint
        - preview_video_ready
        - preview_video_status
        - preview_video_url
        - quizzes_count
        - requirements
        - source
        - status
        - updated_datetime
    AssignmentClassSummaryStatusEnum:
      enum:
        - ACTIVE
        - CLOSED
      type: string
      description: |-
        * `ACTIVE` - Active
        * `CLOSED` - Closed
    LevelEnum:
      enum:
        - beginner
        - intermediate
        - advanced
      type: string
      description: |-
        * `beginner` - Beginner
        * `intermediate` - Intermediate
        * `advanced` - Advanced
    Source41fEnum:
      enum:
        - MANUAL_CREATION
        - AI_GENERATED
        - DOCUMENT_EXTRACTION
      type: string
      description: |-
        * `MANUAL_CREATION` - Manual Creation
        * `AI_GENERATED` - AI Generated
        * `DOCUMENT_EXTRACTION` - Document Extraction
    NullEnum:
      enum:
        - null
    CourseCategoryResponse:
      type: object
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
        name:
          type: string
          readOnly: true
        created_datetime:
          type: string
          format: date-time
          readOnly: true
          description: datetime of object creation
        updated_datetime:
          type: string
          format: date-time
          readOnly: true
          description: datetime of object update
      required:
        - created_datetime
        - id
        - name
        - updated_datetime
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: 'External API key. Format: Bearer <API_KEY>'

````