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

# Duplicate a Lesson

> Duplicates a lesson in the selected section and leaves the copy unpublished. The copy keeps its content, media and steps. Returns a background operation. Check its status until completed or failed.



## OpenAPI

````yaml post /lessons/{id}/duplicate
openapi: 3.0.1
info:
  title: SchoolMaker API V1
  description: API for managing your SchoolMaker school
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://schoolmaker.co/api/v1
    description: Production API
security:
  - bearerAuth: []
paths:
  /lessons/{id}/duplicate:
    post:
      tags:
        - Lessons
      summary: Duplicate a Lesson
      description: >-
        Duplicates a lesson in the selected section and leaves the copy
        unpublished. The copy keeps its content, media and steps. Returns a
        background operation. Check its status until completed or failed.
      operationId: duplicateLesson
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: Lesson ID.
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  maxLength: 255
                  description: >-
                    Name of the copy, up to 255 characters. Omitted or empty
                    uses Copy of followed by the original name, in the school
                    language. The complete name must fit the limit.
                idempotency_key:
                  type: string
                  minLength: 1
                  maxLength: 255
                  description: >-
                    Reuse the same key with identical request details to return
                    the existing operation. Different request details with the
                    same key return HTTP 422.
                destination_section_id:
                  type: string
                  minLength: 1
                  maxLength: 255
                  description: >-
                    Destination section ID. Defaults to the source section. You
                    need edit access to both programs.
              additionalProperties: false
            example:
              destination_section_id: section_id
              name: Copied lesson
              idempotency_key: lesson-import-copy-1
      responses:
        '200':
          description: Existing duplication request. Check its status.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LessonBackgroundOperation'
        '202':
          description: Duplication in progress.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LessonBackgroundOperation'
              example:
                id: operation_id
                operation: duplicate_lesson
                status: pending
                result: null
                error: null
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LessonError'
              example:
                error: Access denied
        '403':
          description: You do not have permission to perform this action.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LessonError'
              example:
                error: Access denied
        '404':
          description: Lesson not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LessonError'
              example:
                error: Record not found
        '422':
          description: Invalid request. No changes were saved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LessonError'
              example:
                error: 'Invalid arguments: /attributes/drip_delay integer'
components:
  schemas:
    LessonBackgroundOperation:
      type: object
      required:
        - id
        - operation
        - status
        - result
        - error
      properties:
        id:
          type: string
        operation:
          type: string
          example: duplicate_lesson
        status:
          type: string
          enum:
            - pending
            - running
            - completed
            - failed
        result:
          type: object
          nullable: true
          description: Details of the copied lesson once duplication is complete.
        error:
          type: string
          nullable: true
    LessonError:
      type: object
      required:
        - error
      properties:
        error:
          oneOf:
            - type: string
            - type: array
              items:
                type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.