TXTRAX LRS
Community

Data API

The data API lets an authorized client query stored xAPI data. Authentication, value/field types, the shared query object and error responses are common to all TRAX APIs.

Contents: Statements · Activities · Agents · Activity Profiles · Agent Profiles · States · Verbs · Activity Types · Activity IDs · Agent IDs · Document IDs

Getting access

  • Enable the API. This API is gated by the DATA_API feature toggle (Settings → App). When off, the machine-token API is unavailable (the console UI is unaffected).
  • Client permission. The calling client must have the data/all permission enabled (Clients → edit → Permissions). Authentication is HTTP Basic — see Authentication.
  • Base path. Copy your client's store_endpoint (…/stores/{store}) from the Clients page (the ⓘ info button) and append the entity paths below.

Request

GET /trax/api/gateway/clients/{client}/stores/{store}/{entity}

Path segments:

  • {client} — your API client id.
  • {store} — the id of the store to read from.
  • {entity} — the data entity to query, one of the below sections.

Pass the query object as query-string parameters, JSON-encoding filters and options. filters / options accept only the entity's whitelisted keys (listed per view below); any other key is rejected (400).

Response

On success, 200 with a JSON body { "data": [ /* array of records */ ] }.

Error responses follow the shared model. Pagination follows the query object — sortable / cursor columns are the entity's Response fields.


Statements

Individual xAPI statements (actor–verb–object, plus result, context and timestamp).

GET /trax/api/gateway/clients/{client}/stores/{store}/statements

Filters

Name Type Description
agent Agent IFI The agent as actor or object (narrow with agent_location). Example: {"mbox":"mailto:jane@example.com"}
verb IRI The statement's verb. Example: http://adlnet.gov/expapi/verbs/completed
activity IRI The object activity (or anywhere related with activity_location=everywhere). Example: http://example.com/courses/intro
since ISO-8601 date-time Stored after (exclusive).
until ISO-8601 date-time Stored at or before (inclusive).
type IRI The object's activity-type. Example: http://adlnet.gov/expapi/activities/course
profile IRI Statements related to this profile activity.
pseudonymized boolean Keep only pseudonymized / non-pseudonymized actors. Example: true
voided boolean Include / exclude voided statements. Example: false

Options

Name Type Description
rearrange boolean Rearrange/normalize the result set. (Semantics to confirm on review.) Example: true
agent_location enum One of actor, object, everywhere. Narrows agent (default: actor or object).
activity_location enum One of object, everywhere. Narrows activity (default: object).

Example response

{
  "data": [
    {
      "id": "0066af05-447b-4752-a4a9-b9d8c09133e9",
      "raw": { "…": "the full xAPI statement" },
      "voided": false,
      "voiding": false,
      "validated": true,
      "valid": true,
      "pseudonymized": false,
      "actor_id": "e3b0c44298fc1c149afbf4c8996fb924",
      "verb_id": "5f4dcc3b5aa765d61d8327deb882cf99",
      "object_id": "9e107d9d372bb6826bd81d3542a419d6",
      "type_id": "0cc175b9c0f1b6a831c399e269772661",
      "agent_ids": ["e3b0c44298fc1c149afbf4c8996fb924"],
      "activity_ids": ["9e107d9d372bb6826bd81d3542a419d6"],
      "registration": "67c13032-0b73-3244-b005-1e9602aa6ab7",
      "statement_ref": null,
      "store": "default",
      "client": "app",
      "timestamp": "2024-06-01T09:00:00.000000Z",
      "stored": "2024-06-01T09:00:00.363058Z"
    }
  ]
}

Response fields

Field Type Description
id UUID Statement UUID.
raw object The full xAPI statement as received.
voided boolean The statement has been voided.
voiding boolean This statement is itself a voiding statement.
validated boolean Validation has run.
valid boolean The statement passed validation.
pseudonymized boolean The actor has been pseudonymized.
actor_id Hashed ID Id of the actor agent.
verb_id Hashed ID Id of the verb.
object_id Hashed ID Id of the object (agent or activity).
type_id Hashed ID Id of the object's activity-type.
agent_ids array of Hashed ID Ids of all agents related to the statement.
activity_ids array of Hashed ID Ids of all activities related.
registration UUID Registration.
statement_ref UUID | null Referenced statement id (statement references).
store string Store id.
client string The client that recorded the statement.
timestamp ISO-8601 date-time The statement's own timestamp.
stored ISO-8601 date-time Server storage timestamp.

Activities

The catalogue of activities (courses / content) seen in statements.

