Docs Guides

Authentication

Login tokens for people, API keys for servers, and what each may do.

There are two kinds of credential. Both identify exactly one tenant; you never send a tenant id on requests.

Login token API key
For A person using your app Your backend
Header Authorization: Bearer <token> X-API-Key: nbl_<prefix>.<secret>
Lifetime 1 hour Until revoked or expiresAt
Permissions The person’s platform role Scopes: read, write

Signing a person in#

curl -X POST "$LMS_URL/api/v1/auth/login" \
  -H "Content-Type: application/json" \
  -d '{
  "tenant": "acme",
  "email": "ada@acme.example",
  "password": "a-long-password"
}'
{ "accessToken": "eyJ...", "expiresInSeconds": 3600 }

Every failure returns the same 401, so the endpoint can’t be used to find out who has an account. There are no refresh tokens yet: sign in again when the token expires.

API keys#

Create one as a signed-in admin with POST /api-keys. The full key is returned once; only a hash is stored.

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"
  ]
}'

Important

Keep keys on your server. Never ship one in a browser or mobile app. A key can’t create or revoke other keys, and it can’t call the learner (/me) endpoints directly because those belong to a person. To act for one of your users, ask for a learner token (next section).

Acting for your own users#

If your application has its own users, you don’t give them LMS passwords. When one of them opens a course, your server uses its API key to call POST /learners/{your-user-id}/session. That creates or updates the person, enrols them in the courses you list, and returns a token that lasts an hour and can only act as that one person. Your front end uses the token for the learner API.

Tokens are only issued for active accounts whose only role is LEARNER, so a key can never act as an admin or instructor. The Quickstart walks through it.

Platform roles#

Role May
ADMIN Everything in the tenant.
INSTRUCTOR Read content, grade essays, view progress.
LEARNER Use the learner API for their own enrollments.

Organization managers can additionally invite people to, and see the progress of, their own organization. Each endpoint’s Access line in the reference says exactly who may call it.

Checking a credential#

GET /auth/me returns the tenant, the kind of credential, its id and its authorities.

Type to search guides and every endpoint.