> ## Documentation Index
> Fetch the complete documentation index at: https://www.studyfetch.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Materials API Overview

> Upload, manage, and organize study materials in your application

## Overview

The Materials API allows you to upload, manage, and organize various types of study materials including documents, videos, audio files, and more. Materials can be organized into folders and serve as the foundation for generating study components like flashcards, quizzes, and practice tests.

## Supported File Types

The Materials API supports the following content types:

* **Documents**: PDF, EPUB, TXT
* **Videos**: MP4, AVI, MOV, MKV
* **Audio**: MP3, WAV, M4A
* **Images**: JPG, PNG, GIF
* **Text**: Plain text content
* **URLs**: Web content fetching

## Material Object

```json theme={null}
{
  "_id": "mat_123abc",
  "name": "Biology Chapter 1",
  "organizationId": "org_456def",
  "folderId": "folder_789ghi",
  "contentType": "pdf",
  "content": {
    "s3Key": "materials/org_456def/file.pdf",
    "s3Url": "https://s3.amazonaws.com/...",
    "filename": "biology-ch1.pdf",
    "fileSize": 2048576,
    "mimeType": "application/pdf"
  },
  "metadata": {
    "title": "Biology Chapter 1",
    "wordCount": 5420,
    "pageCount": 12,
    "embeddingCount": 45,
    "chunks": 15,
    "extractedText": "...",
    "images": [
      {
        "id": "img_001",
        "s3Key": "materials/org_456def/images/img_001.jpg",
        "s3Url": "https://s3.amazonaws.com/...",
        "description": "Cell structure diagram"
      }
    ]
  },
  "references": [
    {
      "title": "Biology Textbook - 5th Edition",
      "url": "https://example.com/biology-textbook"
    }
  ],
  "status": "active",
  "createdAt": "2024-01-15T10:00:00Z",
  "updatedAt": "2024-01-15T10:05:00Z"
}
```

## Status Values

Materials go through different status values during their lifecycle:

* `pending_upload` - Waiting for file upload (S3 presigned URL)
* `processing` - Being processed (OCR, transcription, embeddings)
* `active` - Ready to use
* `error` - Processing failed
* `deleted` - Soft deleted

<Warning>
  **Important**: Materials must have `status: 'active'` before they can be used in components or for grading. Attempting to use materials with `status: 'processing'` will result in errors. Always implement polling to check material status after upload.
</Warning>

## Next Steps

<CardGroup cols={2}>
  <Card title="Upload Files" icon="upload" href="/api-docs/materials/uploading-files">
    Learn how to upload different file types
  </Card>

  <Card title="Manage Materials" icon="folder-gear" href="/api-docs/materials/managing-materials">
    Move, rename, and delete materials
  </Card>

  <Card title="Work with Folders" icon="folder-tree" href="/api-docs/materials/folders">
    Organize materials into folders
  </Card>

  <Card title="Search Materials" icon="magnifying-glass" href="/api-docs/materials/search">
    Search materials using RAG
  </Card>
</CardGroup>
