API REFERENCE
Activities
/xapi/activities/xapi/activities/profileThe Activities resource retrieves activity definitions inferred from stored statements. Activity Profiles are document stores scoped to an activity (not a specific agent) — use them for game-wide configuration, metadata, or answer keys that apply to all learners.
GET /xapi/activities — Activity Definition
Returns the activity definition from the most recently stored statement that references this activity ID. The LRS merges definitions across statements — the most recent non-null value for each language key wins.
http
GET /xapi/activities?activityId=https://your-game.com/levels/1
Authorization: Basic <base64(key:secret)>
X-Experience-API-Version: 1.0.3
// 200 OK
{
"objectType": "Activity",
"id": "https://your-game.com/levels/1",
"definition": {
"name": { "en-US": "Level 1: Introduction" },
"description": { "en-US": "First level of the algebra game" },
"type": "http://adlnet.gov/expapi/activities/lesson",
"extensions": {
"https://your-game.com/ext/difficulty": "easy",
"https://your-game.com/ext/max-stars": 3
}
}
}
// 404 Not Found — no statements reference this activityGET /xapi/activities/profile — Get Profile
Retrieve a profile document by profileId, or list all profile IDs by omitting it. Unlike state documents, activity profiles are not tied to a specific agent.
http
// Get a specific profile document
GET /xapi/activities/profile?activityId=https://your-game.com/quiz-1&profileId=answer-key
Authorization: Basic <base64(key:secret)>
X-Experience-API-Version: 1.0.3
// 200 OK
{
"q1": "B",
"q2": "D",
"q3": "A",
"passMark": 70
}
// List all profile IDs for this activity
GET /xapi/activities/profile?activityId=https://your-game.com/quiz-1
// 200 OK
["answer-key", "config", "metadata"]PUT /xapi/activities/profile — Save Profile
http
PUT /xapi/activities/profile?activityId=https://your-game.com/quiz-1&profileId=config
Authorization: Basic <base64(key:secret)>
Content-Type: application/json
X-Experience-API-Version: 1.0.3
{
"timeLimit": 600,
"shuffleQuestions": true,
"showHints": false,
"passMark": 70
}
// Response: 204 No ContentDELETE /xapi/activities/profile — Delete Profile
http
// Delete a specific profile
DELETE /xapi/activities/profile?activityId=https://your-game.com/quiz-1&profileId=config
// Delete all profiles for this activity
DELETE /xapi/activities/profile?activityId=https://your-game.com/quiz-1
// Response: 204 No ContentState vs Activity Profile
State Documents
- Scoped to agent + activity
- Different per learner
- E.g. saved progress, high scores
Activity Profiles
- Scoped to activity only
- Shared across all learners
- E.g. answer keys, configuration