Upload material file and wait for processing to complete
const form = new FormData();
form.append('file', '<string>');
form.append('name', '<string>');
form.append('folderId', '<string>');
form.append('timeoutMs', '123');
form.append('pollIntervalMs', '123');
form.append('extractImages', 'true');
const options = {method: 'POST', headers: {'x-api-key': '<api-key>'}};
options.body = form;
fetch('https://studyfetchapi.com/api/v1/materials/upload/file-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/file-and-process \
--header 'Content-Type: multipart/form-data' \
--header 'x-api-key: <api-key>' \
--form file='@example-file' \
--form 'name=<string>' \
--form 'folderId=<string>' \
--form timeoutMs=123 \
--form pollIntervalMs=123 \
--form extractImages=trueimport requests
url = "https://studyfetchapi.com/api/v1/materials/upload/file-and-process"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"name": "<string>",
"folderId": "<string>",
"timeoutMs": "123",
"pollIntervalMs": "123",
"extractImages": "true"
}
headers = {"x-api-key": "<api-key>"}
response = requests.post(url, data=payload, files=files, 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"
}
]
}Materials
Upload material file and wait for processing to complete
Uploads a file and waits for processing to finish before returning. Useful for synchronous API usage.
POST
/
api
/
v1
/
materials
/
upload
/
file-and-process
Upload material file and wait for processing to complete
const form = new FormData();
form.append('file', '<string>');
form.append('name', '<string>');
form.append('folderId', '<string>');
form.append('timeoutMs', '123');
form.append('pollIntervalMs', '123');
form.append('extractImages', 'true');
const options = {method: 'POST', headers: {'x-api-key': '<api-key>'}};
options.body = form;
fetch('https://studyfetchapi.com/api/v1/materials/upload/file-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/file-and-process \
--header 'Content-Type: multipart/form-data' \
--header 'x-api-key: <api-key>' \
--form file='@example-file' \
--form 'name=<string>' \
--form 'folderId=<string>' \
--form timeoutMs=123 \
--form pollIntervalMs=123 \
--form extractImages=trueimport requests
url = "https://studyfetchapi.com/api/v1/materials/upload/file-and-process"
files = { "file": ("example-file", open("example-file", "rb")) }
payload = {
"name": "<string>",
"folderId": "<string>",
"timeoutMs": "123",
"pollIntervalMs": "123",
"extractImages": "true"
}
headers = {"x-api-key": "<api-key>"}
response = requests.post(url, data=payload, files=files, 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
multipart/form-data
Material name
Folder ID (optional)
Processing timeout in milliseconds (default: 300000 - 5 minutes)
Polling interval in milliseconds (default: 2000)
Whether to extract images from files (true/false, default: true)
Response
Material uploaded and processed successfully
Material ID
Material name
Organization ID
Folder ID
Content type
Available options:
text, pdf, video, audio, image, epub Material content
Show child attributes
Show child attributes
Material status
Available options:
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?