const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Chapter 1 - Introduction',
content: {text: '<string>', url: '<string>', sourceUrl: '<string>'},
folderId: '<string>',
references: [{title: 'Understanding Photosynthesis', url: 'https://example.com/article'}],
timeoutMs: 300000,
pollIntervalMs: 2000
})
};
fetch('https://studyfetchapi.com/api/v1/materials/upload-and-process', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://studyfetchapi.com/api/v1/materials/upload-and-process \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "Chapter 1 - Introduction",
"content": {
"text": "<string>",
"url": "<string>",
"sourceUrl": "<string>"
},
"folderId": "<string>",
"references": [
{
"title": "Understanding Photosynthesis",
"url": "https://example.com/article"
}
],
"timeoutMs": 300000,
"pollIntervalMs": 2000
}
'import requests
url = "https://studyfetchapi.com/api/v1/materials/upload-and-process"
payload = {
"name": "Chapter 1 - Introduction",
"content": {
"text": "<string>",
"url": "<string>",
"sourceUrl": "<string>"
},
"folderId": "<string>",
"references": [
{
"title": "Understanding Photosynthesis",
"url": "https://example.com/article"
}
],
"timeoutMs": 300000,
"pollIntervalMs": 2000
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"_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>"
},
"status": "active",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"metadata": {},
"usage": {},
"references": [
{
"title": "Understanding Photosynthesis",
"url": "https://example.com/article"
}
]
}Create material and wait for processing to complete
Creates a material and waits for processing to finish before returning. Useful for synchronous API usage.
const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
name: 'Chapter 1 - Introduction',
content: {text: '<string>', url: '<string>', sourceUrl: '<string>'},
folderId: '<string>',
references: [{title: 'Understanding Photosynthesis', url: 'https://example.com/article'}],
timeoutMs: 300000,
pollIntervalMs: 2000
})
};
fetch('https://studyfetchapi.com/api/v1/materials/upload-and-process', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));curl --request POST \
--url https://studyfetchapi.com/api/v1/materials/upload-and-process \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"name": "Chapter 1 - Introduction",
"content": {
"text": "<string>",
"url": "<string>",
"sourceUrl": "<string>"
},
"folderId": "<string>",
"references": [
{
"title": "Understanding Photosynthesis",
"url": "https://example.com/article"
}
],
"timeoutMs": 300000,
"pollIntervalMs": 2000
}
'import requests
url = "https://studyfetchapi.com/api/v1/materials/upload-and-process"
payload = {
"name": "Chapter 1 - Introduction",
"content": {
"text": "<string>",
"url": "<string>",
"sourceUrl": "<string>"
},
"folderId": "<string>",
"references": [
{
"title": "Understanding Photosynthesis",
"url": "https://example.com/article"
}
],
"timeoutMs": 300000,
"pollIntervalMs": 2000
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text){
"_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>"
},
"status": "active",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"metadata": {},
"usage": {},
"references": [
{
"title": "Understanding Photosynthesis",
"url": "https://example.com/article"
}
]
}Authorizations
API Key for server-to-server authentication. Resolves to the owning organization.
Body
Name of the material
"Chapter 1 - Introduction"
Content details
Show child attributes
Show child attributes
Folder ID to place the material in
References that this material cites
Show child attributes
Show child attributes
Maximum time to wait for processing in milliseconds (default: 5 minutes)
Polling interval in milliseconds (default: 2 seconds)
Response
Material created and processed successfully
Material ID
Material name
Organization ID
Folder ID
Content type
text, pdf, video, audio, image, epub Material content
Show child attributes
Show child attributes
Material status
active, processing, pending_upload, error, deleted Creation timestamp
Last update timestamp
Material metadata
Usage information
References that this material cites
Show child attributes
Show child attributes
Was this page helpful?