Docs Start here

Quickstart

Put courses in your own app and track your users' progress. No backend to build.

No BS LMS is the backend for learning: courses, lessons, quizzes, progress and certificates. You make the courses in the admin, and your app talks to us over a simple API to show them and track progress.

1. Build your content#

Sign in to the admin and create a course: add sections, lessons and quizzes, then press Publish. Nothing to code. Each course has an address (a short name like safety-101, shown in the course list) that you’ll use below.

2. Create an API key#

In the admin, open Developers, press Create key, choose Read and change, and copy the key. It is shown once.

Your key is a secret, like a password. Keep it on your server (an environment variable or your secrets manager), never in a browser, a mobile app or git. Your server also needs your API address, which is the URL you use to reach us.

LMS_URL=https://api.nobslms.app
LMS_KEY=nbl_xxxxxxxx.xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

3. Start a learner, from your server#

When one of your users opens a course, ask us to start them. Send who they are (use your own id for them, so the same person always lands on the same learner) and which courses they should have. We create them, enrol them, and send back a token your app uses to show them their course. It’s safe to call every time.

const LMS_URL = process.env.LMS_URL
const LMS_KEY = process.env.LMS_KEY

async function lms(method, path, body) {
  const res = await fetch(`${LMS_URL}/api/v1${path}`, {
    method,
    headers: { 'X-API-Key': LMS_KEY, 'Content-Type': 'application/json' },
    body: body && JSON.stringify(body),
  })
  if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)
  return res.json()
}

// Call this when one of your users opens a course.
export function startLearner(user, courses) {
  return lms('POST', `/learners/${user.id}/session`, {
    email: user.email, givenName: user.firstName, familyName: user.lastName, courses,
  }) // { learnerId, accessToken, expiresInSeconds }
}

You get back learnerId and an accessToken. Give the token to your front end. It can only act as that one person and it lasts an hour; call again for a fresh one.

4. Show the course in your app#

Now the person’s own experience, using the token from step 3: their courses, the lesson menu, a lesson’s content, progress, and finishing. In a single-page app these calls run in the browser. If you render pages on your server, run them there. Add this to the same file as step 3.

async function asLearner(token, method, path, body) {
  const res = await fetch(`${LMS_URL}/api/v1${path}`, {
    method,
    headers: { Authorization: `Bearer ${token}`, 'Content-Type': 'application/json' },
    body: body && JSON.stringify(body),
  })
  if (!res.ok) throw new Error(`${res.status} ${await res.text()}`)
  return res.status === 204 ? null : res.json()
}

// Show the course, open the first lesson, report progress, finish it.
export async function learn(token) {
  const [{ id: enrollment }] = await asLearner(token, 'GET', '/me/enrollments')        // their courses
  const course = await asLearner(token, 'GET', `/me/enrollments/${enrollment}/course`) // the menu: sections, lessons, done or locked
  const lessonId = course.modules[0].lessons[0].id
  const base = `/me/enrollments/${enrollment}/lessons/${lessonId}`

  const lesson = await asLearner(token, 'GET', base)                                   // content blocks to render; starts the lesson
  await asLearner(token, 'PUT', `${base}/progress`, { secondsSpent: 30, resumeState: { position: 142 } }) // heartbeat
  await asLearner(token, 'POST', `${base}/complete`)
  return { course, lesson }
}

A quiz#

A quiz is a block inside a lesson. Start an attempt, collect answers, submit. Questions arrive without their answers. Every question type has its own answer shape: Quizzes and questions.

export async function takeQuiz(token) {
  const [{ id: enrollment }] = await asLearner(token, 'GET', '/me/enrollments')
  const course = await asLearner(token, 'GET', `/me/enrollments/${enrollment}/course`)
  const quizLesson = course.modules.flatMap((m) => m.lessons).find((l) => l.completionMode === 'ASSESSMENT_PASSED')
  const { blocks } = await asLearner(token, 'GET', `/me/enrollments/${enrollment}/lessons/${quizLesson.id}`)
  const assessment = blocks.find((b) => b.type === 'ASSESSMENT').assessment

  const attempt = await asLearner(token, 'POST', `/me/enrollments/${enrollment}/assessments/${assessment.id}/attempts`)
  // render attempt.questions, then send one response per question in the shape its type expects
  const answers = [{ questionId: attempt.questions[0].id, response: { value: false } }]
  return asLearner(token, 'POST', `/me/enrollments/${enrollment}/attempts/${attempt.id}/submit`, { answers })
  // { status: 'GRADED', passed: true, scorePercent: 100 }
}

Passing completes the lesson. Finishing everything completes the course and issues the certificate (GET /me/certificates).

5. Show their courses and progress in your own screens#

Back on your server with the key. One call returns everything for a “my courses” screen or a dashboard, using your own id for the user. Add it to the same file as step 3.

export async function progress(userId) {
  const courses = await lms('GET', `/learners/${userId}/courses`)
  return courses.map((c) => ({ course: c.title, status: c.status, percent: c.progressPercent }))
}

Each course has its title, summary, status, progressPercent, dates, and a certificateId once finished. For one course in full (every lesson with time spent, every quiz attempt with its score) use GET /learners/{id}/courses/{course}. Rather than poll, have us call you when something happens, such as enrollment.completed: Webhooks.

Next#

Type to search guides and every endpoint.