Docs API reference
Products & roles
What you sell, and what each kind of learner gets.
A product is a bundle of courses you sell. A role is your own label (like "Sales") with an explicit list of courses. See Selling & onboarding.
6 endpoints · base path /api/v1
List roles
AccessA signed-in user (the learner's own login token).
Lists the tenant's roles ("Sales", "Support" and so on). Roles are yours to define.
Responses
Example response
[
{
"description": "A short description.",
"id": "37386ae0-0ea5-44e0-a02e-161f807af560",
"key": "team_lead",
"name": "Acme Company",
"status": "ACTIVE"
}
]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/member-roles" \
-H "Authorization: Bearer $LMS_TOKEN"const LMS_URL = process.env.LMS_URL
const LMS_TOKEN = process.env.LMS_TOKEN
const res = await fetch(`${LMS_URL}/api/v1/member-roles`, {
method: 'GET',
headers: { "Authorization": `Bearer ${LMS_TOKEN}` },
})
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_TOKEN = process.env.LMS_TOKEN!
const res = await fetch(`${LMS_URL}/api/v1/member-roles`, {
method: 'GET',
headers: { "Authorization": `Bearer ${LMS_TOKEN}` },
})
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 = {"Authorization": "Bearer " + os.environ["LMS_TOKEN"]}
res = requests.get(f"{LMS_URL}/api/v1/member-roles", 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 lmsToken = System.getenv("LMS_TOKEN");
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/member-roles"))
.header("Authorization", "Bearer " + lmsToken)
.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/member-roles")
request = Net::HTTP::Get.new(uri, "Authorization" => "Bearer " + ENV.fetch("LMS_TOKEN"))
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/member-roles");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('LMS_TOKEN')],
]);
$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/member-roles", nil)
req.Header.Set("Authorization", "Bearer " + os.Getenv("LMS_TOKEN"))
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 a role
AccessA signed-in user (the learner's own login token).
A role is a label with an explicit list of courses. key is its stable machine name: lowercase letters, digits and underscores, starting with a letter.
Roles are separate from permissions: a role only decides which courses someone gets.
Request body application/json · CreateRole
| Field | Type | Notes |
|---|---|---|
| description | string | — |
| keyrequired | string | matches [a-z][a-z0-9_]{0,62}; min length 1 |
| namerequired | string | min length 1 |
Example request body
{
"description": "A short description.",
"key": "team_lead",
"name": "Acme Company"
}Responses
Example response
{
"description": "A short description.",
"id": "37386ae0-0ea5-44e0-a02e-161f807af560",
"key": "team_lead",
"name": "Acme Company",
"status": "ACTIVE"
}Errors
| Status | When |
|---|---|
| 400 | The request was malformed or failed validation. errors lists each field. |
| 401 | Missing, invalid or expired credentials. |
| 403 | Your credential is valid but isn't allowed to do this. |
| 409 | The key is already used. |
Errors use RFC 9457 problem details.
curl -X POST "$LMS_URL/api/v1/member-roles" \
-H "Authorization: Bearer $LMS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"description": "A short description.",
"key": "team_lead",
"name": "Acme Company"
}'const LMS_URL = process.env.LMS_URL
const LMS_TOKEN = process.env.LMS_TOKEN
const res = await fetch(`${LMS_URL}/api/v1/member-roles`, {
method: 'POST',
headers: { "Authorization": `Bearer ${LMS_TOKEN}`, 'Content-Type': 'application/json' },
body: JSON.stringify({
"description": "A short description.",
"key": "team_lead",
"name": "Acme Company"
}),
})
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_TOKEN = process.env.LMS_TOKEN!
const res = await fetch(`${LMS_URL}/api/v1/member-roles`, {
method: 'POST',
headers: { "Authorization": `Bearer ${LMS_TOKEN}`, 'Content-Type': 'application/json' },
body: JSON.stringify({
"description": "A short description.",
"key": "team_lead",
"name": "Acme Company"
}),
})
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 = {"Authorization": "Bearer " + os.environ["LMS_TOKEN"]}
res = requests.post(f"{LMS_URL}/api/v1/member-roles", headers=HEADERS, json={
"description": "A short description.",
"key": "team_lead",
"name": "Acme Company",
}, 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 lmsToken = System.getenv("LMS_TOKEN");
String body = """
{
"description": "A short description.",
"key": "team_lead",
"name": "Acme Company"
}
""";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/member-roles"))
.header("Authorization", "Bearer " + lmsToken)
.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")
uri = URI("#{lms_url}/api/v1/member-roles")
request = Net::HTTP::Post.new(uri, "Authorization" => "Bearer " + ENV.fetch("LMS_TOKEN"), "Content-Type" => "application/json")
request.body = {
"description" => "A short description.",
"key" => "team_lead",
"name" => "Acme Company",
}.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');
$ch = curl_init("$lmsUrl/api/v1/member-roles");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('LMS_TOKEN'), 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
"description" => "A short description.",
"key" => "team_lead",
"name" => "Acme Company",
]),
]);
$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() {
body := strings.NewReader(`{
"description": "A short description.",
"key": "team_lead",
"name": "Acme Company"
}`)
req, _ := http.NewRequest("POST", os.Getenv("LMS_URL") + "/api/v1/member-roles", body)
req.Header.Set("Authorization", "Bearer " + os.Getenv("LMS_TOKEN"))
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))
}List a role's courses
AccessA signed-in user (the learner's own login token).
Returns the courses the role gets, with each assignment's due and access windows and its removal policy.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| idrequired | path | string (uuid) | The id from a previous response. |
Responses
Example response
[
{
"accessDays": 1,
"courseId": "ecec91e5-4eb9-4c55-a6a7-b3c44ebe7561",
"dueAfterDays": 1,
"onRoleRemoved": "string"
}
]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.
MEMBER_ROLE_ID=37386ae0-0ea5-44e0-a02e-161f807af560
curl -X GET "$LMS_URL/api/v1/member-roles/$MEMBER_ROLE_ID/courses" \
-H "Authorization: Bearer $LMS_TOKEN"const LMS_URL = process.env.LMS_URL
const LMS_TOKEN = process.env.LMS_TOKEN
const memberRoleId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/member-roles/${memberRoleId}/courses`, {
method: 'GET',
headers: { "Authorization": `Bearer ${LMS_TOKEN}` },
})
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_TOKEN = process.env.LMS_TOKEN!
const memberRoleId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/member-roles/${memberRoleId}/courses`, {
method: 'GET',
headers: { "Authorization": `Bearer ${LMS_TOKEN}` },
})
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 = {"Authorization": "Bearer " + os.environ["LMS_TOKEN"]}
member_role_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
res = requests.get(f"{LMS_URL}/api/v1/member-roles/{member_role_id}/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 lmsToken = System.getenv("LMS_TOKEN");
String memberRoleId = "37386ae0-0ea5-44e0-a02e-161f807af560";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/member-roles/" + memberRoleId + "/courses"))
.header("Authorization", "Bearer " + lmsToken)
.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")
member_role_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
uri = URI("#{lms_url}/api/v1/member-roles/#{member_role_id}/courses")
request = Net::HTTP::Get.new(uri, "Authorization" => "Bearer " + ENV.fetch("LMS_TOKEN"))
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');
$memberRoleId = "37386ae0-0ea5-44e0-a02e-161f807af560";
$ch = curl_init("$lmsUrl/api/v1/member-roles/{$memberRoleId}/courses");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('LMS_TOKEN')],
]);
$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() {
memberRoleId := "37386ae0-0ea5-44e0-a02e-161f807af560"
req, _ := http.NewRequest("GET", os.Getenv("LMS_URL") + "/api/v1/member-roles/" + memberRoleId + "/courses", nil)
req.Header.Set("Authorization", "Bearer " + os.Getenv("LMS_TOKEN"))
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))
}Set a role's courses
AccessA signed-in user (the learner's own login token).
Replaces the role's course assignments, then updates everyone who holds the role:
- they are enrolled in newly added courses, if their organization has a license that includes the course and a free seat
- courses removed from a
WITHDRAWassignment are withdrawn from holders; withKEEPthey stay
The response counts how many enrollments were added and withdrawn, and how many couldn't be enrolled for lack of seats.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| idrequired | path | string (uuid) | The id from a previous response. |
Request body application/json · ReplaceAssignments
| Field | Type | Notes |
|---|---|---|
| assignmentsrequired | AssignmentInput[] | — |
Example request body
{
"assignments": [
{
"courseId": "4b2e8f90-1d73-4c5a-9e06-a8f1d3b7c254",
"dueAfterDays": 30,
"accessDays": 365,
"onRoleRemoved": "KEEP"
}
]
}Responses
Example response
{
"assignments": [
{
"accessDays": 1,
"courseId": "ecec91e5-4eb9-4c55-a6a7-b3c44ebe7561",
"dueAfterDays": 1,
"onRoleRemoved": "string"
}
],
"enrolled": 1,
"seatShortages": 1,
"withdrawn": 1
}Errors
| Status | When |
|---|---|
| 400 | A duplicate or unknown course id. |
| 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.
MEMBER_ROLE_ID=37386ae0-0ea5-44e0-a02e-161f807af560
curl -X PUT "$LMS_URL/api/v1/member-roles/$MEMBER_ROLE_ID/courses" \
-H "Authorization: Bearer $LMS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"assignments": [
{
"courseId": "4b2e8f90-1d73-4c5a-9e06-a8f1d3b7c254",
"dueAfterDays": 30,
"accessDays": 365,
"onRoleRemoved": "KEEP"
}
]
}'const LMS_URL = process.env.LMS_URL
const LMS_TOKEN = process.env.LMS_TOKEN
const memberRoleId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/member-roles/${memberRoleId}/courses`, {
method: 'PUT',
headers: { "Authorization": `Bearer ${LMS_TOKEN}`, 'Content-Type': 'application/json' },
body: JSON.stringify({
"assignments": [
{
"courseId": "4b2e8f90-1d73-4c5a-9e06-a8f1d3b7c254",
"dueAfterDays": 30,
"accessDays": 365,
"onRoleRemoved": "KEEP"
}
]
}),
})
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_TOKEN = process.env.LMS_TOKEN!
const memberRoleId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/member-roles/${memberRoleId}/courses`, {
method: 'PUT',
headers: { "Authorization": `Bearer ${LMS_TOKEN}`, 'Content-Type': 'application/json' },
body: JSON.stringify({
"assignments": [
{
"courseId": "4b2e8f90-1d73-4c5a-9e06-a8f1d3b7c254",
"dueAfterDays": 30,
"accessDays": 365,
"onRoleRemoved": "KEEP"
}
]
}),
})
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 = {"Authorization": "Bearer " + os.environ["LMS_TOKEN"]}
member_role_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
res = requests.put(f"{LMS_URL}/api/v1/member-roles/{member_role_id}/courses", headers=HEADERS, json={
"assignments": [
{
"courseId": "4b2e8f90-1d73-4c5a-9e06-a8f1d3b7c254",
"dueAfterDays": 30,
"accessDays": 365,
"onRoleRemoved": "KEEP",
},
],
}, 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 lmsToken = System.getenv("LMS_TOKEN");
String memberRoleId = "37386ae0-0ea5-44e0-a02e-161f807af560";
String body = """
{
"assignments": [
{
"courseId": "4b2e8f90-1d73-4c5a-9e06-a8f1d3b7c254",
"dueAfterDays": 30,
"accessDays": 365,
"onRoleRemoved": "KEEP"
}
]
}
""";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/member-roles/" + memberRoleId + "/courses"))
.header("Authorization", "Bearer " + lmsToken)
.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")
member_role_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
uri = URI("#{lms_url}/api/v1/member-roles/#{member_role_id}/courses")
request = Net::HTTP::Put.new(uri, "Authorization" => "Bearer " + ENV.fetch("LMS_TOKEN"), "Content-Type" => "application/json")
request.body = {
"assignments" => [
{
"courseId" => "4b2e8f90-1d73-4c5a-9e06-a8f1d3b7c254",
"dueAfterDays" => 30,
"accessDays" => 365,
"onRoleRemoved" => "KEEP",
},
],
}.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');
$memberRoleId = "37386ae0-0ea5-44e0-a02e-161f807af560";
$ch = curl_init("$lmsUrl/api/v1/member-roles/{$memberRoleId}/courses");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'PUT',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('LMS_TOKEN'), 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
"assignments" => [
[
"courseId" => "4b2e8f90-1d73-4c5a-9e06-a8f1d3b7c254",
"dueAfterDays" => 30,
"accessDays" => 365,
"onRoleRemoved" => "KEEP",
],
],
]),
]);
$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() {
memberRoleId := "37386ae0-0ea5-44e0-a02e-161f807af560"
body := strings.NewReader(`{
"assignments": [
{
"courseId": "4b2e8f90-1d73-4c5a-9e06-a8f1d3b7c254",
"dueAfterDays": 30,
"accessDays": 365,
"onRoleRemoved": "KEEP"
}
]
}`)
req, _ := http.NewRequest("PUT", os.Getenv("LMS_URL") + "/api/v1/member-roles/" + memberRoleId + "/courses", body)
req.Header.Set("Authorization", "Bearer " + os.Getenv("LMS_TOKEN"))
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))
}List products
AccessAdmin, or an API key with the read or write scope.
Lists products with the ids of the courses each contains.
Responses
Example response
[
{
"courseIds": [
"ecec91e5-4eb9-4c55-a6a7-b3c44ebe7561"
],
"createdAt": "2026-11-25T14:03:11Z",
"externalRef": "order-5001",
"id": "37386ae0-0ea5-44e0-a02e-161f807af560",
"name": "Acme Company",
"slug": "workplace-safety-essentials",
"status": "ACTIVE"
}
]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/products" \
-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/products`, {
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/products`, {
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/products", 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/products"))
.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/products")
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/products");
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/products", 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 a product
AccessAdmin, or an API key with the write scope.
A product is a named bundle of courses you sell. externalRef is optional and is meant for your store's SKU, so you can match a purchase to a product.
Products can't be edited yet; create a new one if the bundle changes.
Request body application/json · CreateProduct
| Field | Type | Notes |
|---|---|---|
| courseIdsrequired | string (uuid)[] | min 1 item |
| externalRef | string | — |
| namerequired | string | min length 1 |
| slugrequired | string | matches [a-z0-9][a-z0-9-]{0,100}; min length 1 |
Example request body
{
"slug": "complete-pack",
"name": "Complete Pack",
"externalRef": "SKU-COMPLETE",
"courseIds": [
"4b2e8f90-1d73-4c5a-9e06-a8f1d3b7c254"
]
}Responses
Example response
{
"courseIds": [
"ecec91e5-4eb9-4c55-a6a7-b3c44ebe7561"
],
"createdAt": "2026-11-25T14:03:11Z",
"externalRef": "order-5001",
"id": "37386ae0-0ea5-44e0-a02e-161f807af560",
"name": "Acme Company",
"slug": "workplace-safety-essentials",
"status": "ACTIVE"
}Errors
| Status | When |
|---|---|
| 400 | One or more courseIds don't exist. |
| 401 | Missing, invalid or expired credentials. |
| 403 | Your credential is valid but isn't allowed to do this. |
| 409 | The slug or externalRef is already in use. |
Errors use RFC 9457 problem details.
curl -X POST "$LMS_URL/api/v1/products" \
-H "X-API-Key: $LMS_KEY" \
-H "Content-Type: application/json" \
-d '{
"slug": "complete-pack",
"name": "Complete Pack",
"externalRef": "SKU-COMPLETE",
"courseIds": [
"4b2e8f90-1d73-4c5a-9e06-a8f1d3b7c254"
]
}'const LMS_URL = process.env.LMS_URL
const LMS_KEY = process.env.LMS_KEY
const res = await fetch(`${LMS_URL}/api/v1/products`, {
method: 'POST',
headers: { "X-API-Key": LMS_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
"slug": "complete-pack",
"name": "Complete Pack",
"externalRef": "SKU-COMPLETE",
"courseIds": [
"4b2e8f90-1d73-4c5a-9e06-a8f1d3b7c254"
]
}),
})
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/products`, {
method: 'POST',
headers: { "X-API-Key": LMS_KEY, 'Content-Type': 'application/json' },
body: JSON.stringify({
"slug": "complete-pack",
"name": "Complete Pack",
"externalRef": "SKU-COMPLETE",
"courseIds": [
"4b2e8f90-1d73-4c5a-9e06-a8f1d3b7c254"
]
}),
})
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.post(f"{LMS_URL}/api/v1/products", headers=HEADERS, json={
"slug": "complete-pack",
"name": "Complete Pack",
"externalRef": "SKU-COMPLETE",
"courseIds": [
"4b2e8f90-1d73-4c5a-9e06-a8f1d3b7c254",
],
}, 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 body = """
{
"slug": "complete-pack",
"name": "Complete Pack",
"externalRef": "SKU-COMPLETE",
"courseIds": [
"4b2e8f90-1d73-4c5a-9e06-a8f1d3b7c254"
]
}
""";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/products"))
.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")
uri = URI("#{lms_url}/api/v1/products")
request = Net::HTTP::Post.new(uri, "X-API-Key" => ENV.fetch("LMS_KEY"), "Content-Type" => "application/json")
request.body = {
"slug" => "complete-pack",
"name" => "Complete Pack",
"externalRef" => "SKU-COMPLETE",
"courseIds" => [
"4b2e8f90-1d73-4c5a-9e06-a8f1d3b7c254",
],
}.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');
$ch = curl_init("$lmsUrl/api/v1/products");
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([
"slug" => "complete-pack",
"name" => "Complete Pack",
"externalRef" => "SKU-COMPLETE",
"courseIds" => [
"4b2e8f90-1d73-4c5a-9e06-a8f1d3b7c254",
],
]),
]);
$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() {
body := strings.NewReader(`{
"slug": "complete-pack",
"name": "Complete Pack",
"externalRef": "SKU-COMPLETE",
"courseIds": [
"4b2e8f90-1d73-4c5a-9e06-a8f1d3b7c254"
]
}`)
req, _ := http.NewRequest("POST", os.Getenv("LMS_URL") + "/api/v1/products", 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))
}