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

# Generate a quiz from a source.



## OpenAPI

````yaml /openapi/v1.yaml post /v1/sources/{sourceId}/quizzes
openapi: 3.1.0
info:
  title: ConchAI B2B API (v1)
  version: 1.0.0
  description: |
    OpenAPI contract for the latest business-facing endpoints under /v1.
servers:
  - url: https://api.getconch.ai
    description: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Organization
  - name: Sources
  - name: Flashcards
  - name: Mindmaps
  - name: Quizzes
paths:
  /v1/sources/{sourceId}/quizzes:
    post:
      tags:
        - Quizzes
      summary: Generate a quiz from a source.
      operationId: createQuiz
      parameters:
        - $ref: '#/components/parameters/SourceIdParam'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateQuizRequest'
      responses:
        '201':
          description: Quiz created successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenericDataResponse'
        '400':
          $ref: '#/components/responses/BadRequestResponse'
        '401':
          $ref: '#/components/responses/UnauthorizedResponse'
        '403':
          $ref: '#/components/responses/ForbiddenResponse'
        '404':
          $ref: '#/components/responses/NotFoundResponse'
        '500':
          $ref: '#/components/responses/InternalServerErrorResponse'
components:
  parameters:
    SourceIdParam:
      in: path
      name: sourceId
      required: true
      schema:
        type: string
        pattern: ^[a-fA-F0-9]{24}$
  schemas:
    CreateQuizRequest:
      type: object
      properties:
        numberOfQuestions:
          type: integer
          minimum: 1
          maximum: 30
        difficulty:
          type: string
          enum:
            - easy
            - medium
            - hard
            - extreme
    GenericDataResponse:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/GenericObject'
      required:
        - data
    GenericObject:
      type: object
      additionalProperties: true
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
      required:
        - error
  responses:
    BadRequestResponse:
      description: Invalid request payload.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    UnauthorizedResponse:
      description: Missing or invalid authentication credentials.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    ForbiddenResponse:
      description: Resource belongs to another organization.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFoundResponse:
      description: Resource not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    InternalServerErrorResponse:
      description: Internal server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: Business API key issued per organization.

````