GET /trax/api/gateway/clients/{client}/stores/{store}/activities

Filters

Name Type Description
activityId IRI The activity identified by this IRI. Example: http://example.com/courses/intro
type IRI Activities of this activity-type. Example: http://adlnet.gov/expapi/activities/course
is_category boolean Activities used as a context category. Example: true
is_profile boolean Activities that are profiles. Example: true

Options

Name Type Description
rearrange boolean Rearrange/normalize the result set. (Semantics to confirm on review.) Example: true

Example response

{
  "data": [
    {
      "id": "9e107d9d372bb6826bd81d3542a419d6",
      "iri": "http://example.com/courses/intro",
      "definition": { "name": { "en": "Introduction" }, "type": "http://adlnet.gov/expapi/activities/course" },
      "type_id": "0cc175b9c0f1b6a831c399e269772661",
      "is_category": 0,
      "is_profile": 0,
      "store": "default",
      "stored": "2024-06-01T09:00:09.000000Z",
      "updated": "2024-06-01T09:00:50.000000Z"
    }
  ]
}

Response fields

Field Type Description
id Hashed ID Id of the activity IRI.
iri IRI The activity IRI.
definition object The xAPI Activity Definition (name, description, type, …).
type_id Hashed ID Id of the activity-type IRI.
is_category integer (0/1) The activity is used as a context category.
is_profile integer (0/1) The activity is a profile.
store string Store id.
stored ISO-8601 date-time First-seen timestamp.
updated ISO-8601 date-time Last-updated timestamp.

Agents

The catalogue of agents and groups (actors) seen in statements.

GET /trax/api/gateway/clients/{client}/stores/{store}/agents

Filters

Name Type Description
agent Agent IFI The agent identified by this IFI (narrow with the location option). Example: {"mbox":"mailto:jane@example.com"}
type enum One of all, agents, groups, groups_with_members. Restrict to agents, groups, or non-empty groups.
sid_type enum One of mbox, mbox_sha1sum, openid, account. Restrict to actors identified by this IFI type.

Options

Name Type Description
location enum One of agent, group, member, all. Where to match the agent value: as the agent itself, as a group, among members, or all.
join_members boolean Include each group's members in the result. Example: true

Example response

{
  "data": [
    {
      "id": "012a011de79e7833638f0b4c9ed7c611",
      "sid_field_1": "mailto:jane@example.com",
      "sid_field_2": null,
      "sid_type": "mbox",
      "name": "Jane Doe",
      "is_group": 0,
      "members": [],
      "members_count": 0,
      "pseudonymized": false,
      "person_id": "b4ef6bfd-58b6-4d2a-8b66-afeefd48b6d2",
      "store": "default",
      "stored": "2024-06-01T09:00:09.827283Z",
      "updated": "2024-06-01T09:00:50.221766Z"
    }
  ]
}

Response fields

Field Type Description
id Hashed ID Id of the agent IFI.
sid_field_1 string Primary IFI value (the mbox, openid, or account name).
sid_field_2 string | null Secondary IFI value (e.g. account homePage), or null.
sid_type string IFI type (mbox/mbox_sha1sum/openid/account).
name string Agent or group name.
is_group integer (0/1) The actor is a group.
members array of Hashed ID Hashed ids of the group's members.
members_count integer Number of members.
pseudonymized boolean The agent is pseudonymized.
person_id UUID Owning person id.
store string Store id.
stored ISO-8601 date-time First-seen timestamp.
updated ISO-8601 date-time Last-updated timestamp.

Activity Profiles

Activity Profile documents (xAPI Activity Profile resource).

GET /trax/api/gateway/clients/{client}/stores/{store}/activity-profiles

Filters

Name Type Description
profileId text The profile document key. Example: bookmark
activityId IRI The owning activity. Example: http://example.com/courses/intro
since ISO-8601 date-time Stored after (exclusive).
type MIME type The document content-type. Example: application/json

Example response

{
  "data": [
    {
      "id": "00b2b8528e3ba4c591c32dcd4170237b",
      "activity_id": "40537a0b644d0b8171b45c86312d5c03",
      "activity_iri": "http://example.com/courses/intro",
      "profile_id": "summary",
      "content": "…",
      "content_type": "application/json",
      "store": "default",
      "stored": "2024-06-01T09:00:49.734570Z",
      "updated": "2024-06-01T09:00:49.734570Z"
    }
  ]
}

Response fields

