Upload Document
Upload a document file to an enrollment. Supports PDF and image files (PNG, JPG, JPEG).Path Parameters
Unique identifier of the enrollment
Form Data Parameters
The document file to upload. Supported formats:
- PDF (
.pdf) - PNG (
.png) - JPEG (
.jpg,.jpeg)
Type of document being uploaded. Examples:
birth_certificate- Birth certificateid_card- Identity cardhealth_certificate- Health/vaccination certificateprevious_grades- Academic records from previous schoolphoto- Student photo- Custom types are supported
Version identifier for the document (e.g., “1”, “2”, “2024”)
Response
Success message
The uploaded document object
The enrollment ID (as string)
Upload Examples
Get Document Content
Retrieve the actual file content of a document. This is an authenticated proxy to the file storage.Path Parameters
Unique identifier of the enrollment
Query Parameters
Type of document to retrieve (e.g., “birth_certificate”, “id_card”)
How to serve the file:
inline- Display in browser (default)download- Force download with Content-Disposition header
Response
Returns the raw file content with appropriate headers:- Content-Type: Based on file type (e.g.,
application/pdf,image/jpeg) - Content-Disposition:
inlineorattachmentbased on mode parameter - Cache-Control:
no-storeto prevent caching of sensitive documents - X-Content-Type-Options:
nosnifffor security - Content-Security-Policy:
sandboxfor additional security
Retrieval Examples
Document Upload Behavior
- If a document of the same
document_typealready exists for the enrollment, it will be replaced (updated) - The old file will be overwritten with the new upload
- The
uploaded_attimestamp will be updated to the current time - The
statuswill be reset to"uploaded" - This allows for document corrections or updates without creating duplicates
File Validation
- Allowed file types: PDF, PNG, JPG, JPEG
- Maximum file size: 10 MB
- PDF validation: Files with
.pdfextension are validated to have correct PDF magic bytes - File names are sanitized and normalized for safe storage
Storage Structure
Documents are stored with the following path structure:- Organized storage by school and student
- Easy identification of document ownership
- Automatic file replacement for same document types
Permissions Required
Upload Documents
write:enrollmentwrite:all
Retrieve Documents
read:enrollmentread:all