> ## 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 embed code for component



## OpenAPI

````yaml /openapi-components.json post /api/v1/components/{id}/embed
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/components/{id}/embed:
    post:
      tags:
        - Components
      summary: Generate embed code for component
      operationId: generateEmbed
      parameters:
        - name: id
          required: true
          in: path
          description: Component ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateEmbedDto'
      responses:
        '200':
          description: Embed code generated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenerateEmbedResponseDto'
      security:
        - x-api-key: []
components:
  schemas:
    GenerateEmbedDto:
      type: object
      properties:
        userId:
          type: string
          description: User ID for tracking
        groupIds:
          description: Group IDs for collaboration
          example:
            - class-101
            - class-102
          type: array
          items:
            type: string
        sessionId:
          type: string
          description: Session ID for continuity
        theme:
          description: Theme customization
          allOf:
            - $ref: '#/components/schemas/EmbedThemeDto'
        features:
          description: Feature toggles
          allOf:
            - $ref: '#/components/schemas/EmbedFeaturesDto'
        width:
          type: string
          description: Embed width (e.g., "100%", "600px")
        height:
          type: string
          description: Embed height (e.g., "400px", "100vh")
        expiryHours:
          type: number
          description: Token expiry time in hours
          default: 1
    GenerateEmbedResponseDto:
      type: object
      properties:
        embedUrl:
          type: string
          description: The embed URL for iframe integration
        token:
          type: string
          description: JWT token for authentication
        expiresAt:
          format: date-time
          type: string
          description: Token expiration timestamp
        componentId:
          type: string
          description: Component ID
        componentType:
          type: string
          description: Component type
        options:
          type: object
          description: Embed options
          properties:
            width:
              type: string
              description: Embed width
            height:
              type: string
              description: Embed height
      required:
        - embedUrl
        - token
        - expiresAt
        - componentId
        - componentType
        - options
    EmbedThemeDto:
      type: object
      properties:
        primaryColor:
          type: string
          description: Primary color (hex)
        secondaryColor:
          type: string
          description: Secondary color (hex)
        backgroundColor:
          type: string
          description: Background color (hex)
        textColor:
          type: string
          description: Text color (hex)
        fontFamily:
          type: string
          description: Font family
        fontSize:
          type: string
          description: Font size
        borderRadius:
          type: string
          description: Border radius
        padding:
          type: string
          description: Padding
        logoUrl:
          type: string
          description: Logo URL
        hideBranding:
          type: boolean
          description: Hide branding
    EmbedFeaturesDto:
      type: object
      properties:
        enableWebSearch:
          type: boolean
          description: Enable web search
        enableHistory:
          type: boolean
          description: Enable history
        enableVoice:
          type: boolean
          description: Enable voice input
        enableFollowUps:
          type: boolean
          description: Enable follow-up questions
        enableComponentCreation:
          type: boolean
          description: Enable component creation
        placeholderText:
          type: string
          description: Placeholder text
        enableWebSearchSources:
          type: boolean
          description: Enable web search sources
        enableImageSources:
          type: boolean
          description: Enable image sources
        enableTranscript:
          type: boolean
          description: Enable transcript
        enableOutline:
          type: boolean
          description: Enable outline
        enableBadWordsFilter:
          type: boolean
          description: Enable bad words filter
        enableGuardrails:
          type: boolean
          description: Enable guardrails
        enablePromptingScore:
          type: boolean
          description: Enable prompting quality score
          default: true
        enableResponsibilityScore:
          type: boolean
          description: Enable learning responsibility score
          default: true
        enableReferenceMode:
          type: boolean
          description: Enable reference mode - show references instead of source content
      required:
        - enableBadWordsFilter
  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.

````