POST
/
api
/
v1
/
components
Create a new component
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"
}

Authorizations

x-api-key
string
header
required

API Key for authentication

Body

application/json

Response

201 - application/json

Component created successfully

The response is of type object.