Jan 02, 2021

Getting started with xAPI (Tin Can API)

xAPI (also called Tin Can API) is a specification for tracking learning experiences. Here’s a starting point for writing and understanding xAPI statements.

Writing xAPI statements

An xAPI statement has three required parts: actor, verb, and object.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
{
"actor": {
"name": "Chetan Sachdev",
"mbox": "mailto:chetan@example.com"
},
"verb": {
"id": "http://adlnet.gov/expapi/verbs/completed",
"display": { "en-US": "completed" }
},
"object": {
"id": "http://example.com/courses/intro-to-xapi",
"definition": {
"name": { "en-US": "Intro to xAPI" }
}
}
}

Key reading

Common confusion: JSON vs JavaScript Object

xAPI statements are JSON, not JavaScript objects. The syntax looks similar, but there are important differences (all keys must be quoted strings, no trailing commas, no undefined):

Community resources