const url = 'https://studyfetchapi.com/api/v1/components';
const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: '{"type":"chat","name":"My Study Component","description":"A component for studying biology","config":{"materials":["<string>"],"folders":["<string>"],"model":"gpt-4o-mini-2024-07-18","systemPrompt":"<string>","temperature":1,"maxTokens":123,"enableWebSearch":true,"enableRAGSearch":true,"enableHistory":true,"enableVoice":true,"enableFollowUps":true,"enableComponentCreation":true,"maxSteps":123},"metadata":{}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
{
"_id": "<string>",
"componentId": "<string>",
"type": "chat",
"name": "<string>",
"description": "<string>",
"organization": "<string>",
"config": {},
"status": "active",
"usage": {},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
const url = 'https://studyfetchapi.com/api/v1/components';
const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: '{"type":"chat","name":"My Study Component","description":"A component for studying biology","config":{"materials":["<string>"],"folders":["<string>"],"model":"gpt-4o-mini-2024-07-18","systemPrompt":"<string>","temperature":1,"maxTokens":123,"enableWebSearch":true,"enableRAGSearch":true,"enableHistory":true,"enableVoice":true,"enableFollowUps":true,"enableComponentCreation":true,"maxSteps":123},"metadata":{}}'
};
try {
const response = await fetch(url, options);
const data = await response.json();
console.log(data);
} catch (error) {
console.error(error);
}
{
"_id": "<string>",
"componentId": "<string>",
"type": "chat",
"name": "<string>",
"description": "<string>",
"organization": "<string>",
"config": {},
"status": "active",
"usage": {},
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}
API Key for authentication
Component created successfully
The response is of type object
.
Was this page helpful?