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

# POST - Generate Worksheet Explanations

> Initiates the worksheet explanation generation process for a given worksheet.  
This step generates detailed explanations for each question in the worksheet after question generation is completed.

**Prerequisites:**
- The worksheet must exist.
- The question generation step (`QUESTION_GENERATION`) must be completed.
- The explanation generation must not already be in progress or completed.

**How to Use:**
 1. Call `POST /worksheet/v1/generate-explanations/{work_sheet_id}` with a valid worksheet ID.
 2. The API validates that:
    - The worksheet exists.
    - Question generation is completed.
    - Explanation generation has not already started or completed.
 3. If validation passes, the explanation generation job is queued asynchronously.
 4. You receive a confirmation message with the worksheet ID.

**Path Parameters:**
- `work_sheet_id` (UUID, required): The unique ID of the worksheet.

**Response Codes:**
- `200 OK`: Explanation generation initiated successfully.
- `400 Bad Request`: Question generation not completed yet, or explanation generation already in progress/completed.
- `404 Not Found`: Worksheet not found.




## OpenAPI

````yaml POST /worksheet/v1/generate-explanations/{work_sheet_id}
openapi: 3.0.1
info:
  title: Worksheet Explanation API
  description: An API for generating and retrieving worksheet question explanations.
  version: 1.0.0
servers:
  - url: https://api-staging.crazygoldfish.com
    description: SandBox endpoint
  - url: https://api.crazygoldfish.com
    description: Prod End Point
security: []
paths:
  /worksheet/v1/generate-explanations/{work_sheet_id}:
    post:
      summary: Generate Worksheet Explanations
      description: >-
        Initiates the worksheet explanation generation process for a given
        worksheet. This step generates detailed explanations for each question
        in the worksheet after question generation is completed.
      operationId: generateWorksheetExplanations
      parameters:
        - name: work_sheet_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
          description: Unique identifier of the worksheet
      responses:
        '200':
          description: Worksheet explanation generation initiated successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          description: Unique identifier for the worksheet.
                          example: d7494c99-0539-ce2-92e0c2ede6d1
                        msg:
                          type: string
                          description: >-
                            Confirmation message indicating successful
                            initiation.
                          example: >-
                            Worksheet explanation generation initiated
                            successfully.
              example:
                detail:
                  - id: d7494c99-0539-ce2-92e0c2ede6d1
                    msg: Worksheet explanation generation initiated successfully.
        '400':
          description: >-
            Bad request due to incomplete prerequisites or explanation
            generation already in progress/completed.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: array
                    items:
                      type: object
                      properties:
                        msg:
                          type: string
              examples:
                questionGenerationNotCompleted:
                  summary: Question generation not completed
                  value:
                    detail:
                      - msg: Worksheet explanation generation not completed yet.
                explanationAlreadyInProgress:
                  summary: Explanation generation already in progress
                  value:
                    detail:
                      - msg: Worksheet explanation generation already In Progress.
                explanationAlreadyCompleted:
                  summary: Explanation generation already completed
                  value:
                    detail:
                      - msg: Worksheet explanation generation already Completed.
        '404':
          description: Worksheet not found.
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: array
                    items:
                      type: object
                      properties:
                        msg:
                          type: string
              example:
                detail:
                  - msg: Worksheet not found.
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````