Skip to content
StudyFetch API

Materials

Get presigned URL for direct S3 upload

OpenAPI specification
POST/api/v1/materials/upload/presigned-url

Authentication

x-api-key

Request

curl --globoff --request POST \
  --url 'https://api.example.com/api/v1/materials/upload/presigned-url' \
  --header 'x-api-key: <API_KEY>' \
  --header 'Content-Type: application/json' \
  --data-raw '{
  "filename": "document.pdf",
  "contentType": "application/pdf",
  "name": "Chapter 1 Notes"
}'

Replace credential and <field> placeholders with your own values. URL placeholders appear as %3Cfield%3E. Review the example values before sending your request.

Replace https://api.example.com with the API server URL.

Use the sample JSON body as your starting point, and enter values that match the endpoint's schema.

Request body schema or example

{
  "type": "object",
  "properties": {
    "filename": {
      "type": "string",
      "example": "document.pdf",
      "description": "Filename to upload"
    },
    "contentType": {
      "type": "string",
      "example": "application/pdf",
      "description": "MIME type of the file"
    },
    "name": {
      "type": "string",
      "example": "Chapter 1 Notes",
      "description": "Display name for the material"
    },
    "folderId": {
      "type": "string",
      "description": "Folder ID to place the material in"
    },
    "extractImages": {
      "type": "boolean",
      "description": "Whether to extract images from files",
      "example": true,
      "default": true
    },
    "references": {
      "description": "References that this material cites",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "example": "Understanding Photosynthesis",
            "description": "Reference title"
          },
          "url": {
            "type": "string",
            "example": "https://example.com/article",
            "description": "Reference URL"
          }
        },
        "required": [
          "title"
        ]
      }
    }
  },
  "required": [
    "filename",
    "contentType",
    "name"
  ]
}

Responses

200Presigned URL generated successfully
{
  "type": "object",
  "properties": {
    "uploadUrl": {
      "type": "string",
      "description": "Presigned URL for direct S3 upload"
    },
    "s3Key": {
      "type": "string",
      "description": "S3 key for the file"
    },
    "materialId": {
      "type": "string",
      "description": "Material ID to use for completion"
    }
  },
  "required": [
    "uploadUrl",
    "s3Key",
    "materialId"
  ]
}
400Invalid parameters
403Insufficient permissions