Field Type Description
id Hashed ID Document row id.
activity_id Hashed ID Id of the owning activity.
activity_iri IRI The owning activity IRI.
profile_id string The profile document key.
content string The document content.
content_type MIME type The document content-type.
store string Store id.
stored ISO-8601 date-time First-seen timestamp.
updated ISO-8601 date-time Last-updated timestamp.

Agent Profiles

Agent Profile documents (xAPI Agent Profile resource).

GET /trax/api/gateway/clients/{client}/stores/{store}/agent-profiles

Filters

Name Type Description
profileId text The profile document key. Example: preferences
agent Agent IFI The owning agent. Example: {"mbox":"mailto:jane@example.com"}
since ISO-8601 date-time Stored after (exclusive).
type MIME type The document content-type. Example: application/json

Example response

{
  "data": [
    {
      "id": "a1b2c3d4e5f60718293a4b5c6d7e8f90",
      "agent_id": "f41be1b41efe24d2896f94f946de38e2",
      "agent_sid": "mailto:jane@example.com",
      "profile_id": "preferences",
      "content": "…",
      "content_type": "application/json",
      "store": "default",
      "stored": "2024-06-01T09:00:49.734570Z",
      "updated": "2024-06-01T09:00:49.734570Z"
    }
  ]
}

Response fields

Field Type Description
id Hashed ID Document row id.
agent_id Hashed ID Id of the owning agent.
agent_sid string The owning agent's IFI (canonical string).
profile_id string The profile document key.
content string The document content.
content_type MIME type The document content-type.
store string Store id.
stored ISO-8601 date-time First-seen timestamp.
updated ISO-8601 date-time Last-updated timestamp.

States

State documents (xAPI State resource).

GET /trax/api/gateway/clients/{client}/stores/{store}/states

Filters

Name Type Description
stateId text The state document key. Example: progress
activityId IRI The owning activity. Example: http://example.com/courses/intro
agent Agent IFI The owning agent. Example: {"mbox":"mailto:jane@example.com"}
registration UUID The registration. Example: d3f4a1b2-1c2d-4e5f-8a9b-0c1d2e3f4a5b
since ISO-8601 date-time Stored after (exclusive).
type MIME type The document content-type. Example: application/json

Example response

{
  "data": [
    {
      "id": "00b111fe1ed8d8f76a042cdb9d7647ea",
      "activity_id": "a61c04aec8699117ae724bb3607fea2f",
      "activity_iri": "http://example.com/courses/intro",
      "agent_id": "f41be1b41efe24d2896f94f946de38e2",
      "agent_sid": "mailto:jane@example.com",
      "state_id": "progress",
      "registration": "a597aa74-3dd1-4442-9ab9-4b376df7e03d",
      "content": "…",
      "content_type": "application/json",
      "store": "default",
      "stored": "2024-06-01T09:00:49.629965Z",
      "updated": "2024-06-01T09:00:49.629965Z"
    }
  ]
}

Response fields

Field Type Description
id Hashed ID Document row id.
activity_id Hashed ID Id of the owning activity.
activity_iri IRI The owning activity IRI.
agent_id Hashed ID Id of the owning agent.
agent_sid string The owning agent's IFI (canonical string).
state_id string The state document key.
registration UUID | null The registration UUID, if any.
content string The document content.
content_type MIME type The document content-type.
store string Store id.
stored ISO-8601 date-time First-seen timestamp.
updated ISO-8601 date-time Last-updated timestamp.

Verbs

The catalogue of verb IRIs seen in statements.

GET /trax/api/gateway/clients/{client}/stores/{store}/verbs

Filters

Name Type Description
in_iri text (substring) A substring of the verb IRI. Example: completed

Example response

{
  "data": [
    {
      "id": "090a9e4b1fb4a1bc05302c32156c4390",
      "iri": "http://adlnet.gov/expapi/verbs/completed",
      "store": "default",
      "created_at": "2024-06-01T09:00:00.000000Z",
      "updated_at": "2024-06-01T09:00:00.000000Z"
    }
  ]
}

Response fields

Field Type Description
id Hashed ID Id of the verb IRI.
iri IRI The verb IRI.
store string Store id.
created_at ISO-8601 date-time Row creation timestamp.
updated_at ISO-8601 date-time Row update timestamp.

Activity Types

The catalogue of activity-type IRIs seen in statements.

GET /trax/api/gateway/clients/{client}/stores/{store}/activity-types

Filters

Name Type Description
in_iri text (substring) A substring of the activity-type IRI. Example: course

Example response

