Skip to main content
The Files API handles file uploads, storage, and metadata management for content resources.

Endpoints

List Files

curl -H "Authorization: Token YOUR_TOKEN" \
  "https://studio.learningequality.org/api/file?contentnode__in={node_id}"
Retrieve files with optional filters.
id__in
string
Filter by multiple file IDs (comma-separated)
contentnode__in
string
Filter by content node IDs (comma-separated)
assessment_item__in
string
Filter by assessment item IDs (comma-separated)
id
string
Filter by specific file ID
contentnode
string
Filter by specific content node ID
assessment_item
string
Filter by specific assessment item ID
[
  {
    "id": "file-id-123",
    "checksum": "abc123def456",
    "file_size": 1048576,
    "file_format": "mp4",
    "preset": "high_res_video",
    "language": "en",
    "contentnode": "node-id-456",
    "assessment_item": null,
    "url": "https://storage.example.com/abc123def456.mp4",
    "original_filename": "video.mp4",
    "uploaded_by": "user-id-789",
    "duration": 300
  }
]

Get Upload URL

curl -X POST \
  -H "Authorization: Token YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "size": 1048576,
    "checksum": "abc123def456789012345678901234",
    "name": "video.mp4",
    "file_format": "mp4",
    "preset": "high_res_video",
    "duration": 300
  }' \
  https://studio.learningequality.org/api/file/upload_url
Get a presigned upload URL for uploading a file to storage.
size
number
required
File size in bytes
checksum
string
required
MD5 checksum of the file (32 hexadecimal characters)
name
string
required
Original filename
file_format
string
required
File format/extension (e.g., “mp4”, “pdf”, “jpg”)
preset
string
required
Format preset ID (e.g., “high_res_video”, “video”, “audio”, “document”, “exercise_image”)
duration
number
Duration in seconds (required for audio/video files, must be greater than 0)
{
  "url": "https://storage.example.com/upload?signature=...",
  "might_skip": false,
  "file": {
    "id": "file-id-123",
    "checksum": "abc123def456789012345678901234",
    "file_size": 1048576,
    "file_format": "mp4",
    "preset": "high_res_video",
    "duration": 300,
    "original_filename": "video.mp4",
    "uploaded_by": "user-id-789"
  }
}
The might_skip field indicates whether a file with this checksum already exists in storage. If true, the upload might be skipped if the file is already available.

Update File

curl -X PATCH \
  -H "Authorization: Token YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "contentnode": "node-id-456",
    "language": "es",
    "preset": "video"
  }' \
  https://studio.learningequality.org/api/file/{id}
Update file metadata and associations.
id
string
required
File UUID
contentnode
string
Content node ID to associate with this file
assessment_item
string
Assessment item ID to associate with this file
language
string
Language code for the file
preset
string
Format preset ID
duration
integer
Duration in seconds (for audio/video)
{
  "id": "file-id-123",
  "contentnode": "node-id-456",
  "language": "es",
  "preset": "video",
  "duration": 300
}

Delete File

curl -X DELETE \
  -H "Authorization: Token YOUR_TOKEN" \
  https://studio.learningequality.org/api/file/{id}
Delete a file and its metadata.
id
string
required
File UUID
{
  "status": "success"
}

File Upload Process

1

Request Upload URL

Call the upload_url endpoint with file metadata to get a presigned URL
2

Upload File

Use the presigned URL to upload the file directly to object storage
3

Associate with Content

Update the file to associate it with a content node or assessment item

File Model Fields

id
string
Unique file identifier (UUID)
checksum
string
MD5 checksum of the file content
file_size
integer
File size in bytes
file_format
string
File format/extension (e.g., “mp4”, “pdf”, “jpg”)
preset
string
Format preset ID indicating the file type and purpose
language
string
Language code for the file content
contentnode
string
Associated content node ID
assessment_item
string
Associated assessment item ID
file_on_disk
string
Storage path for the file
url
string
Full URL to access the file
original_filename
string
Original filename when uploaded
uploaded_by
string
User ID who uploaded the file
duration
integer
Duration in seconds (for audio/video files)

File Format Presets

Common preset values:
  • high_res_video - High resolution video files
  • video - Standard video files
  • audio - Audio files
  • document - Document files (PDF, ePub, etc.)
  • exercise - Exercise content
  • exercise_image - Images used in exercises
  • exercise_graphie - Graphie files for exercises
  • channel_thumbnail - Channel thumbnail images
  • topic_thumbnail - Topic thumbnail images
  • video_thumbnail - Video thumbnail images
  • audio_thumbnail - Audio thumbnail images
  • document_thumbnail - Document thumbnail images
  • html5_zip - HTML5 app zip files
  • html5_thumbnail - HTML5 app thumbnails
  • video_subtitle - Video subtitle files
  • video_dependency - Video dependency files
  • html5_dependency - HTML5 dependency files

File Format Validation

  • Audio and video files must include a duration parameter
  • The file_format must be compatible with the selected preset
  • File checksums must be exactly 32 hexadecimal characters
  • Users must have sufficient storage space available

Storage and Checksums

Files are stored in object storage using a checksum-based naming system:
  • Files are deduplicated by checksum
  • Multiple content items can reference the same file
  • Checksums ensure file integrity
  • Files are only stored once even if used multiple times

Build docs developers (and LLMs) love