Skip to main content
POST
/
api
/
v1
/
materials
/
upload
/
presigned-url
Get presigned URL for direct S3 upload
const url = 'https://studyfetchapi.com/api/v1/materials/upload/presigned-url';
const options = {
  method: 'POST',
  headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
  body: '{"filename":"document.pdf","contentType":"application/pdf","name":"Chapter 1 Notes","folderId":"<string>","extractImages":true,"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);
}
{
  "uploadUrl": "<string>",
  "s3Key": "<string>",
  "materialId": "<string>"
}

Authorizations

x-api-key
string
header
required

API Key for authentication

Body

application/json
filename
string
required

Filename to upload

Example:

"document.pdf"

contentType
string
required

MIME type of the file

Example:

"application/pdf"

name
string
required

Display name for the material

Example:

"Chapter 1 Notes"

folderId
string

Folder ID to place the material in

extractImages
boolean
default:true

Whether to extract images from files

Example:

true

references
object[]

References that this material cites

Response

Presigned URL generated successfully

uploadUrl
string
required

Presigned URL for direct S3 upload

s3Key
string
required

S3 key for the file

materialId
string
required

Material ID to use for completion

I