Skip to content
StudyFetch API

Components

Generate embed code for component

OpenAPI specification
POST/api/v1/components/{id}/embed

Authentication

x-api-key

Request

curl --globoff --request POST \
  --url 'https://api.example.com/api/v1/components/%3Cid%3E/embed' \
  --header 'x-api-key: <API_KEY>' \
  --header 'Content-Type: application/json' \
  --data-raw '{}'

Replace credential and <field> placeholders with your own values. URL placeholders appear as %3Cfield%3E. Review the example values before sending your request.

Replace https://api.example.com with the API server URL.

Use the sample JSON body as your starting point, and enter values that match the endpoint's schema.

Parameters

idpath · string · required

Component ID

Request body schema or example

{
  "type": "object",
  "properties": {
    "userId": {
      "type": "string",
      "description": "User ID for tracking"
    },
    "studentName": {
      "type": "string",
      "description": "Student name for display and 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": [
        {
          "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"
            }
          }
        }
      ]
    },
    "features": {
      "description": "Feature toggles",
      "allOf": [
        {
          "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"
            },
            "enableFeedback": {
              "type": "boolean",
              "description": "Enable thumbs up/down feedback with reason",
              "default": true
            },
            "hideTitle": {
              "type": "boolean",
              "description": "Hide the chat title and avatar in the embedded component"
            },
            "emptyStateHtml": {
              "type": "string",
              "description": "Custom HTML to show in empty state instead of default icon and text"
            },
            "hideEmptyState": {
              "type": "boolean",
              "description": "Hide the default empty state (icon and text)"
            }
          },
          "required": [
            "enableBadWordsFilter"
          ]
        }
      ]
    },
    "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
    }
  }
}

Responses

200Embed code generated successfully
{
  "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"
  ]
}