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

# Generate material from a topic

> Uses AI to generate study materials like outlines, notes, summaries, etc. from a given topic. Returns immediately without waiting for processing.



## OpenAPI

````yaml /openapi-components.json post /api/v1/materials/generate
openapi: 3.0.0
info:
  title: StudyFetch API
  description: API documentation for StudyFetch
  version: '1.0'
  contact: {}
servers:
  - url: https://studyfetchapi.com
    description: Production API Server
security: []
tags: []
paths:
  /api/v1/materials/generate:
    post:
      tags:
        - Materials
      summary: Generate material from a topic
      description: >-
        Uses AI to generate study materials like outlines, notes, summaries,
        etc. from a given topic. Returns immediately without waiting for
        processing.
      operationId: generate
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateFromTopicDto'
      responses:
        '201':
          description: Material generated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GeneratedMaterialResponseDto'
        '400':
          description: Invalid parameters or generation failed
        '403':
          description: Insufficient permissions
      security:
        - x-api-key: []
components:
  schemas:
    GenerateFromTopicDto:
      type: object
      properties:
        topic:
          type: string
          description: Topic or context to generate material from
          example: Photosynthesis in plants
        context:
          type: string
          description: Additional context or details about the topic
          example: Focus on light-dependent and light-independent reactions
        type:
          type: string
          description: Type of material to generate
          enum:
            - outline
            - overview
            - notes
            - summary
          example: notes
        name:
          type: string
          description: Name for the generated material
          example: Photosynthesis Study Plan
        folderId:
          type: string
          description: Target folder ID
        length:
          type: string
          description: Length of the generated content
          enum:
            - short
            - medium
            - long
          default: medium
        level:
          type: string
          description: Target education level
          enum:
            - high_school
            - college
            - professional
          example: college
        references:
          description: References that this material cites
          type: array
          items:
            $ref: '#/components/schemas/ReferenceDto'
      required:
        - topic
        - type
        - name
    GeneratedMaterialResponseDto:
      type: object
      properties:
        _id:
          type: string
          description: Material ID
        name:
          type: string
          description: Material name
        organizationId:
          type: string
          description: Organization ID
        folderId:
          type: string
          description: Folder ID
          nullable: true
        contentType:
          type: string
          description: Content type
          enum:
            - text
            - pdf
            - video
            - audio
            - image
            - epub
        content:
          type: object
          description: Material content
          properties:
            text:
              type: string
            url:
              type: string
            s3Key:
              type: string
            s3Url:
              type: string
            filename:
              type: string
            fileSize:
              type: number
            mimeType:
              type: string
        metadata:
          type: object
          description: Material metadata
        status:
          type: string
          description: Material status
          enum:
            - active
            - processing
            - pending_upload
            - error
            - deleted
        usage:
          type: object
          description: Usage information
        references:
          description: References that this material cites
          type: array
          items:
            $ref: '#/components/schemas/ReferenceDto'
        createdAt:
          format: date-time
          type: string
          description: Creation timestamp
        updatedAt:
          format: date-time
          type: string
          description: Last update timestamp
        generationMetadata:
          type: object
          description: Generation metadata
      required:
        - _id
        - name
        - organizationId
        - folderId
        - contentType
        - content
        - status
        - createdAt
        - updatedAt
    ReferenceDto:
      type: object
      properties:
        title:
          type: string
          example: Understanding Photosynthesis
          description: Reference title
        url:
          type: string
          example: https://example.com/article
          description: Reference URL
      required:
        - title
  securitySchemes:
    x-api-key:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        API Key for server-to-server authentication. Resolves to the owning
        organization.

````