---
title: "Xapi Js"
description: "xAPI.js is the library to reach for when you are writing xAPI code in TypeScript and want the compiler to catch malformed statements before an LRS does. It covers the Statement, State, Agent Profile and Activity Profile resources, ships helpers for the awkward parts — ISO 8601 duration calculation, parsing TinCan and xAPI launch parameters out of the query string, basic-auth encoding — and lets you swap the HTTP layer between fetch and axios."
canonical_url: "https://scorm-tools.com/tools/xapi-js"
last_updated: "2026-10-31T10:22:03.753Z"
---

xAPI.js is the library to reach for when you are writing xAPI code in TypeScript and want the compiler to catch malformed statements before an LRS does. It covers the Statement, State, Agent Profile and Activity Profile resources, ships helpers for the awkward parts — ISO 8601 duration calculation, parsing TinCan and xAPI launch parameters out of the query string, basic-auth encoding — and lets you swap the HTTP layer between `fetch` and axios.

The typing is the point of difference. Most xAPI wrappers hand you an object and hope; here the statement shape, the verb constants and the resource paths are all declared, so the common failure mode of a statement rejected for a missing or mis-nested field becomes a build error.

It stops at xAPI 1.0.x. The version union in the source runs 1.0.0 to 1.0.3 and nothing wider, and cmi5 is a separate package under the same organisation rather than part of this one. Neither is a defect — the scope is deliberate — but it does mean this is a Statement API client, not a cmi5 runtime.

Fifty-one stars is modest for how widely it is quietly used; releases are irregular, with 3.0.0 in September 2024 and 3.0.3 in April 2026. That cadence suits a library whose target specification has not moved. Safe to depend on.
