VR Package Upload API
VR Package Upload API
Upload APK files for VR learning experiences.
Endpoint
POST /api/vr-packages/upload
Overview
Uploads an APK file to storage and creates the package record in a single request. This endpoint handles multipart form data and supports files up to 2GB.
Authentication
Requires authentication. User must be an instructor, admin, or super_admin.
Request
Content-Type: multipart/form-data
| Field | Type | Required | Description |
|---|---|---|---|
| file | File | Yes | APK file (must have .apk extension) |
| title | string | No | Package title (default: "Untitled VR Experience") |
| description | string | No | Package description |
| version | string | No | Package version (default: "1.0.0") |
| target_platforms | string | No | JSON array or comma-separated list of platforms |
Response (201 Created)
{
"package": {
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"tenant_id": "tenant-uuid",
"title": "Safety Training VR",
"description": "Immersive workplace safety training",
"version": "1.0.0",
"storage_path": "tenant-id/vr/1699999999999_safety.apk",
"storage_backend": "supabase",
"file_size_bytes": 52428800,
"target_platforms": ["quest2", "quest3"],
"checksum": "sha256:abc123...",
"status": "active",
"created_at": "2025-01-15T10:00:00Z",
"created_by": "user-uuid"
},
"message": "VR package uploaded successfully"
}
Error Responses
| Status | Code | Description |
|---|---|---|
| 400 | MISSING_FILE | No file provided |
| 400 | INVALID_FILE_TYPE | File must be an APK |
| 401 | UNAUTHORIZED | Authentication required |
| 403 | FORBIDDEN | Only instructors and admins can upload |
| 404 | PROFILE_NOT_FOUND | User profile not found |
| 413 | FILE_TOO_LARGE | File exceeds 2GB limit |
| 500 | BUCKET_NOT_FOUND | Storage bucket not configured |
| 500 | UPLOAD_FAILED | Failed to upload file |
| 500 | DB_ERROR | Failed to create package record |
Configuration
- Max File Size: 2GB
- Max Duration: 5 minutes (for large uploads)
- Storage Bucket:
vr-packages - Allowed Extensions:
.apk
Example Request
curl -X POST "https://api.allurelms.com/api/vr-packages/upload" \
-H "Authorization: Bearer YOUR_TOKEN" \
-F "file=@safety-training.apk" \
-F "title=Safety Training VR" \
-F "description=Immersive workplace safety training" \
-F "version=1.0.0" \
-F 'target_platforms=["quest2", "quest3"]'
Security Notes
- File checksum (SHA256) is computed server-side
- Files are stored with sanitized filenames
- Storage path includes tenant isolation
- If database insert fails, uploaded file is automatically cleaned up
Related
- VR Packages - List and manage packages
- VR Sessions - Track learner progress