{
  "data": [
    {
      "id": "0cc175b9c0f1b6a831c399e269772661",
      "iri": "http://adlnet.gov/expapi/activities/course",
      "store": "default",
      "created_at": "2024-06-01T09:00:00.000000Z",
      "updated_at": "2024-06-01T09:00:00.000000Z"
    }
  ]
}

Response fields

Field Type Description
id Hashed ID Id of the activity-type IRI.
iri IRI The activity-type IRI.
store string Store id.
created_at ISO-8601 date-time Row creation timestamp.
updated_at ISO-8601 date-time Row update timestamp.

Activity IDs

The activity identifier index (lookup/autocomplete read-model of activities).

GET /trax/api/gateway/clients/{client}/stores/{store}/activity-ids

Filters

Name Type Description
in_iri text (substring) A substring of the activity IRI. Example: courses/intro
in_name text (substring) A substring of the (all-languages) activity name. Example: Introduction
is_category boolean Only context-category activities. Example: true
is_profile boolean Only profile activities. Example: true

Example response

{
  "data": [
    {
      "id": "00104dea9712eaca818562936eb42fc4",
      "iri": "http://example.com/courses/intro",
      "is_category": 0,
      "is_profile": 0,
      "store": "default",
      "created_at": "2024-06-01T09:00:02.000000Z",
      "updated_at": "2024-06-01T09:00:02.000000Z",
      "name": "Introduction",
      "type_id": "9b33c0c529bc82ee3ec18eb1d09739c1"
    }
  ]
}

Response fields

Field Type Description
id Hashed ID Id of the activity IRI.
iri IRI The activity IRI.
is_category integer (0/1) The activity is used as a context category.
is_profile integer (0/1) The activity is a profile.
store string Store id.
created_at ISO-8601 date-time Row creation timestamp.
updated_at ISO-8601 date-time Row update timestamp.
name string Flattened, all-languages activity name.
type_id Hashed ID Id of the activity-type IRI.

Agent IDs

The agent identifier index (lookup/autocomplete read-model of agents).

GET /trax/api/gateway/clients/{client}/stores/{store}/agent-ids

Filters

Name Type Description
sid_type enum One of mbox, mbox_sha1sum, openid, account. Restrict to this IFI type.
in_sid_field_1 text (substring) A substring of the primary IFI field. Example: jane@example.com
in_sid_field_2 text (substring) A substring of the secondary IFI field (e.g. account homePage). Example: example.com
in_name text (substring) A substring of the agent name. Example: Jane

Example response

{
  "data": [
    {
      "id": "012a011de79e7833638f0b4c9ed7c611",
      "sid_field_1": "mailto:jane@example.com",
      "sid_field_2": null,
      "sid_type": "mbox",
      "store": "default",
      "created_at": "2024-06-01T09:00:02.000000Z",
      "updated_at": "2024-06-01T09:00:02.000000Z",
      "name": "Jane Doe",
      "is_group": 0,
      "members_count": 0
    }
  ]
}

Response fields

Field Type Description
id Hashed ID Id of the agent IFI.
sid_field_1 string Primary IFI value.
sid_field_2 string | null Secondary IFI value (e.g. account homePage), or null.
sid_type string IFI type (mbox/mbox_sha1sum/openid/account).
store string Store id.
created_at ISO-8601 date-time Row creation timestamp.
updated_at ISO-8601 date-time Row update timestamp.
name string Agent or group name.
is_group integer (0/1) The actor is a group.
members_count integer Number of members.

Document IDs

The document identifier index across the State / Activity-Profile / Agent-Profile document resources.

GET /trax/api/gateway/clients/{client}/stores/{store}/document-ids

Filters

Name Type Description
in_name text (substring) A substring of the document key/name. Example: progress
in_type text (substring) A substring of the content-type (MIME). Example: json
mime_type MIME type An exact content-type. Example: application/json
doc_type enum One of activity-profile, agent-profile, state. Which document resource the id belongs to.

Example response

{
  "data": [
    {
      "id": "621f6bb533967d92c373e84ef588f65d",
      "name": "progress",
      "doc_type": "state",
      "mime_type": "application/json",
      "store": "default",
      "created_at": "2024-06-01T09:00:03.000000Z",
      "updated_at": "2024-06-01T09:00:03.000000Z"
    }
  ]
}

Response fields

Field Type Description
id Hashed ID Document id.
name string The document key/name.
doc_type string activity-profile, agent-profile, or state.
mime_type MIME type The document content-type.
store string Store id.
created_at ISO-8601 date-time Row creation timestamp.
updated_at ISO-8601 date-time Row update timestamp.