VR Sessions API

VR Sessions API

Track learner progress through VR experiences.

Endpoints

  • GET /api/vr-sessions - List VR sessions for the current user
  • POST /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

ParameterTypeDescription
package_iduuidFilter by VR package ID
activity_iduuidFilter 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

StatusDescription
downloadingUser initiated download
downloadedAPK download complete
in_progressUser has launched the experience
completedUser 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"
}
FieldTypeRequiredDescription
package_iduuidYesVR package to track
activity_iduuidNoLinked learning activity
completion_modestringNo"self_report", "score_entry", or "auto_detect"

Completion Modes

ModeDescription
self_reportLearner manually marks completion
score_entryLearner 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

StatusCodeDescription
400VALIDATION_ERRORInvalid request body
401UNAUTHORIZEDAuthentication required
404PROFILE_NOT_FOUNDUser profile not found
404PACKAGE_NOT_FOUNDVR package not found
500DB_ERRORDatabase 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