VR Sessions API
VR Sessions API
Track learner progress through VR experiences.
Endpoints
GET /api/vr-sessions- List VR sessions for the current userPOST /api/vr-sessions- Create a new VR session (triggered on download)
GET /api/vr-sessions
List VR sessions for the authenticated user, optionally filtered by package or activity.
Authentication
Requires authentication via session cookie or Bearer token.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
| package_id | uuid | Filter by VR package ID |
| activity_id | uuid | Filter by linked activity ID |
Response
{
"sessions": [
{
"id": "uuid",
"package_id": "uuid",
"activity_id": "uuid",
"tenant_id": "uuid",
"user_id": "uuid",
"status": "in_progress",
"completion_mode": "self_report",
"attempts": 1,
"download_started_at": "2025-01-15T10:00:00Z",
"download_completed_at": "2025-01-15T10:05:00Z",
"first_launch_at": null,
"completed_at": null,
"score": null,
"success_status": null,
"time_spent_seconds": 0,
"self_reported": false,
"created_at": "2025-01-15T10:00:00Z",
"package": {
"id": "uuid",
"title": "Safety Training VR",
"version": "1.0.0",
"target_platforms": ["quest2", "quest3"]
}
}
]
}
Session Status Values
| Status | Description |
|---|---|
| downloading | User initiated download |
| downloaded | APK download complete |
| in_progress | User has launched the experience |
| completed | User has completed the experience |
POST /api/vr-sessions
Create a new VR session. Typically called when a learner initiates a download. If an incomplete session already exists for the same package/activity, it returns the existing session.
Authentication
Requires authentication via session cookie or Bearer token.
Request Body
{
"package_id": "uuid",
"activity_id": "uuid",
"completion_mode": "self_report"
}
| Field | Type | Required | Description |
|---|---|---|---|
| package_id | uuid | Yes | VR package to track |
| activity_id | uuid | No | Linked learning activity |
| completion_mode | string | No | "self_report", "score_entry", or "auto_detect" |
Completion Modes
| Mode | Description |
|---|---|
| self_report | Learner manually marks completion |
| score_entry | Learner enters score upon completion |
| auto_detect | (Future) SDK integration for automatic tracking |
Response (201 Created)
{
"session": {
"id": "uuid",
"package_id": "uuid",
"status": "downloading",
"completion_mode": "self_report",
"attempts": 1,
"download_started_at": "2025-01-15T10:00:00Z",
"package": {
"id": "uuid",
"title": "Safety Training VR",
"version": "1.0.0",
"target_platforms": ["quest2", "quest3"]
}
},
"message": "VR session created"
}
Response (200 OK - Existing Session)
If an incomplete session exists:
{
"session": { ... },
"message": "Existing session returned"
}
Error Responses
| Status | Code | Description |
|---|---|---|
| 400 | VALIDATION_ERROR | Invalid request body |
| 401 | UNAUTHORIZED | Authentication required |
| 404 | PROFILE_NOT_FOUND | User profile not found |
| 404 | PACKAGE_NOT_FOUND | VR package not found |
| 500 | DB_ERROR | Database error |
Example Requests
List Sessions
curl -X GET "https://api.allurelms.com/api/vr-sessions" \
-H "Authorization: Bearer YOUR_TOKEN"
List Sessions for Package
curl -X GET "https://api.allurelms.com/api/vr-sessions?package_id=abc123" \
-H "Authorization: Bearer YOUR_TOKEN"
Create Session
curl -X POST "https://api.allurelms.com/api/vr-sessions" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"package_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"completion_mode": "score_entry"
}'
Related
- Complete Session - Mark session complete
- VR Packages - Manage VR packages
- Activity Types - VR APK activity type