Skip to main content
POST
/
api
/
v1
/
materials
/
generate
Generate material from a topic
const url = 'https://studyfetchapi.com/api/v1/materials/generate';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
  body: '{"topic":"Photosynthesis in plants","context":"Focus on light-dependent and light-independent reactions","type":"notes","name":"Photosynthesis Study Plan","folderId":"<string>","length":"medium","level":"college","references":[{"title":"Understanding Photosynthesis","url":"https://example.com/article"}]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
{
  "_id": "<string>",
  "name": "<string>",
  "organizationId": "<string>",
  "folderId": "<string>",
  "contentType": "text",
  "content": {
    "text": "<string>",
    "url": "<string>",
    "s3Key": "<string>",
    "s3Url": "<string>",
    "filename": "<string>",
    "fileSize": 123,
    "mimeType": "<string>"
  },
  "metadata": {},
  "status": "active",
  "usage": {},
  "references": [
    {
      "title": "Understanding Photosynthesis",
      "url": "https://example.com/article"
    }
  ],
  "createdAt": "2023-11-07T05:31:56Z",
  "updatedAt": "2023-11-07T05:31:56Z",
  "generationMetadata": {}
}

Authorizations

x-api-key
string
header
required

API Key for authentication

Body

application/json
topic
string
required

Topic or context to generate material from

Example:

"Photosynthesis in plants"

type
enum<string>
required

Type of material to generate

Available options:
outline,
overview,
notes,
summary
Example:

"notes"

name
string
required

Name for the generated material

Example:

"Photosynthesis Study Plan"

context
string

Additional context or details about the topic

Example:

"Focus on light-dependent and light-independent reactions"

folderId
string

Target folder ID

length
enum<string>
default:medium

Length of the generated content

Available options:
short,
medium,
long
level
enum<string>

Target education level

Available options:
high_school,
college,
professional
Example:

"college"

references
object[]

References that this material cites

Response

Material generated successfully

_id
string
required

Material ID

name
string
required

Material name

organizationId
string
required

Organization ID

folderId
string | null
required

Folder ID

contentType
enum<string>
required

Content type

Available options:
text,
pdf,
video,
audio,
image,
epub
content
object
required

Material content

status
enum<string>
required

Material status

Available options:
active,
processing,
pending_upload,
error,
deleted
createdAt
string<date-time>
required

Creation timestamp

updatedAt
string<date-time>
required

Last update timestamp

metadata
object

Material metadata

usage
object

Usage information

references
object[]

References that this material cites

generationMetadata
object

Generation metadata

I