Docs API reference
Learners & people
Your users, their courses and their progress, by your own ids.
For an application with its own users. Everything under /learners is addressed by your own id for the person and a course's address, so you never handle our ids: create or update a user (with their organization and role), get all their courses, give or take away a course, see their progress and certificates, and start them learning. See Common tasks. The rest of this group finds people by our ids and suspends or reactivates them.
14 endpoints · base path /api/v1
Get a learner
AccessAdmin, or an API key with the read or write scope.
Looks a person up by your id for them. Returns their details, status and, if they belong to one of your customers, the organization, their role and access.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| externalRefrequired | path | string | matches [A-Za-z0-9._:@+~-]{1,200} |
Responses
Example response
{
"email": "maya.chen@example.com",
"externalRef": "order-5001",
"familyName": "Chen",
"givenName": "Maya",
"id": "37386ae0-0ea5-44e0-a02e-161f807af560",
"organization": {
"access": "MEMBER",
"name": "Acme Company",
"organization": "string",
"role": "string"
},
"status": "ACTIVE"
}Errors
| Status | When |
|---|---|
| 401 | Missing, invalid or expired credentials. |
| 403 | Your credential is valid but isn't allowed to do this. |
| 404 | No learner has that id. |
Errors use RFC 9457 problem details.
EXTERNAL_REF=order-5001
curl -X GET "$LMS_URL/api/v1/learners/$EXTERNAL_REF" \
-H "X-API-Key: $LMS_KEY"const LMS_URL = process.env.LMS_URL
const LMS_KEY = process.env.LMS_KEY
const externalRef = "order-5001"
const res = await fetch(`${LMS_URL}/api/v1/learners/${externalRef}`, {
method: 'GET',
headers: { "X-API-Key": LMS_KEY },
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)
const data = await res.json()const LMS_URL = process.env.LMS_URL!
const LMS_KEY = process.env.LMS_KEY!
const externalRef = "order-5001"
const res = await fetch(`${LMS_URL}/api/v1/learners/${externalRef}`, {
method: 'GET',
headers: { "X-API-Key": LMS_KEY },
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)
const data: unknown = await res.json()import os
import requests
LMS_URL = os.environ["LMS_URL"]
HEADERS = {"X-API-Key": os.environ["LMS_KEY"]}
external_ref = "order-5001"
res = requests.get(f"{LMS_URL}/api/v1/learners/{external_ref}", headers=HEADERS, timeout=10)
res.raise_for_status()
data = res.json()import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Request {
public static void main(String[] args) throws Exception {
String lmsUrl = System.getenv("LMS_URL");
String lmsKey = System.getenv("LMS_KEY");
String externalRef = "order-5001";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/learners/" + externalRef))
.header("X-API-Key", lmsKey)
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() >= 300) throw new IllegalStateException(response.statusCode() + " " + response.body());
System.out.println(response.body());
}
}require "net/http"
require "json"
lms_url = ENV.fetch("LMS_URL")
external_ref = "order-5001"
uri = URI("#{lms_url}/api/v1/learners/#{external_ref}")
request = Net::HTTP::Get.new(uri, "X-API-Key" => ENV.fetch("LMS_KEY"))
response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(request) }
raise "#{response.code} #{response.body}" unless response.is_a?(Net::HTTPSuccess)
data = JSON.parse(response.body)<?php
$lmsUrl = getenv('LMS_URL');
$externalRef = "order-5001";
$ch = curl_init("$lmsUrl/api/v1/learners/{$externalRef}");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-Key: ' . getenv('LMS_KEY')],
]);
$response = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 300) {
throw new RuntimeException($response);
}
$data = json_decode($response, true);package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
externalRef := "order-5001"
req, _ := http.NewRequest("GET", os.Getenv("LMS_URL") + "/api/v1/learners/" + externalRef, nil)
req.Header.Set("X-API-Key", os.Getenv("LMS_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, _ := io.ReadAll(res.Body)
if res.StatusCode >= 300 {
panic(fmt.Sprintf("%d %s", res.StatusCode, data))
}
fmt.Println(string(data))
}Create or update a learner
AccessAdmin, or an API key with the write scope.
Records one of your users in the LMS. externalRef is the id of that person in your system (letters, digits and ._:@+~-, up to 200 characters). The first call creates them (201); later calls update them in place (200) and return the same id, so it is safe to repeat whenever their details change.
Name and email are required. To place them in one of your customers, add organization (the customer's own reference, set when you add the customer in the admin or with externalRef on POST /organizations), a role (a job role's key, set up in the admin) and an access level (MEMBER, the default, or MANAGER). The role's courses are given to them automatically, limited to what their company has bought. Omit role or access on a later call to leave them as they are. Add courses to give them courses directly, by address.
Learners made this way have no password. You act for them by asking for a token with start a learner. An existing account with the same email is adopted only if it is a plain learner that isn't already linked, so this can never take over a staff account.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| externalRefrequired | path | string | matches [A-Za-z0-9._:@+~-]{1,200} |
Request body application/json · LearnerRequest
| Field | Type | Notes |
|---|---|---|
| access | string | matches MEMBER|MANAGER |
| courses | string[] | items match [a-z0-9][a-z0-9-]{0,100}; min 0 items |
| emailrequired | string (email) | min length 0; max length 320 |
| familyNamerequired | string | min length 0; max length 200 |
| givenNamerequired | string | min length 0; max length 200 |
| organization | string | min length 0; max length 200 |
| role | string | matches [a-z][a-z0-9_]{0,62} |
Example request body
{
"email": "ada@customer.example",
"givenName": "Ada",
"familyName": "Lovelace",
"organization": "acme-shop",
"role": "technician",
"access": "MEMBER",
"courses": [
"safety-101"
]
}Responses
Example response
{
"email": "maya.chen@example.com",
"externalRef": "order-5001",
"familyName": "Chen",
"givenName": "Maya",
"id": "37386ae0-0ea5-44e0-a02e-161f807af560",
"organization": {
"access": "MEMBER",
"name": "Acme Company",
"organization": "string",
"role": "string"
},
"status": "ACTIVE"
}Errors
| Status | When |
|---|---|
| 400 | The id has characters that aren't allowed, a field isn't valid, an organization, role or course doesn't exist, or role or access was sent without an organization. |
| 401 | Missing, invalid or expired credentials. |
| 403 | Your credential is valid but isn't allowed to do this. |
| 404 | It doesn't exist, or it belongs to another tenant (the two look the same on purpose). |
| 409 | Another account already uses that email, the account is a staff account, or the organization has no seats left for the role's courses (nothing is changed). |
Errors use RFC 9457 problem details.
EXTERNAL_REF=order-5001
curl -X PUT "$LMS_URL/api/v1/learners/$EXTERNAL_REF" \
-H "X-API-Key: $LMS_KEY" \
-H "Content-Type: application/json" \
-d '{
"email": "ada@customer.example",
"givenName": "Ada",
"familyName": "Lovelace",
"organization": "acme-shop",
"role": "technician",
"access": "MEMBER",
"courses": [
"safety-101"
]
}'const LMS_URL = process.env.LMS_URL
const LMS_KEY = process.env.LMS_KEY
const externalRef = "order-5001"
const res = await fetch(`${LMS_URL}/api/v1/learners/${externalRef}`, {
method: 'PUT',
headers: { "X-API-Key": LMS_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
"email": "ada@customer.example",
"givenName": "Ada",
"familyName": "Lovelace",
"organization": "acme-shop",
"role": "technician",
"access": "MEMBER",
"courses": [
"safety-101"
]
}),
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)
const data = await res.json()const LMS_URL = process.env.LMS_URL!
const LMS_KEY = process.env.LMS_KEY!
const externalRef = "order-5001"
const res = await fetch(`${LMS_URL}/api/v1/learners/${externalRef}`, {
method: 'PUT',
headers: { "X-API-Key": LMS_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
"email": "ada@customer.example",
"givenName": "Ada",
"familyName": "Lovelace",
"organization": "acme-shop",
"role": "technician",
"access": "MEMBER",
"courses": [
"safety-101"
]
}),
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)
const data: unknown = await res.json()import os
import requests
LMS_URL = os.environ["LMS_URL"]
HEADERS = {"X-API-Key": os.environ["LMS_KEY"]}
external_ref = "order-5001"
res = requests.put(f"{LMS_URL}/api/v1/learners/{external_ref}", headers=HEADERS, json={
"email": "ada@customer.example",
"givenName": "Ada",
"familyName": "Lovelace",
"organization": "acme-shop",
"role": "technician",
"access": "MEMBER",
"courses": [
"safety-101",
],
}, timeout=10)
res.raise_for_status()
data = res.json()import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Request {
public static void main(String[] args) throws Exception {
String lmsUrl = System.getenv("LMS_URL");
String lmsKey = System.getenv("LMS_KEY");
String externalRef = "order-5001";
String body = """
{
"email": "ada@customer.example",
"givenName": "Ada",
"familyName": "Lovelace",
"organization": "acme-shop",
"role": "technician",
"access": "MEMBER",
"courses": [
"safety-101"
]
}
""";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/learners/" + externalRef))
.header("X-API-Key", lmsKey)
.header("Content-Type", "application/json")
.method("PUT", HttpRequest.BodyPublishers.ofString(body))
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() >= 300) throw new IllegalStateException(response.statusCode() + " " + response.body());
System.out.println(response.body());
}
}require "net/http"
require "json"
lms_url = ENV.fetch("LMS_URL")
external_ref = "order-5001"
uri = URI("#{lms_url}/api/v1/learners/#{external_ref}")
request = Net::HTTP::Put.new(uri, "X-API-Key" => ENV.fetch("LMS_KEY"), "Content-Type" => "application/json")
request.body = {
"email" => "ada@customer.example",
"givenName" => "Ada",
"familyName" => "Lovelace",
"organization" => "acme-shop",
"role" => "technician",
"access" => "MEMBER",
"courses" => [
"safety-101",
],
}.to_json
response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(request) }
raise "#{response.code} #{response.body}" unless response.is_a?(Net::HTTPSuccess)
data = JSON.parse(response.body)<?php
$lmsUrl = getenv('LMS_URL');
$externalRef = "order-5001";
$ch = curl_init("$lmsUrl/api/v1/learners/{$externalRef}");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-Key: ' . getenv('LMS_KEY'), 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
"email" => "ada@customer.example",
"givenName" => "Ada",
"familyName" => "Lovelace",
"organization" => "acme-shop",
"role" => "technician",
"access" => "MEMBER",
"courses" => [
"safety-101",
],
]),
]);
$response = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 300) {
throw new RuntimeException($response);
}
$data = json_decode($response, true);package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
externalRef := "order-5001"
body := strings.NewReader(`{
"email": "ada@customer.example",
"givenName": "Ada",
"familyName": "Lovelace",
"organization": "acme-shop",
"role": "technician",
"access": "MEMBER",
"courses": [
"safety-101"
]
}`)
req, _ := http.NewRequest("PUT", os.Getenv("LMS_URL") + "/api/v1/learners/" + externalRef, body)
req.Header.Set("X-API-Key", os.Getenv("LMS_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, _ := io.ReadAll(res.Body)
if res.StatusCode >= 300 {
panic(fmt.Sprintf("%d %s", res.StatusCode, data))
}
fmt.Println(string(data))
}Remove a learner who left
AccessAdmin, or an API key with the write scope.
Suspends them: they can't sign in or be given tokens. Their data, progress and certificates are kept. Repeating the call is harmless. Staff accounts are refused.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| externalRefrequired | path | string | matches [A-Za-z0-9._:@+~-]{1,200} |
Responses
Errors
| Status | When |
|---|---|
| 401 | Missing, invalid or expired credentials. |
| 403 | Your credential is valid but isn't allowed to do this. |
| 404 | No learner has that id. |
| 409 | The account is a staff account. |
Errors use RFC 9457 problem details.
EXTERNAL_REF=order-5001
curl -X DELETE "$LMS_URL/api/v1/learners/$EXTERNAL_REF" \
-H "X-API-Key: $LMS_KEY"const LMS_URL = process.env.LMS_URL
const LMS_KEY = process.env.LMS_KEY
const externalRef = "order-5001"
const res = await fetch(`${LMS_URL}/api/v1/learners/${externalRef}`, {
method: 'DELETE',
headers: { "X-API-Key": LMS_KEY },
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)const LMS_URL = process.env.LMS_URL!
const LMS_KEY = process.env.LMS_KEY!
const externalRef = "order-5001"
const res = await fetch(`${LMS_URL}/api/v1/learners/${externalRef}`, {
method: 'DELETE',
headers: { "X-API-Key": LMS_KEY },
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)import os
import requests
LMS_URL = os.environ["LMS_URL"]
HEADERS = {"X-API-Key": os.environ["LMS_KEY"]}
external_ref = "order-5001"
res = requests.delete(f"{LMS_URL}/api/v1/learners/{external_ref}", headers=HEADERS, timeout=10)
res.raise_for_status()import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Request {
public static void main(String[] args) throws Exception {
String lmsUrl = System.getenv("LMS_URL");
String lmsKey = System.getenv("LMS_KEY");
String externalRef = "order-5001";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/learners/" + externalRef))
.header("X-API-Key", lmsKey)
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() >= 300) throw new IllegalStateException(response.statusCode() + " " + response.body());
}
}require "net/http"
require "json"
lms_url = ENV.fetch("LMS_URL")
external_ref = "order-5001"
uri = URI("#{lms_url}/api/v1/learners/#{external_ref}")
request = Net::HTTP::Delete.new(uri, "X-API-Key" => ENV.fetch("LMS_KEY"))
response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(request) }
raise "#{response.code} #{response.body}" unless response.is_a?(Net::HTTPSuccess)<?php
$lmsUrl = getenv('LMS_URL');
$externalRef = "order-5001";
$ch = curl_init("$lmsUrl/api/v1/learners/{$externalRef}");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-Key: ' . getenv('LMS_KEY')],
]);
$response = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 300) {
throw new RuntimeException($response);
}package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
externalRef := "order-5001"
req, _ := http.NewRequest("DELETE", os.Getenv("LMS_URL") + "/api/v1/learners/" + externalRef, nil)
req.Header.Set("X-API-Key", os.Getenv("LMS_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, _ := io.ReadAll(res.Body)
if res.StatusCode >= 300 {
panic(fmt.Sprintf("%d %s", res.StatusCode, data))
}
_ = data
}Get a learner's certificates
AccessAdmin, or an API key with the read or write scope.
Their certificates with serial, course, dates and verification code. Download one with GET /certificates/{id}/pdf.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| externalRefrequired | path | string | matches [A-Za-z0-9._:@+~-]{1,200} |
Responses
Example response
{}Errors
| Status | When |
|---|---|
| 401 | Missing, invalid or expired credentials. |
| 403 | Your credential is valid but isn't allowed to do this. |
| 404 | No learner has that id. |
Errors use RFC 9457 problem details.
EXTERNAL_REF=order-5001
curl -X GET "$LMS_URL/api/v1/learners/$EXTERNAL_REF/certificates" \
-H "X-API-Key: $LMS_KEY"const LMS_URL = process.env.LMS_URL
const LMS_KEY = process.env.LMS_KEY
const externalRef = "order-5001"
const res = await fetch(`${LMS_URL}/api/v1/learners/${externalRef}/certificates`, {
method: 'GET',
headers: { "X-API-Key": LMS_KEY },
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)
const data = await res.json()const LMS_URL = process.env.LMS_URL!
const LMS_KEY = process.env.LMS_KEY!
const externalRef = "order-5001"
const res = await fetch(`${LMS_URL}/api/v1/learners/${externalRef}/certificates`, {
method: 'GET',
headers: { "X-API-Key": LMS_KEY },
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)
const data: unknown = await res.json()import os
import requests
LMS_URL = os.environ["LMS_URL"]
HEADERS = {"X-API-Key": os.environ["LMS_KEY"]}
external_ref = "order-5001"
res = requests.get(f"{LMS_URL}/api/v1/learners/{external_ref}/certificates", headers=HEADERS, timeout=10)
res.raise_for_status()
data = res.json()import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Request {
public static void main(String[] args) throws Exception {
String lmsUrl = System.getenv("LMS_URL");
String lmsKey = System.getenv("LMS_KEY");
String externalRef = "order-5001";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/learners/" + externalRef + "/certificates"))
.header("X-API-Key", lmsKey)
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() >= 300) throw new IllegalStateException(response.statusCode() + " " + response.body());
System.out.println(response.body());
}
}require "net/http"
require "json"
lms_url = ENV.fetch("LMS_URL")
external_ref = "order-5001"
uri = URI("#{lms_url}/api/v1/learners/#{external_ref}/certificates")
request = Net::HTTP::Get.new(uri, "X-API-Key" => ENV.fetch("LMS_KEY"))
response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(request) }
raise "#{response.code} #{response.body}" unless response.is_a?(Net::HTTPSuccess)
data = JSON.parse(response.body)<?php
$lmsUrl = getenv('LMS_URL');
$externalRef = "order-5001";
$ch = curl_init("$lmsUrl/api/v1/learners/{$externalRef}/certificates");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-Key: ' . getenv('LMS_KEY')],
]);
$response = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 300) {
throw new RuntimeException($response);
}
$data = json_decode($response, true);package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
externalRef := "order-5001"
req, _ := http.NewRequest("GET", os.Getenv("LMS_URL") + "/api/v1/learners/" + externalRef + "/certificates", nil)
req.Header.Set("X-API-Key", os.Getenv("LMS_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, _ := io.ReadAll(res.Body)
if res.StatusCode >= 300 {
panic(fmt.Sprintf("%d %s", res.StatusCode, data))
}
fmt.Println(string(data))
}Get all of a learner's courses
AccessAdmin, or an API key with the read or write scope.
The data for a "my courses" screen, in one call: each course's address, title, summary, estimated minutes, status (ACTIVE, COMPLETED or EXPIRED), progress, dates, and the certificate id once there is one. Active courses first, then by most recent activity. Withdrawn enrollments are left out.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| externalRefrequired | path | string | matches [A-Za-z0-9._:@+~-]{1,200} |
Responses
Example response
[
{
"certificateId": "b335ac0d-4339-49fd-ab81-01ace7c46f69",
"completedAt": "2026-11-25T14:03:11Z",
"course": "string",
"coverAssetId": "ce4ba24d-c68c-4c3d-aa93-d96cac1be0a9",
"dueAt": "2026-11-25T14:03:11Z",
"enrolledAt": "2026-11-25T14:03:11Z",
"enrollmentId": "8b76f3d8-59e7-4058-a47c-98d7ac7b3bf8",
"estimatedMinutes": 30,
"expiresAt": "2026-11-25T14:03:11Z",
"lastActivityAt": "2026-11-25T14:03:11Z",
"progressPercent": 40,
"status": "ACTIVE",
"summary": "Fire safety and everyday hazards.",
"title": "Workplace Safety Essentials"
}
]Errors
| Status | When |
|---|---|
| 401 | Missing, invalid or expired credentials. |
| 403 | Your credential is valid but isn't allowed to do this. |
| 404 | No learner has that id. |
Errors use RFC 9457 problem details.
EXTERNAL_REF=order-5001
curl -X GET "$LMS_URL/api/v1/learners/$EXTERNAL_REF/courses" \
-H "X-API-Key: $LMS_KEY"const LMS_URL = process.env.LMS_URL
const LMS_KEY = process.env.LMS_KEY
const externalRef = "order-5001"
const res = await fetch(`${LMS_URL}/api/v1/learners/${externalRef}/courses`, {
method: 'GET',
headers: { "X-API-Key": LMS_KEY },
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)
const data = await res.json()const LMS_URL = process.env.LMS_URL!
const LMS_KEY = process.env.LMS_KEY!
const externalRef = "order-5001"
const res = await fetch(`${LMS_URL}/api/v1/learners/${externalRef}/courses`, {
method: 'GET',
headers: { "X-API-Key": LMS_KEY },
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)
const data: unknown = await res.json()import os
import requests
LMS_URL = os.environ["LMS_URL"]
HEADERS = {"X-API-Key": os.environ["LMS_KEY"]}
external_ref = "order-5001"
res = requests.get(f"{LMS_URL}/api/v1/learners/{external_ref}/courses", headers=HEADERS, timeout=10)
res.raise_for_status()
data = res.json()import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Request {
public static void main(String[] args) throws Exception {
String lmsUrl = System.getenv("LMS_URL");
String lmsKey = System.getenv("LMS_KEY");
String externalRef = "order-5001";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/learners/" + externalRef + "/courses"))
.header("X-API-Key", lmsKey)
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() >= 300) throw new IllegalStateException(response.statusCode() + " " + response.body());
System.out.println(response.body());
}
}require "net/http"
require "json"
lms_url = ENV.fetch("LMS_URL")
external_ref = "order-5001"
uri = URI("#{lms_url}/api/v1/learners/#{external_ref}/courses")
request = Net::HTTP::Get.new(uri, "X-API-Key" => ENV.fetch("LMS_KEY"))
response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(request) }
raise "#{response.code} #{response.body}" unless response.is_a?(Net::HTTPSuccess)
data = JSON.parse(response.body)<?php
$lmsUrl = getenv('LMS_URL');
$externalRef = "order-5001";
$ch = curl_init("$lmsUrl/api/v1/learners/{$externalRef}/courses");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-Key: ' . getenv('LMS_KEY')],
]);
$response = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 300) {
throw new RuntimeException($response);
}
$data = json_decode($response, true);package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
externalRef := "order-5001"
req, _ := http.NewRequest("GET", os.Getenv("LMS_URL") + "/api/v1/learners/" + externalRef + "/courses", nil)
req.Header.Set("X-API-Key", os.Getenv("LMS_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, _ := io.ReadAll(res.Body)
if res.StatusCode >= 300 {
panic(fmt.Sprintf("%d %s", res.StatusCode, data))
}
fmt.Println(string(data))
}Get a learner's progress in one course
AccessAdmin, or an API key with the read or write scope.
Their latest enrollment in the course in full: each lesson's status and time spent, every quiz attempt with its score, and the certificate if one was issued. course is the course's address.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| externalRefrequired | path | string | matches [A-Za-z0-9._:@+~-]{1,200} |
| courserequired | path | string | matches [a-z0-9][a-z0-9-]{0,100} |
Responses
Example response
{
"attempts": [
{
"assessmentTitle": "Safety knowledge check",
"attemptNumber": 1,
"id": "37386ae0-0ea5-44e0-a02e-161f807af560",
"passed": true,
"scorePercent": 86.5,
"status": "ACTIVE",
"submittedAt": "2026-11-25T14:03:11Z"
}
],
"certificateId": "b335ac0d-4339-49fd-ab81-01ace7c46f69",
"courseVersion": 1,
"enrollment": {
"completedAt": "2026-11-25T14:03:11Z",
"courseId": "ecec91e5-4eb9-4c55-a6a7-b3c44ebe7561",
"courseSlug": "string",
"courseTitle": "Workplace Safety Essentials",
"dueAt": "2026-11-25T14:03:11Z",
"enrolledAt": "2026-11-25T14:03:11Z",
"expiresAt": "2026-11-25T14:03:11Z",
"id": "37386ae0-0ea5-44e0-a02e-161f807af560",
"lastActivityAt": "2026-11-25T14:03:11Z",
"learnerEmail": "maya.chen@example.com",
"learnerExternalRef": "string",
"learnerName": "Maya Chen",
"organizationId": "44b78147-d73b-4117-ab62-4292d9ca20db",
"progressPercent": 40,
"source": "ROLE",
"status": "ACTIVE",
"userId": "11f967df-4272-482f-ac0b-7bea76dd8093"
},
"lessons": [
{
"completedAt": "2026-11-25T14:03:11Z",
"lessonId": "3d477cf4-98e8-48b4-a056-a98b308b7364",
"required": false,
"secondsSpent": 120,
"startedAt": "2026-11-25T14:03:11Z",
"status": "ACTIVE",
"title": "Workplace Safety Essentials"
}
]
}Errors
| Status | When |
|---|---|
| 401 | Missing, invalid or expired credentials. |
| 403 | Your credential is valid but isn't allowed to do this. |
| 404 | No learner has that id, or they have no enrollment in that course. |
Errors use RFC 9457 problem details.
EXTERNAL_REF=order-5001
COURSE=sample-value
curl -X GET "$LMS_URL/api/v1/learners/$EXTERNAL_REF/courses/$COURSE" \
-H "X-API-Key: $LMS_KEY"const LMS_URL = process.env.LMS_URL
const LMS_KEY = process.env.LMS_KEY
const externalRef = "order-5001"
const course = "sample-value"
const res = await fetch(`${LMS_URL}/api/v1/learners/${externalRef}/courses/${course}`, {
method: 'GET',
headers: { "X-API-Key": LMS_KEY },
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)
const data = await res.json()const LMS_URL = process.env.LMS_URL!
const LMS_KEY = process.env.LMS_KEY!
const externalRef = "order-5001"
const course = "sample-value"
const res = await fetch(`${LMS_URL}/api/v1/learners/${externalRef}/courses/${course}`, {
method: 'GET',
headers: { "X-API-Key": LMS_KEY },
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)
const data: unknown = await res.json()import os
import requests
LMS_URL = os.environ["LMS_URL"]
HEADERS = {"X-API-Key": os.environ["LMS_KEY"]}
external_ref = "order-5001"
course = "sample-value"
res = requests.get(f"{LMS_URL}/api/v1/learners/{external_ref}/courses/{course}", headers=HEADERS, timeout=10)
res.raise_for_status()
data = res.json()import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Request {
public static void main(String[] args) throws Exception {
String lmsUrl = System.getenv("LMS_URL");
String lmsKey = System.getenv("LMS_KEY");
String externalRef = "order-5001";
String course = "sample-value";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/learners/" + externalRef + "/courses/" + course))
.header("X-API-Key", lmsKey)
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() >= 300) throw new IllegalStateException(response.statusCode() + " " + response.body());
System.out.println(response.body());
}
}require "net/http"
require "json"
lms_url = ENV.fetch("LMS_URL")
external_ref = "order-5001"
course = "sample-value"
uri = URI("#{lms_url}/api/v1/learners/#{external_ref}/courses/#{course}")
request = Net::HTTP::Get.new(uri, "X-API-Key" => ENV.fetch("LMS_KEY"))
response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(request) }
raise "#{response.code} #{response.body}" unless response.is_a?(Net::HTTPSuccess)
data = JSON.parse(response.body)<?php
$lmsUrl = getenv('LMS_URL');
$externalRef = "order-5001";
$course = "sample-value";
$ch = curl_init("$lmsUrl/api/v1/learners/{$externalRef}/courses/{$course}");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-Key: ' . getenv('LMS_KEY')],
]);
$response = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 300) {
throw new RuntimeException($response);
}
$data = json_decode($response, true);package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
externalRef := "order-5001"
course := "sample-value"
req, _ := http.NewRequest("GET", os.Getenv("LMS_URL") + "/api/v1/learners/" + externalRef + "/courses/" + course, nil)
req.Header.Set("X-API-Key", os.Getenv("LMS_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, _ := io.ReadAll(res.Body)
if res.StatusCode >= 300 {
panic(fmt.Sprintf("%d %s", res.StatusCode, data))
}
fmt.Println(string(data))
}Give a learner a course
AccessAdmin, or an API key with the write scope.
Enrolls them in the course's published version, and returns the course as it appears in their list (201). If they already have it, in progress or finished, nothing changes and the existing enrollment is returned (200). If it was withdrawn or expired this starts a new one. course is the course's address.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| externalRefrequired | path | string | matches [A-Za-z0-9._:@+~-]{1,200} |
| courserequired | path | string | matches [a-z0-9][a-z0-9-]{0,100} |
Responses
Example response
{
"certificateId": "b335ac0d-4339-49fd-ab81-01ace7c46f69",
"completedAt": "2026-11-25T14:03:11Z",
"course": "string",
"coverAssetId": "ce4ba24d-c68c-4c3d-aa93-d96cac1be0a9",
"dueAt": "2026-11-25T14:03:11Z",
"enrolledAt": "2026-11-25T14:03:11Z",
"enrollmentId": "8b76f3d8-59e7-4058-a47c-98d7ac7b3bf8",
"estimatedMinutes": 30,
"expiresAt": "2026-11-25T14:03:11Z",
"lastActivityAt": "2026-11-25T14:03:11Z",
"progressPercent": 40,
"status": "ACTIVE",
"summary": "Fire safety and everyday hazards.",
"title": "Workplace Safety Essentials"
}Errors
| Status | When |
|---|---|
| 400 | Unknown course, or it has no published version. |
| 401 | Missing, invalid or expired credentials. |
| 403 | Your credential is valid but isn't allowed to do this. |
| 404 | No learner has that id. |
Errors use RFC 9457 problem details.
EXTERNAL_REF=order-5001
COURSE=sample-value
curl -X PUT "$LMS_URL/api/v1/learners/$EXTERNAL_REF/courses/$COURSE" \
-H "X-API-Key: $LMS_KEY"const LMS_URL = process.env.LMS_URL
const LMS_KEY = process.env.LMS_KEY
const externalRef = "order-5001"
const course = "sample-value"
const res = await fetch(`${LMS_URL}/api/v1/learners/${externalRef}/courses/${course}`, {
method: 'PUT',
headers: { "X-API-Key": LMS_KEY },
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)
const data = await res.json()const LMS_URL = process.env.LMS_URL!
const LMS_KEY = process.env.LMS_KEY!
const externalRef = "order-5001"
const course = "sample-value"
const res = await fetch(`${LMS_URL}/api/v1/learners/${externalRef}/courses/${course}`, {
method: 'PUT',
headers: { "X-API-Key": LMS_KEY },
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)
const data: unknown = await res.json()import os
import requests
LMS_URL = os.environ["LMS_URL"]
HEADERS = {"X-API-Key": os.environ["LMS_KEY"]}
external_ref = "order-5001"
course = "sample-value"
res = requests.put(f"{LMS_URL}/api/v1/learners/{external_ref}/courses/{course}", headers=HEADERS, timeout=10)
res.raise_for_status()
data = res.json()import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Request {
public static void main(String[] args) throws Exception {
String lmsUrl = System.getenv("LMS_URL");
String lmsKey = System.getenv("LMS_KEY");
String externalRef = "order-5001";
String course = "sample-value";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/learners/" + externalRef + "/courses/" + course))
.header("X-API-Key", lmsKey)
.method("PUT", HttpRequest.BodyPublishers.noBody())
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() >= 300) throw new IllegalStateException(response.statusCode() + " " + response.body());
System.out.println(response.body());
}
}require "net/http"
require "json"
lms_url = ENV.fetch("LMS_URL")
external_ref = "order-5001"
course = "sample-value"
uri = URI("#{lms_url}/api/v1/learners/#{external_ref}/courses/#{course}")
request = Net::HTTP::Put.new(uri, "X-API-Key" => ENV.fetch("LMS_KEY"))
response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(request) }
raise "#{response.code} #{response.body}" unless response.is_a?(Net::HTTPSuccess)
data = JSON.parse(response.body)<?php
$lmsUrl = getenv('LMS_URL');
$externalRef = "order-5001";
$course = "sample-value";
$ch = curl_init("$lmsUrl/api/v1/learners/{$externalRef}/courses/{$course}");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-Key: ' . getenv('LMS_KEY')],
]);
$response = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 300) {
throw new RuntimeException($response);
}
$data = json_decode($response, true);package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
externalRef := "order-5001"
course := "sample-value"
req, _ := http.NewRequest("PUT", os.Getenv("LMS_URL") + "/api/v1/learners/" + externalRef + "/courses/" + course, nil)
req.Header.Set("X-API-Key", os.Getenv("LMS_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, _ := io.ReadAll(res.Body)
if res.StatusCode >= 300 {
panic(fmt.Sprintf("%d %s", res.StatusCode, data))
}
fmt.Println(string(data))
}Take a course away from a learner
AccessAdmin, or an API key with the write scope.
Withdraws their active enrollment. Their progress is kept. Emits enrollment.withdrawn.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| externalRefrequired | path | string | matches [A-Za-z0-9._:@+~-]{1,200} |
| courserequired | path | string | matches [a-z0-9][a-z0-9-]{0,100} |
Responses
Errors
| Status | When |
|---|---|
| 401 | Missing, invalid or expired credentials. |
| 403 | Your credential is valid but isn't allowed to do this. |
| 404 | No learner has that id, or they aren't currently taking that course. |
Errors use RFC 9457 problem details.
EXTERNAL_REF=order-5001
COURSE=sample-value
curl -X DELETE "$LMS_URL/api/v1/learners/$EXTERNAL_REF/courses/$COURSE" \
-H "X-API-Key: $LMS_KEY"const LMS_URL = process.env.LMS_URL
const LMS_KEY = process.env.LMS_KEY
const externalRef = "order-5001"
const course = "sample-value"
const res = await fetch(`${LMS_URL}/api/v1/learners/${externalRef}/courses/${course}`, {
method: 'DELETE',
headers: { "X-API-Key": LMS_KEY },
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)const LMS_URL = process.env.LMS_URL!
const LMS_KEY = process.env.LMS_KEY!
const externalRef = "order-5001"
const course = "sample-value"
const res = await fetch(`${LMS_URL}/api/v1/learners/${externalRef}/courses/${course}`, {
method: 'DELETE',
headers: { "X-API-Key": LMS_KEY },
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)import os
import requests
LMS_URL = os.environ["LMS_URL"]
HEADERS = {"X-API-Key": os.environ["LMS_KEY"]}
external_ref = "order-5001"
course = "sample-value"
res = requests.delete(f"{LMS_URL}/api/v1/learners/{external_ref}/courses/{course}", headers=HEADERS, timeout=10)
res.raise_for_status()import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Request {
public static void main(String[] args) throws Exception {
String lmsUrl = System.getenv("LMS_URL");
String lmsKey = System.getenv("LMS_KEY");
String externalRef = "order-5001";
String course = "sample-value";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/learners/" + externalRef + "/courses/" + course))
.header("X-API-Key", lmsKey)
.method("DELETE", HttpRequest.BodyPublishers.noBody())
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() >= 300) throw new IllegalStateException(response.statusCode() + " " + response.body());
}
}require "net/http"
require "json"
lms_url = ENV.fetch("LMS_URL")
external_ref = "order-5001"
course = "sample-value"
uri = URI("#{lms_url}/api/v1/learners/#{external_ref}/courses/#{course}")
request = Net::HTTP::Delete.new(uri, "X-API-Key" => ENV.fetch("LMS_KEY"))
response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(request) }
raise "#{response.code} #{response.body}" unless response.is_a?(Net::HTTPSuccess)<?php
$lmsUrl = getenv('LMS_URL');
$externalRef = "order-5001";
$course = "sample-value";
$ch = curl_init("$lmsUrl/api/v1/learners/{$externalRef}/courses/{$course}");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'DELETE',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-Key: ' . getenv('LMS_KEY')],
]);
$response = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 300) {
throw new RuntimeException($response);
}package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
externalRef := "order-5001"
course := "sample-value"
req, _ := http.NewRequest("DELETE", os.Getenv("LMS_URL") + "/api/v1/learners/" + externalRef + "/courses/" + course, nil)
req.Header.Set("X-API-Key", os.Getenv("LMS_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, _ := io.ReadAll(res.Body)
if res.StatusCode >= 300 {
panic(fmt.Sprintf("%d %s", res.StatusCode, data))
}
_ = data
}Start a learner (the one call to let a user learn)
AccessAdmin, or an API key with the write scope.
Call this from your server when one of your users opens a course. Put your own id for that person in the URL (externalRef). It does everything create or update a learner does, then returns a token (valid for an hour) that your app uses to show them their courses.
Send their name and email. Optionally add where they belong (organization, role, access) and the courses they should have, by course address. Courses they have never been enrolled in are added; someone who finished or was withdrawn is not silently put back. Calling it again is harmless.
The person has no password and can't sign in to the LMS themselves. They only ever act through a token your server asks for.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| externalRefrequired | path | string | matches [A-Za-z0-9._:@+~-]{1,200} |
Request body application/json · LearnerRequest
| Field | Type | Notes |
|---|---|---|
| access | string | matches MEMBER|MANAGER |
| courses | string[] | items match [a-z0-9][a-z0-9-]{0,100}; min 0 items |
| emailrequired | string (email) | min length 0; max length 320 |
| familyNamerequired | string | min length 0; max length 200 |
| givenNamerequired | string | min length 0; max length 200 |
| organization | string | min length 0; max length 200 |
| role | string | matches [a-z][a-z0-9_]{0,62} |
Example request body
{
"email": "ada@customer.example",
"givenName": "Ada",
"familyName": "Lovelace",
"courses": [
"safety-101"
]
}Responses
Example response
{
"accessToken": "eyJhbGciOiJIUzI1NiJ9…",
"expiresInSeconds": 3600,
"learnerId": "56e5f63b-170e-41cb-a9cf-10ee39e22c3f"
}Errors
| Status | When |
|---|---|
| 400 | A listed course, organization or role doesn't exist, a course has no published version, or a field is missing or not valid. |
| 401 | Missing, invalid or expired credentials. |
| 403 | Your key doesn't have write access. |
| 404 | It doesn't exist, or it belongs to another tenant (the two look the same on purpose). |
| 409 | Another account already uses that email, the account is a staff account or is suspended, or the organization has no seats left for the role's courses. |
Errors use RFC 9457 problem details.
EXTERNAL_REF=order-5001
curl -X POST "$LMS_URL/api/v1/learners/$EXTERNAL_REF/session" \
-H "X-API-Key: $LMS_KEY" \
-H "Content-Type: application/json" \
-d '{
"email": "ada@customer.example",
"givenName": "Ada",
"familyName": "Lovelace",
"courses": [
"safety-101"
]
}'const LMS_URL = process.env.LMS_URL
const LMS_KEY = process.env.LMS_KEY
const externalRef = "order-5001"
const res = await fetch(`${LMS_URL}/api/v1/learners/${externalRef}/session`, {
method: 'POST',
headers: { "X-API-Key": LMS_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
"email": "ada@customer.example",
"givenName": "Ada",
"familyName": "Lovelace",
"courses": [
"safety-101"
]
}),
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)
const data = await res.json()const LMS_URL = process.env.LMS_URL!
const LMS_KEY = process.env.LMS_KEY!
const externalRef = "order-5001"
const res = await fetch(`${LMS_URL}/api/v1/learners/${externalRef}/session`, {
method: 'POST',
headers: { "X-API-Key": LMS_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
"email": "ada@customer.example",
"givenName": "Ada",
"familyName": "Lovelace",
"courses": [
"safety-101"
]
}),
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)
const data: unknown = await res.json()import os
import requests
LMS_URL = os.environ["LMS_URL"]
HEADERS = {"X-API-Key": os.environ["LMS_KEY"]}
external_ref = "order-5001"
res = requests.post(f"{LMS_URL}/api/v1/learners/{external_ref}/session", headers=HEADERS, json={
"email": "ada@customer.example",
"givenName": "Ada",
"familyName": "Lovelace",
"courses": [
"safety-101",
],
}, timeout=10)
res.raise_for_status()
data = res.json()import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Request {
public static void main(String[] args) throws Exception {
String lmsUrl = System.getenv("LMS_URL");
String lmsKey = System.getenv("LMS_KEY");
String externalRef = "order-5001";
String body = """
{
"email": "ada@customer.example",
"givenName": "Ada",
"familyName": "Lovelace",
"courses": [
"safety-101"
]
}
""";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/learners/" + externalRef + "/session"))
.header("X-API-Key", lmsKey)
.header("Content-Type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString(body))
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() >= 300) throw new IllegalStateException(response.statusCode() + " " + response.body());
System.out.println(response.body());
}
}require "net/http"
require "json"
lms_url = ENV.fetch("LMS_URL")
external_ref = "order-5001"
uri = URI("#{lms_url}/api/v1/learners/#{external_ref}/session")
request = Net::HTTP::Post.new(uri, "X-API-Key" => ENV.fetch("LMS_KEY"), "Content-Type" => "application/json")
request.body = {
"email" => "ada@customer.example",
"givenName" => "Ada",
"familyName" => "Lovelace",
"courses" => [
"safety-101",
],
}.to_json
response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(request) }
raise "#{response.code} #{response.body}" unless response.is_a?(Net::HTTPSuccess)
data = JSON.parse(response.body)<?php
$lmsUrl = getenv('LMS_URL');
$externalRef = "order-5001";
$ch = curl_init("$lmsUrl/api/v1/learners/{$externalRef}/session");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-Key: ' . getenv('LMS_KEY'), 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
"email" => "ada@customer.example",
"givenName" => "Ada",
"familyName" => "Lovelace",
"courses" => [
"safety-101",
],
]),
]);
$response = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 300) {
throw new RuntimeException($response);
}
$data = json_decode($response, true);package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
)
func main() {
externalRef := "order-5001"
body := strings.NewReader(`{
"email": "ada@customer.example",
"givenName": "Ada",
"familyName": "Lovelace",
"courses": [
"safety-101"
]
}`)
req, _ := http.NewRequest("POST", os.Getenv("LMS_URL") + "/api/v1/learners/" + externalRef + "/session", body)
req.Header.Set("X-API-Key", os.Getenv("LMS_KEY"))
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, _ := io.ReadAll(res.Body)
if res.StatusCode >= 300 {
panic(fmt.Sprintf("%d %s", res.StatusCode, data))
}
fmt.Println(string(data))
}Search people
AccessAdmin, or an API key with the read or write scope.
Searches by name or email (q, case-insensitive, % and _ are literal), optionally filtered by status. Paged with limit (max 200) and offset; total is the full count.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| q | query | string | — |
| status | query | string | matches INVITED|ACTIVE|SUSPENDED|ARCHIVED |
| limit | query | integer (int32) | — |
| offset | query | integer (int32) | — |
Responses
Example response
{
"items": [
{
"createdAt": "2026-11-25T14:03:11Z",
"email": "maya.chen@example.com",
"externalRef": "order-5001",
"familyName": "Chen",
"givenName": "Maya",
"id": "37386ae0-0ea5-44e0-a02e-161f807af560",
"lastLoginAt": "2026-11-25T14:03:11Z",
"organizations": [
{
"access": "MEMBER",
"organizationId": "44b78147-d73b-4117-ab62-4292d9ca20db",
"organizationName": "Acme Company",
"roleKey": "team_lead"
}
],
"roles": [
"string"
],
"status": "ACTIVE"
}
],
"total": 1
}Errors
| Status | When |
|---|---|
| 401 | Missing, invalid or expired credentials. |
| 403 | Your credential is valid but isn't allowed to do this. |
Errors use RFC 9457 problem details.
curl -X GET "$LMS_URL/api/v1/users?q=maya&status=ACTIVE" \
-H "X-API-Key: $LMS_KEY"const LMS_URL = process.env.LMS_URL
const LMS_KEY = process.env.LMS_KEY
const res = await fetch(`${LMS_URL}/api/v1/users?q=maya&status=ACTIVE`, {
method: 'GET',
headers: { "X-API-Key": LMS_KEY },
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)
const data = await res.json()const LMS_URL = process.env.LMS_URL!
const LMS_KEY = process.env.LMS_KEY!
const res = await fetch(`${LMS_URL}/api/v1/users?q=maya&status=ACTIVE`, {
method: 'GET',
headers: { "X-API-Key": LMS_KEY },
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)
const data: unknown = await res.json()import os
import requests
LMS_URL = os.environ["LMS_URL"]
HEADERS = {"X-API-Key": os.environ["LMS_KEY"]}
res = requests.get(f"{LMS_URL}/api/v1/users?q=maya&status=ACTIVE", headers=HEADERS, timeout=10)
res.raise_for_status()
data = res.json()import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Request {
public static void main(String[] args) throws Exception {
String lmsUrl = System.getenv("LMS_URL");
String lmsKey = System.getenv("LMS_KEY");
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/users?q=maya&status=ACTIVE"))
.header("X-API-Key", lmsKey)
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() >= 300) throw new IllegalStateException(response.statusCode() + " " + response.body());
System.out.println(response.body());
}
}require "net/http"
require "json"
lms_url = ENV.fetch("LMS_URL")
uri = URI("#{lms_url}/api/v1/users?q=maya&status=ACTIVE")
request = Net::HTTP::Get.new(uri, "X-API-Key" => ENV.fetch("LMS_KEY"))
response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(request) }
raise "#{response.code} #{response.body}" unless response.is_a?(Net::HTTPSuccess)
data = JSON.parse(response.body)<?php
$lmsUrl = getenv('LMS_URL');
$ch = curl_init("$lmsUrl/api/v1/users?q=maya&status=ACTIVE");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-Key: ' . getenv('LMS_KEY')],
]);
$response = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 300) {
throw new RuntimeException($response);
}
$data = json_decode($response, true);package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
req, _ := http.NewRequest("GET", os.Getenv("LMS_URL") + "/api/v1/users?q=maya&status=ACTIVE", nil)
req.Header.Set("X-API-Key", os.Getenv("LMS_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, _ := io.ReadAll(res.Body)
if res.StatusCode >= 300 {
panic(fmt.Sprintf("%d %s", res.StatusCode, data))
}
fmt.Println(string(data))
}Get a person
AccessAdmin, or an API key with the read or write scope.
Returns the person with their platform roles and organizations.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| idrequired | path | string (uuid) | The id from a previous response. |
Responses
Example response
{
"createdAt": "2026-11-25T14:03:11Z",
"email": "maya.chen@example.com",
"externalRef": "order-5001",
"familyName": "Chen",
"givenName": "Maya",
"id": "37386ae0-0ea5-44e0-a02e-161f807af560",
"lastLoginAt": "2026-11-25T14:03:11Z",
"organizations": [
{
"access": "MEMBER",
"organizationId": "44b78147-d73b-4117-ab62-4292d9ca20db",
"organizationName": "Acme Company",
"roleKey": "team_lead"
}
],
"roles": [
"string"
],
"status": "ACTIVE"
}Errors
| Status | When |
|---|---|
| 401 | Missing, invalid or expired credentials. |
| 403 | Your credential is valid but isn't allowed to do this. |
| 404 | It doesn't exist, or it belongs to another tenant (the two look the same on purpose). |
Errors use RFC 9457 problem details.
USER_ID=37386ae0-0ea5-44e0-a02e-161f807af560
curl -X GET "$LMS_URL/api/v1/users/$USER_ID" \
-H "X-API-Key: $LMS_KEY"const LMS_URL = process.env.LMS_URL
const LMS_KEY = process.env.LMS_KEY
const userId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/users/${userId}`, {
method: 'GET',
headers: { "X-API-Key": LMS_KEY },
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)
const data = await res.json()const LMS_URL = process.env.LMS_URL!
const LMS_KEY = process.env.LMS_KEY!
const userId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/users/${userId}`, {
method: 'GET',
headers: { "X-API-Key": LMS_KEY },
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)
const data: unknown = await res.json()import os
import requests
LMS_URL = os.environ["LMS_URL"]
HEADERS = {"X-API-Key": os.environ["LMS_KEY"]}
user_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
res = requests.get(f"{LMS_URL}/api/v1/users/{user_id}", headers=HEADERS, timeout=10)
res.raise_for_status()
data = res.json()import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Request {
public static void main(String[] args) throws Exception {
String lmsUrl = System.getenv("LMS_URL");
String lmsKey = System.getenv("LMS_KEY");
String userId = "37386ae0-0ea5-44e0-a02e-161f807af560";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/users/" + userId))
.header("X-API-Key", lmsKey)
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() >= 300) throw new IllegalStateException(response.statusCode() + " " + response.body());
System.out.println(response.body());
}
}require "net/http"
require "json"
lms_url = ENV.fetch("LMS_URL")
user_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
uri = URI("#{lms_url}/api/v1/users/#{user_id}")
request = Net::HTTP::Get.new(uri, "X-API-Key" => ENV.fetch("LMS_KEY"))
response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(request) }
raise "#{response.code} #{response.body}" unless response.is_a?(Net::HTTPSuccess)
data = JSON.parse(response.body)<?php
$lmsUrl = getenv('LMS_URL');
$userId = "37386ae0-0ea5-44e0-a02e-161f807af560";
$ch = curl_init("$lmsUrl/api/v1/users/{$userId}");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-Key: ' . getenv('LMS_KEY')],
]);
$response = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 300) {
throw new RuntimeException($response);
}
$data = json_decode($response, true);package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
userId := "37386ae0-0ea5-44e0-a02e-161f807af560"
req, _ := http.NewRequest("GET", os.Getenv("LMS_URL") + "/api/v1/users/" + userId, nil)
req.Header.Set("X-API-Key", os.Getenv("LMS_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, _ := io.ReadAll(res.Body)
if res.StatusCode >= 300 {
panic(fmt.Sprintf("%d %s", res.StatusCode, data))
}
fmt.Println(string(data))
}Reactivate a person
AccessAdmin, or an API key with the write scope.
Lets a suspended person sign in again.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| idrequired | path | string (uuid) | The id from a previous response. |
Responses
Example response
{
"createdAt": "2026-11-25T14:03:11Z",
"email": "maya.chen@example.com",
"externalRef": "order-5001",
"familyName": "Chen",
"givenName": "Maya",
"id": "37386ae0-0ea5-44e0-a02e-161f807af560",
"lastLoginAt": "2026-11-25T14:03:11Z",
"organizations": [
{
"access": "MEMBER",
"organizationId": "44b78147-d73b-4117-ab62-4292d9ca20db",
"organizationName": "Acme Company",
"roleKey": "team_lead"
}
],
"roles": [
"string"
],
"status": "ACTIVE"
}Errors
| Status | When |
|---|---|
| 401 | Missing, invalid or expired credentials. |
| 403 | Your credential is valid but isn't allowed to do this. |
| 404 | It doesn't exist, or it belongs to another tenant (the two look the same on purpose). |
Errors use RFC 9457 problem details.
USER_ID=37386ae0-0ea5-44e0-a02e-161f807af560
curl -X POST "$LMS_URL/api/v1/users/$USER_ID/reactivate" \
-H "X-API-Key: $LMS_KEY"const LMS_URL = process.env.LMS_URL
const LMS_KEY = process.env.LMS_KEY
const userId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/users/${userId}/reactivate`, {
method: 'POST',
headers: { "X-API-Key": LMS_KEY },
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)
const data = await res.json()const LMS_URL = process.env.LMS_URL!
const LMS_KEY = process.env.LMS_KEY!
const userId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/users/${userId}/reactivate`, {
method: 'POST',
headers: { "X-API-Key": LMS_KEY },
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)
const data: unknown = await res.json()import os
import requests
LMS_URL = os.environ["LMS_URL"]
HEADERS = {"X-API-Key": os.environ["LMS_KEY"]}
user_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
res = requests.post(f"{LMS_URL}/api/v1/users/{user_id}/reactivate", headers=HEADERS, timeout=10)
res.raise_for_status()
data = res.json()import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Request {
public static void main(String[] args) throws Exception {
String lmsUrl = System.getenv("LMS_URL");
String lmsKey = System.getenv("LMS_KEY");
String userId = "37386ae0-0ea5-44e0-a02e-161f807af560";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/users/" + userId + "/reactivate"))
.header("X-API-Key", lmsKey)
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() >= 300) throw new IllegalStateException(response.statusCode() + " " + response.body());
System.out.println(response.body());
}
}require "net/http"
require "json"
lms_url = ENV.fetch("LMS_URL")
user_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
uri = URI("#{lms_url}/api/v1/users/#{user_id}/reactivate")
request = Net::HTTP::Post.new(uri, "X-API-Key" => ENV.fetch("LMS_KEY"))
response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(request) }
raise "#{response.code} #{response.body}" unless response.is_a?(Net::HTTPSuccess)
data = JSON.parse(response.body)<?php
$lmsUrl = getenv('LMS_URL');
$userId = "37386ae0-0ea5-44e0-a02e-161f807af560";
$ch = curl_init("$lmsUrl/api/v1/users/{$userId}/reactivate");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-Key: ' . getenv('LMS_KEY')],
]);
$response = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 300) {
throw new RuntimeException($response);
}
$data = json_decode($response, true);package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
userId := "37386ae0-0ea5-44e0-a02e-161f807af560"
req, _ := http.NewRequest("POST", os.Getenv("LMS_URL") + "/api/v1/users/" + userId + "/reactivate", nil)
req.Header.Set("X-API-Key", os.Getenv("LMS_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, _ := io.ReadAll(res.Body)
if res.StatusCode >= 300 {
panic(fmt.Sprintf("%d %s", res.StatusCode, data))
}
fmt.Println(string(data))
}Suspend a person
AccessAdmin, or an API key with the write scope.
Stops them signing in. Their data, enrollments and certificates are untouched.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| idrequired | path | string (uuid) | The id from a previous response. |
Responses
Example response
{
"createdAt": "2026-11-25T14:03:11Z",
"email": "maya.chen@example.com",
"externalRef": "order-5001",
"familyName": "Chen",
"givenName": "Maya",
"id": "37386ae0-0ea5-44e0-a02e-161f807af560",
"lastLoginAt": "2026-11-25T14:03:11Z",
"organizations": [
{
"access": "MEMBER",
"organizationId": "44b78147-d73b-4117-ab62-4292d9ca20db",
"organizationName": "Acme Company",
"roleKey": "team_lead"
}
],
"roles": [
"string"
],
"status": "ACTIVE"
}Errors
| Status | When |
|---|---|
| 401 | Missing, invalid or expired credentials. |
| 403 | Your credential is valid but isn't allowed to do this. |
| 404 | It doesn't exist, or it belongs to another tenant (the two look the same on purpose). |
| 409 | You can't change your own status, or the account isn't active or suspended. |
Errors use RFC 9457 problem details.
USER_ID=37386ae0-0ea5-44e0-a02e-161f807af560
curl -X POST "$LMS_URL/api/v1/users/$USER_ID/suspend" \
-H "X-API-Key: $LMS_KEY"const LMS_URL = process.env.LMS_URL
const LMS_KEY = process.env.LMS_KEY
const userId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/users/${userId}/suspend`, {
method: 'POST',
headers: { "X-API-Key": LMS_KEY },
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)
const data = await res.json()const LMS_URL = process.env.LMS_URL!
const LMS_KEY = process.env.LMS_KEY!
const userId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/users/${userId}/suspend`, {
method: 'POST',
headers: { "X-API-Key": LMS_KEY },
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)
const data: unknown = await res.json()import os
import requests
LMS_URL = os.environ["LMS_URL"]
HEADERS = {"X-API-Key": os.environ["LMS_KEY"]}
user_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
res = requests.post(f"{LMS_URL}/api/v1/users/{user_id}/suspend", headers=HEADERS, timeout=10)
res.raise_for_status()
data = res.json()import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Request {
public static void main(String[] args) throws Exception {
String lmsUrl = System.getenv("LMS_URL");
String lmsKey = System.getenv("LMS_KEY");
String userId = "37386ae0-0ea5-44e0-a02e-161f807af560";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/users/" + userId + "/suspend"))
.header("X-API-Key", lmsKey)
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() >= 300) throw new IllegalStateException(response.statusCode() + " " + response.body());
System.out.println(response.body());
}
}require "net/http"
require "json"
lms_url = ENV.fetch("LMS_URL")
user_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
uri = URI("#{lms_url}/api/v1/users/#{user_id}/suspend")
request = Net::HTTP::Post.new(uri, "X-API-Key" => ENV.fetch("LMS_KEY"))
response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(request) }
raise "#{response.code} #{response.body}" unless response.is_a?(Net::HTTPSuccess)
data = JSON.parse(response.body)<?php
$lmsUrl = getenv('LMS_URL');
$userId = "37386ae0-0ea5-44e0-a02e-161f807af560";
$ch = curl_init("$lmsUrl/api/v1/users/{$userId}/suspend");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-Key: ' . getenv('LMS_KEY')],
]);
$response = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 300) {
throw new RuntimeException($response);
}
$data = json_decode($response, true);package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
userId := "37386ae0-0ea5-44e0-a02e-161f807af560"
req, _ := http.NewRequest("POST", os.Getenv("LMS_URL") + "/api/v1/users/" + userId + "/suspend", nil)
req.Header.Set("X-API-Key", os.Getenv("LMS_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, _ := io.ReadAll(res.Body)
if res.StatusCode >= 300 {
panic(fmt.Sprintf("%d %s", res.StatusCode, data))
}
fmt.Println(string(data))
}Get a learner token for one of your learners
AccessAdmin, or an API key with the write scope.
Returns a short-lived token (1 hour) that lets that learner call the learner API (/me/…): their courses, lesson content, progress, quizzes and certificates. Request it from your server with your API key, then hand it to your front end or use it server-side. When it expires, ask for another.
Only for active accounts whose only role is LEARNER. Staff accounts are refused, so a key can never impersonate an admin. The user must be in your tenant.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| idrequired | path | string (uuid) | The id from a previous response. |
Responses
Example response
{
"accessToken": "eyJhbGciOiJIUzI1NiJ9…",
"expiresInSeconds": 3600
}Errors
| Status | When |
|---|---|
| 401 | Missing, invalid or expired credentials. |
| 403 | The account is a staff account, or your key doesn't have write access. |
| 404 | No such user in your tenant. |
| 409 | The learner is suspended or archived. |
Errors use RFC 9457 problem details.
USER_ID=37386ae0-0ea5-44e0-a02e-161f807af560
curl -X POST "$LMS_URL/api/v1/users/$USER_ID/token" \
-H "X-API-Key: $LMS_KEY"const LMS_URL = process.env.LMS_URL
const LMS_KEY = process.env.LMS_KEY
const userId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/users/${userId}/token`, {
method: 'POST',
headers: { "X-API-Key": LMS_KEY },
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)
const data = await res.json()const LMS_URL = process.env.LMS_URL!
const LMS_KEY = process.env.LMS_KEY!
const userId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/users/${userId}/token`, {
method: 'POST',
headers: { "X-API-Key": LMS_KEY },
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)
const data: unknown = await res.json()import os
import requests
LMS_URL = os.environ["LMS_URL"]
HEADERS = {"X-API-Key": os.environ["LMS_KEY"]}
user_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
res = requests.post(f"{LMS_URL}/api/v1/users/{user_id}/token", headers=HEADERS, timeout=10)
res.raise_for_status()
data = res.json()import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class Request {
public static void main(String[] args) throws Exception {
String lmsUrl = System.getenv("LMS_URL");
String lmsKey = System.getenv("LMS_KEY");
String userId = "37386ae0-0ea5-44e0-a02e-161f807af560";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/users/" + userId + "/token"))
.header("X-API-Key", lmsKey)
.method("POST", HttpRequest.BodyPublishers.noBody())
.build();
var response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
if (response.statusCode() >= 300) throw new IllegalStateException(response.statusCode() + " " + response.body());
System.out.println(response.body());
}
}require "net/http"
require "json"
lms_url = ENV.fetch("LMS_URL")
user_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
uri = URI("#{lms_url}/api/v1/users/#{user_id}/token")
request = Net::HTTP::Post.new(uri, "X-API-Key" => ENV.fetch("LMS_KEY"))
response = Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == "https") { |http| http.request(request) }
raise "#{response.code} #{response.body}" unless response.is_a?(Net::HTTPSuccess)
data = JSON.parse(response.body)<?php
$lmsUrl = getenv('LMS_URL');
$userId = "37386ae0-0ea5-44e0-a02e-161f807af560";
$ch = curl_init("$lmsUrl/api/v1/users/{$userId}/token");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-API-Key: ' . getenv('LMS_KEY')],
]);
$response = curl_exec($ch);
if (curl_getinfo($ch, CURLINFO_RESPONSE_CODE) >= 300) {
throw new RuntimeException($response);
}
$data = json_decode($response, true);package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
userId := "37386ae0-0ea5-44e0-a02e-161f807af560"
req, _ := http.NewRequest("POST", os.Getenv("LMS_URL") + "/api/v1/users/" + userId + "/token", nil)
req.Header.Set("X-API-Key", os.Getenv("LMS_KEY"))
res, err := http.DefaultClient.Do(req)
if err != nil {
panic(err)
}
defer res.Body.Close()
data, _ := io.ReadAll(res.Body)
if res.StatusCode >= 300 {
panic(fmt.Sprintf("%d %s", res.StatusCode, data))
}
fmt.Println(string(data))
}