Docs API reference
Authentication & tenants
Sign in, API keys, and creating tenants.
Every request acts for exactly one tenant, which comes from the credential: a login token or an API key. There is no tenant header to forge. See the Authentication guide for the full model.
7 endpoints · base path /api/v1
List API keys
AccessAdmin user only. API keys cannot do this.
Lists the tenant's API keys with their name, public prefix, scopes, expiry, last use and revocation time. The secret and its hash are never returned.
Responses
Example response
[
{
"createdAt": "2026-11-25T14:03:11Z",
"expiresAt": "2026-11-25T14:03:11Z",
"id": "37386ae0-0ea5-44e0-a02e-161f807af560",
"lastUsedAt": "2026-11-25T14:03:11Z",
"name": "Acme Company",
"prefix": "nbl_ab12cd34",
"revokedAt": "2026-11-25T14:03:11Z",
"scopes": [
"read",
"write"
]
}
]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/api-keys" \
-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/api-keys`, {
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/api-keys`, {
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/api-keys", 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/api-keys"))
.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/api-keys")
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/api-keys");
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/api-keys", 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 an API key
AccessAdmin user only. API keys cannot do this.
Creates a key for server-to-server use. scopes is a list drawn from read and write (write also allows reading). expiresAt is optional.
The full key is returned once, in secretKey (nbl_<prefix>.<secret>). Only a hash is stored, so it can't be shown again. Send it as the X-API-Key header.
Keys can't create or revoke other keys; that needs a signed-in admin.
Request body application/json · CreateRequest
| Field | Type | Notes |
|---|---|---|
| expiresAt | string (date-time) | — |
| namerequired | string | min length 1 |
| scopesrequired | string[] | items match read|write; min 1 item |
Example request body
{
"name": "Website checkout",
"scopes": [
"read",
"write"
]
}Responses
Example response
{
"key": {
"createdAt": "2026-11-25T14:03:11Z",
"expiresAt": "2026-11-25T14:03:11Z",
"id": "37386ae0-0ea5-44e0-a02e-161f807af560",
"lastUsedAt": "2026-11-25T14:03:11Z",
"name": "Acme Company",
"prefix": "nbl_ab12cd34",
"revokedAt": "2026-11-25T14:03:11Z",
"scopes": [
"read",
"write"
]
},
"secretKey": "nbl_ab12cd34.3q2…"
}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. |
Errors use RFC 9457 problem details.
curl -X POST "$LMS_URL/api/v1/api-keys" \
-H "Authorization: Bearer $LMS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Website checkout",
"scopes": [
"read",
"write"
]
}'const LMS_URL = process.env.LMS_URL
const LMS_TOKEN = process.env.LMS_TOKEN
const res = await fetch(`${LMS_URL}/api/v1/api-keys`, {
method: 'POST',
headers: { "Authorization": `Bearer ${LMS_TOKEN}`, 'Content-Type': 'application/json' },
body: JSON.stringify({
"name": "Website checkout",
"scopes": [
"read",
"write"
]
}),
})
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/api-keys`, {
method: 'POST',
headers: { "Authorization": `Bearer ${LMS_TOKEN}`, 'Content-Type': 'application/json' },
body: JSON.stringify({
"name": "Website checkout",
"scopes": [
"read",
"write"
]
}),
})
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/api-keys", headers=HEADERS, json={
"name": "Website checkout",
"scopes": [
"read",
"write",
],
}, 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 = """
{
"name": "Website checkout",
"scopes": [
"read",
"write"
]
}
""";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/api-keys"))
.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/api-keys")
request = Net::HTTP::Post.new(uri, "Authorization" => "Bearer " + ENV.fetch("LMS_TOKEN"), "Content-Type" => "application/json")
request.body = {
"name" => "Website checkout",
"scopes" => [
"read",
"write",
],
}.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/api-keys");
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([
"name" => "Website checkout",
"scopes" => [
"read",
"write",
],
]),
]);
$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(`{
"name": "Website checkout",
"scopes": [
"read",
"write"
]
}`)
req, _ := http.NewRequest("POST", os.Getenv("LMS_URL") + "/api/v1/api-keys", 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))
}Revoke an API key
AccessAdmin user only. API keys cannot do this.
Revokes a key immediately. Revoking an already revoked key is fine and returns 204 again.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| idrequired | path | string (uuid) | The id from a previous response. |
Responses
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.
API_KEY_ID=37386ae0-0ea5-44e0-a02e-161f807af560
curl -X DELETE "$LMS_URL/api/v1/api-keys/$API_KEY_ID" \
-H "Authorization: Bearer $LMS_TOKEN"const LMS_URL = process.env.LMS_URL
const LMS_TOKEN = process.env.LMS_TOKEN
const apiKeyId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/api-keys/${apiKeyId}`, {
method: 'DELETE',
headers: { "Authorization": `Bearer ${LMS_TOKEN}` },
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)const LMS_URL = process.env.LMS_URL!
const LMS_TOKEN = process.env.LMS_TOKEN!
const apiKeyId = "37386ae0-0ea5-44e0-a02e-161f807af560"
const res = await fetch(`${LMS_URL}/api/v1/api-keys/${apiKeyId}`, {
method: 'DELETE',
headers: { "Authorization": `Bearer ${LMS_TOKEN}` },
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)import os
import requests
LMS_URL = os.environ["LMS_URL"]
HEADERS = {"Authorization": "Bearer " + os.environ["LMS_TOKEN"]}
api_key_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
res = requests.delete(f"{LMS_URL}/api/v1/api-keys/{api_key_id}", 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 lmsToken = System.getenv("LMS_TOKEN");
String apiKeyId = "37386ae0-0ea5-44e0-a02e-161f807af560";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/api-keys/" + apiKeyId))
.header("Authorization", "Bearer " + lmsToken)
.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")
api_key_id = "37386ae0-0ea5-44e0-a02e-161f807af560"
uri = URI("#{lms_url}/api/v1/api-keys/#{api_key_id}")
request = Net::HTTP::Delete.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)<?php
$lmsUrl = getenv('LMS_URL');
$apiKeyId = "37386ae0-0ea5-44e0-a02e-161f807af560";
$ch = curl_init("$lmsUrl/api/v1/api-keys/{$apiKeyId}");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'DELETE',
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);
}package main
import (
"fmt"
"io"
"net/http"
"os"
)
func main() {
apiKeyId := "37386ae0-0ea5-44e0-a02e-161f807af560"
req, _ := http.NewRequest("DELETE", os.Getenv("LMS_URL") + "/api/v1/api-keys/" + apiKeyId, 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))
}
_ = data
}List the audit log
AccessAdmin, or an API key with the read or write scope.
The history of changes made through the API: who made each one (a signed-in user or an API key), what they did, which record it touched, and the request body with secrets removed. Newest first.
Every successful POST, PUT, PATCH and DELETE is recorded, including issuing learner tokens and creating licenses. Reads, failed requests and learners' own progress are not. Entries can't be edited or deleted.
Admins only: an API key can't read the log, so a leaked key can't be used to check what it was used for. Filter by entityType (the first part of the route, like organizations), entityId, actorId, action (contains match, like licenses), and a from/to time range.
Parameters
| Name | In | Type | Notes |
|---|---|---|---|
| entityType | query | string | — |
| entityId | query | string (uuid) | — |
| actorId | query | string (uuid) | — |
| action | query | string | — |
| from | query | string (date-time) | — |
| to | query | string (date-time) | — |
| limit | query | integer (int32) | — |
| offset | query | integer (int32) | — |
Responses
Example response
{
"items": [
{
"action": "string",
"actorId": "3c94fe17-180d-4ce7-aedf-8a62124da36b",
"actorType": "string",
"changes": {},
"entityId": "81693677-5a0d-4747-a284-49422f7ba84b",
"entityType": "string",
"id": "37386ae0-0ea5-44e0-a02e-161f807af560",
"ip": "string",
"occurredAt": "2026-11-25T14:03:11Z"
}
],
"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/audit-log?entityType=string&entityId=81693677-5a0d-4747-a284-49422f7ba84b" \
-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/audit-log?entityType=string&entityId=81693677-5a0d-4747-a284-49422f7ba84b`, {
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/audit-log?entityType=string&entityId=81693677-5a0d-4747-a284-49422f7ba84b`, {
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/audit-log?entityType=string&entityId=81693677-5a0d-4747-a284-49422f7ba84b", 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/audit-log?entityType=string&entityId=81693677-5a0d-4747-a284-49422f7ba84b"))
.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/audit-log?entityType=string&entityId=81693677-5a0d-4747-a284-49422f7ba84b")
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/audit-log?entityType=string&entityId=81693677-5a0d-4747-a284-49422f7ba84b");
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/audit-log?entityType=string&entityId=81693677-5a0d-4747-a284-49422f7ba84b", 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))
}Sign in
AccessPublic. The credentials are in the request body.
Exchanges an organisation code (your tenant's slug), an email and a password for a short-lived access token. Send it on later requests as Authorization: Bearer <token>.
Every failure returns the same 401: wrong password, unknown email, unknown organisation, suspended account. The endpoint can't be used to discover who has an account.
Tokens last one hour (expiresInSeconds). There are no refresh tokens yet, so sign in again when one expires.
Request body application/json · LoginRequest
| Field | Type | Notes |
|---|---|---|
| emailrequired | string | min length 1 |
| passwordrequired | string | min length 1 |
| tenantrequired | string | min length 1 |
Example request body
{
"email": "maya.chen@example.com",
"password": "a long, unique passphrase",
"tenant": "acme"
}Responses
Example response
{
"accessToken": "eyJhbGciOiJIUzI1NiJ9…",
"expiresInSeconds": 3600
}Errors
| Status | When |
|---|---|
| 400 | The request was malformed or failed validation. errors lists each field. |
| 401 | Invalid credentials. The message is deliberately identical for every kind of failure. |
Errors use RFC 9457 problem details.
curl -X POST "$LMS_URL/api/v1/auth/login" \
-H "Content-Type: application/json" \
-d '{
"email": "maya.chen@example.com",
"password": "a long, unique passphrase",
"tenant": "acme"
}'const LMS_URL = process.env.LMS_URL
const res = await fetch(`${LMS_URL}/api/v1/auth/login`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
"email": "maya.chen@example.com",
"password": "a long, unique passphrase",
"tenant": "acme"
}),
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)
const data = await res.json()const LMS_URL = process.env.LMS_URL!
const res = await fetch(`${LMS_URL}/api/v1/auth/login`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
"email": "maya.chen@example.com",
"password": "a long, unique passphrase",
"tenant": "acme"
}),
})
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"]
res = requests.post(f"{LMS_URL}/api/v1/auth/login", json={
"email": "maya.chen@example.com",
"password": "a long, unique passphrase",
"tenant": "acme",
}, 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 body = """
{
"email": "maya.chen@example.com",
"password": "a long, unique passphrase",
"tenant": "acme"
}
""";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/auth/login"))
.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/auth/login")
request = Net::HTTP::Post.new(uri, "Content-Type" => "application/json")
request.body = {
"email" => "maya.chen@example.com",
"password" => "a long, unique passphrase",
"tenant" => "acme",
}.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/auth/login");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
"email" => "maya.chen@example.com",
"password" => "a long, unique passphrase",
"tenant" => "acme",
]),
]);
$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(`{
"email": "maya.chen@example.com",
"password": "a long, unique passphrase",
"tenant": "acme"
}`)
req, _ := http.NewRequest("POST", os.Getenv("LMS_URL") + "/api/v1/auth/login", body)
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))
}Who am I?
AccessAny signed-in user or API key.
Returns the tenant the credential belongs to, whether the caller is a USER or an API_KEY, its id, and its authorities (for example ROLE_ADMIN or SCOPE_write). A quick way to check that a key works and what it may do.
Responses
Example response
{
"authorities": [
"string"
],
"id": "37386ae0-0ea5-44e0-a02e-161f807af560",
"tenantId": "672af6a0-5fa6-44a0-a3ab-2c5fc28d9e20",
"type": "USER"
}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/auth/me" \
-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/auth/me`, {
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/auth/me`, {
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/auth/me", 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/auth/me"))
.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/auth/me")
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/auth/me");
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/auth/me", 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 tenant
AccessPlatform token, sent as X-Platform-Token.
Operator-level endpoint that creates a new tenant together with its first administrator. It is guarded by a static platform token sent as X-Platform-Token. If the server has no PLATFORM_TOKEN configured, this endpoint does not exist and returns 404.
slug is the tenant's login code: lowercase letters, digits and dashes. The admin password must be at least 10 characters.
Request body application/json · CreateTenantRequest
| Field | Type | Notes |
|---|---|---|
| adminEmailrequired | string (email) | min length 1 |
| adminFamilyNamerequired | string | min length 1 |
| adminGivenNamerequired | string | min length 1 |
| adminPasswordrequired | string | min length 10; max length 200 |
| namerequired | string | min length 1 |
| slugrequired | string | matches [a-z0-9][a-z0-9-]{1,62}; min length 1 |
Example request body
{
"adminEmail": "string",
"adminFamilyName": "string",
"adminGivenName": "string",
"adminPassword": "string",
"name": "Acme Company",
"slug": "workplace-safety-essentials"
}Responses
Example response
{
"adminUserId": "5400b7fa-3e2a-4dda-a34a-aa6505e50532",
"tenantId": "672af6a0-5fa6-44a0-a3ab-2c5fc28d9e20"
}Errors
| Status | When |
|---|---|
| 400 | The request was malformed or failed validation. errors lists each field. |
| 401 | The platform token is missing or wrong. |
| 404 | The server has no platform token configured, so tenant creation is switched off. |
| 409 | That slug is already taken. |
Errors use RFC 9457 problem details.
curl -X POST "$LMS_URL/api/v1/platform/tenants" \
-H "X-Platform-Token: $PLATFORM_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"adminEmail": "string",
"adminFamilyName": "string",
"adminGivenName": "string",
"adminPassword": "string",
"name": "Acme Company",
"slug": "workplace-safety-essentials"
}'const LMS_URL = process.env.LMS_URL
const PLATFORM_TOKEN = process.env.PLATFORM_TOKEN
const res = await fetch(`${LMS_URL}/api/v1/platform/tenants`, {
method: 'POST',
headers: { "X-Platform-Token": PLATFORM_TOKEN, 'Content-Type': 'application/json' },
body: JSON.stringify({
"adminEmail": "string",
"adminFamilyName": "string",
"adminGivenName": "string",
"adminPassword": "string",
"name": "Acme Company",
"slug": "workplace-safety-essentials"
}),
})
if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)
const data = await res.json()const LMS_URL = process.env.LMS_URL!
const PLATFORM_TOKEN = process.env.PLATFORM_TOKEN!
const res = await fetch(`${LMS_URL}/api/v1/platform/tenants`, {
method: 'POST',
headers: { "X-Platform-Token": PLATFORM_TOKEN, 'Content-Type': 'application/json' },
body: JSON.stringify({
"adminEmail": "string",
"adminFamilyName": "string",
"adminGivenName": "string",
"adminPassword": "string",
"name": "Acme Company",
"slug": "workplace-safety-essentials"
}),
})
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-Platform-Token": os.environ["PLATFORM_TOKEN"]}
res = requests.post(f"{LMS_URL}/api/v1/platform/tenants", headers=HEADERS, json={
"adminEmail": "string",
"adminFamilyName": "string",
"adminGivenName": "string",
"adminPassword": "string",
"name": "Acme Company",
"slug": "workplace-safety-essentials",
}, 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 platformToken = System.getenv("PLATFORM_TOKEN");
String body = """
{
"adminEmail": "string",
"adminFamilyName": "string",
"adminGivenName": "string",
"adminPassword": "string",
"name": "Acme Company",
"slug": "workplace-safety-essentials"
}
""";
var request = HttpRequest.newBuilder(URI.create(lmsUrl + "/api/v1/platform/tenants"))
.header("X-Platform-Token", platformToken)
.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/platform/tenants")
request = Net::HTTP::Post.new(uri, "X-Platform-Token" => ENV.fetch("PLATFORM_TOKEN"), "Content-Type" => "application/json")
request.body = {
"adminEmail" => "string",
"adminFamilyName" => "string",
"adminGivenName" => "string",
"adminPassword" => "string",
"name" => "Acme Company",
"slug" => "workplace-safety-essentials",
}.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/platform/tenants");
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['X-Platform-Token: ' . getenv('PLATFORM_TOKEN'), 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => json_encode([
"adminEmail" => "string",
"adminFamilyName" => "string",
"adminGivenName" => "string",
"adminPassword" => "string",
"name" => "Acme Company",
"slug" => "workplace-safety-essentials",
]),
]);
$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(`{
"adminEmail": "string",
"adminFamilyName": "string",
"adminGivenName": "string",
"adminPassword": "string",
"name": "Acme Company",
"slug": "workplace-safety-essentials"
}`)
req, _ := http.NewRequest("POST", os.Getenv("LMS_URL") + "/api/v1/platform/tenants", body)
req.Header.Set("X-Platform-Token", os.Getenv("PLATFORM_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))
}