POST
/
api
/
v1
/
components
/
{id}
/
embed
Generate embed code for component
const url = 'https://studyfetchapi.com/api/v1/components/{id}/embed';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
  body: '{"userId":"<string>","groupIds":["class-101","class-102"],"sessionId":"<string>","theme":{"primaryColor":"<string>","secondaryColor":"<string>","backgroundColor":"<string>","textColor":"<string>","fontFamily":"<string>","fontSize":"<string>","borderRadius":"<string>","padding":"<string>","logoUrl":"<string>","hideBranding":true},"features":{"enableWebSearch":true,"enableHistory":true,"enableVoice":true,"enableFollowUps":true,"enableComponentCreation":true,"placeholderText":"<string>","enableWebSearchSources":true,"enableImageSources":true,"enableTranscript":true,"enableOutline":true},"width":"<string>","height":"<string>","expiryHours":1}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
{
  "embedUrl": "<string>",
  "token": "<string>",
  "expiresAt": "2023-11-07T05:31:56Z",
  "componentId": "<string>",
  "componentType": "<string>",
  "options": {
    "width": "<string>",
    "height": "<string>"
  }
}

Authorizations

x-api-key
string
header
required

API Key for authentication

Path Parameters

id
string
required

Component ID

Body

application/json

Response

200 - application/json

Embed code generated successfully

The response is of type object.