ParaLearn CBT Developer API

Create exams and question banks, enrol candidates, run attempts in your own interface or ours, and receive marked results through signed webhooks.

Base URL: https://cbt.pln.ng/api/cbt
Format: JSON over HTTPS

1. Overview

  1. Create an exam (POST /exams) and its questions (POST /questions/bulk).
  2. Attach the questions (POST /exams/:id/questions) and publish (PATCH /exams/:id with isPublished: true).
  3. Enrol candidates (POST /candidates/bulk). Each gets a PIN and a launchUrl into our hosted exam room, or run attempts in your own interface (section 6).
  4. Receive each result by webhook when it is submitted, and again once essays are marked.

Times are ISO 8601 in UTC. Exams only accept candidates while published, inside their startsAt–endsAt window, and once they have questions.

2. Authentication

Sign in to your workspace and open Settings & API keys to copy or rotate your key. Send it on every examiner request:

Authorization: Bearer pln_live_sk_...
# or
x-api-key: pln_live_sk_...
  • A key only reaches its own workspace. Another workspace's exams, questions, candidates and attempts return 404.
  • Candidate requests (answer, report, submit, slip) use the attempt token returned by POST /attempts/start, sent as x-attempt-token. Your API key also works for attempts in your exams.
  • Keep keys on your server. Never ship them in a browser or mobile app.

3. Exams

POST/exams
API key
Creates an exam in your workspace. Returns the exam (201); a taken access code returns 409.

Request body

{
  "title": "JSS2 Mathematics Mid-Term",
  "accessCode": "MTH-JSS2",          // optional; generated if omitted, must be unique
  "durationMins": 60,                // 1–600
  "startsAt": "2026-11-02T08:00:00Z",// optional window
  "endsAt": "2026-11-02T12:00:00Z",
  "accessType": "ACCESS_CODE",       // or "ROSTER_ONLY": enrolled candidates with their PIN only
  "instructions": "Answer all questions.",
  "maxTabViolations": 3,             // 1–20; the attempt locks when reached
  "shuffleQuestions": true,          // per candidate, stable on rejoin
  "shuffleChoices": true,            // true/false questions keep their order
  "showResultAfter": true,           // false: candidates see "results released later"
  "isPublished": false
}
GET/exams
API key
Lists your exams.
GET/exams/:id
API key
The exam with its questions, including answer keys.
PATCH/exams/:id
API key
Updates any setting from POST /exams. Send startsAt: null to remove a schedule. Question lists and totals can't be set here.

Request body

{ "isPublished": true }
POST/exams/:id/questions
API key
Sets the exam's questions, in order (replaces the list; repeats are ignored). Total marks follow from the questions. Only your own questions are accepted.

Request body

{ "questionIds": ["q_...", "q_..."] }
DELETE/exams/:id
API key
Deletes an exam nobody has taken. One with attempts returns 409: unpublish it instead.
GET/exams/code/:accessCode
Public
What a candidate sees in the lobby. Contains no questions.

Response

{ "id": "...", "accessCode": "MTH-JSS2", "title": "...", "durationMins": 60,
  "totalQuestions": 40, "totalMarks": 40, "isPublished": true,
  "startsAt": null, "endsAt": null, "accessType": "ACCESS_CODE", "instructions": "..." }

4. Questions

POST/questions/bulk
API key

Types: MCQ and TRUE_FALSE (exactly one correct option), MULTI_SELECT (one or more), SHORT_ESSAY and LONG_ESSAY (marked by the examiner). Objective questions need at least two options with text; options without an id get one. Every question is checked before any is saved; a problem returns 400 naming the question.

Optional: section, explanation, minWords, maxWords, modelAnswer, keyTerms, rubric. Model answers and key terms are never sent to candidates.

Request body

{
  "questions": [
    { "prompt": "2 + 2 = ?", "type": "MCQ", "marks": 1,
      "options": [ { "id": "a", "text": "3" }, { "id": "b", "text": "4", "isCorrect": true } ] },
    { "prompt": "Pick the prime numbers", "type": "MULTI_SELECT", "marks": 2,
      "options": [ { "text": "2", "isCorrect": true }, { "text": "4" }, { "text": "5", "isCorrect": true } ] },
    { "prompt": "Explain photosynthesis.", "type": "SHORT_ESSAY", "marks": 5,
      "minWords": 20, "maxWords": 100, "modelAnswer": "...", "keyTerms": ["chlorophyll", "light"] }
  ]
}

Response

{ "count": 3, "questions": [ { "id": "q_...", ... } ] }
POST/questions
API key
Creates one question (same fields as one item above).
PATCH/questions/:id
API key
Changes only the fields you send. Changing a question re-marks the submitted attempts of every exam using it, so a corrected answer key applies to results already in.

Request body

{ "marks": 2 }

5. Candidates

POST/candidates/bulk
API key
Enrols candidates and issues each a unique PIN (or uses the candidatePin you send). The studentId you set here is the only one recorded on results; candidates can't supply their own.

Request body

{
  "examId": "exam_...",
  "candidates": [
    { "candidateName": "Amara Obi", "studentId": "STU-0042", "email": "amara@example.com",
      "externalAttemptId": "your-attempt-ref", "metadata": { "class": "JSS2A" } }
  ]
}

Response

[ { "id": "cand_...", "candidateName": "Amara Obi", "candidatePin": "482913",
    "launchUrl": "https://cbt.pln.ng/take/MTH-JSS2?pin=482913&name=Amara%20Obi&..." } ]
POST/candidates
API key
Enrols one candidate (same fields as one item above, plus examId).
GET/candidates?examId=...
API key
The exam's roster with status and scores.
DELETE/candidates/:id
API key
Removes a candidate; their PIN stops working. Results already submitted are kept.

6. Taking an exam

Send candidates to the launchUrl, or run the attempt in your own interface with these endpoints.

POST/attempts/start
Public

Starts the attempt, or resumes a running one for the same PIN (a walk-in must also give the same name). Questions arrive without answer keys, in this attempt's order. Keep attemptToken: it authorises the calls below.

Refusals: 403 exam not published, not yet open, closed, or registered candidates only; 404 unknown code or PIN; 409 already submitted, locked, or no questions yet.

Request body

{ "accessCode": "MTH-JSS2", "candidateName": "Amara Obi",
  "candidatePin": "482913",          // enrolled candidates; omit for a walk-in
  "externalAttemptId": "your-attempt-ref" }

Response

{ "attemptId": "att_...", "attemptToken": "...", "candidatePin": "482913",
  "deadline": "2026-11-02T09:00:00Z", "serverNow": "...", "isResumed": false,
  "showResultAfter": true, "maxTabViolations": 3,
  "questions": [ { "id": "q_...", "prompt": "...", "type": "MCQ", "marks": 1,
                   "options": [ { "id": "b", "text": "4" } ] } ],
  "restoredAnswers": {} }
POST/attempts/:id/answer
Attempt token
Saves one answer while the attempt is running (accepted until 2 minutes past the deadline).

Request body

{ "questionId": "q_...", "selectedVal": "b" }
// MULTI_SELECT: ["a","c"]   essays: the text   also accepted: { "selected": "b" }
POST/attempts/:id/telemetry
Attempt token
Records a tab switch. Repeating an eventId counts once. At maxTabViolations the attempt locks.

Request body

{ "eventType": "tab_switch", "eventId": "unique-per-event" }
POST/attempts/:id/submit
Attempt token

Marks the attempt. Objective answers are all-or-nothing; essays wait for the examiner (gradingStatus: "PENDING_REVIEW"). Submitting again returns the same result. A submission from an offline device that arrives after the deadline is accepted and flagged as synced late.

With showResultAfter: false the score fields come back as null with resultsWithheld: true.

Request body

{ "finalAnswers": { "q_1": "b", "q_2": ["a","c"], "q_3": "Photosynthesis is..." },
  "submittedAt": "2026-11-02T08:55:10Z" }

Response

{ "status": "SUBMITTED", "gradingStatus": "AUTO_SCORED", "score": 32, "totalMarks": 40,
  "percentage": 80, "grade": "A1", "alreadySubmitted": false,
  "resultSlip": { "breakdown": { "correctCount": 32, "wrongCount": 6, "unansweredCount": 2,
                                  "mcqScore": 32, "essayScore": 0 } } }
GET/attempts/:id/slip
Attempt token
The result slip for a finished attempt.
GET/attempts/:id/status
Attempt token
Poll this while the attempt runs to pick up extra time or a lock.

Response

{ "status": "in_progress", "deadline": "...", "violations": 0, "serverNow": "..." }

7. Results & invigilation

GET/exams/:id/monitor
API key
Everyone on the exam: progress, tab switches, status and scores.
GET/attempts/:id/review
API key
A submitted attempt's full answer sheet with marking.
POST/attempts/:id/manual-grade
API key
Marks essays (clamped to each question's marks). Feedback appears on the candidate's slip. When the last essay is marked, the exam.attempt.graded webhook is sent.

Request body

{ "answers": [ { "questionId": "q_3", "marksAwarded": 4, "feedback": "Good use of key terms." } ],
  "comment": "Well done overall." }
POST/attempts/:id/extend
API key
Gives a running attempt extra time (1–240 minutes).

Request body

{ "minutes": 5 }
POST/attempts/:id/reinstate
API key
Reopens an attempt locked for tab switching (answers kept, count reset, at least 5 minutes left). The candidate rejoins with their name and PIN.
GET/sync/export-csv/:examId
API key
Results as a CSV file.

8. Webhooks

Set a public https:// URL in Settings. We POST exam.attempt.completed when an attempt is first submitted and exam.attempt.graded when its essays have all been marked. Headers: x-cbt-event, x-cbt-event-id, x-cbt-timestamp and x-cbt-signature (sha256= HMAC-SHA256 of the raw body with your webhook secret).

// Node.js (Express): verify before trusting the payload
const crypto = require("crypto");

app.post("/cbt-webhook", express.raw({ type: "application/json" }), (req, res) => {
  const expected = "sha256=" + crypto
    .createHmac("sha256", process.env.CBT_WEBHOOK_SECRET)
    .update(req.body)                       // the raw bytes, not re-serialised JSON
    .digest("hex");
  const given = req.get("x-cbt-signature") || "";
  const ok = given.length === expected.length &&
    crypto.timingSafeEqual(Buffer.from(given), Buffer.from(expected));
  if (!ok) return res.status(401).end();

  const event = JSON.parse(req.body);      // event.event, event.attemptId, event.score, ...
  res.status(200).end();
});
{
  "event": "exam.attempt.completed",
  "eventId": "evt_...",
  "timestamp": "2026-11-02T08:55:11Z",
  "examId": "exam_...", "examCode": "MTH-JSS2",
  "attemptId": "att_...", "externalAttemptId": "your-attempt-ref",
  "studentId": "STU-0042", "candidateName": "Amara Obi", "candidatePin": "482913",
  "status": "SUBMITTED", "gradingStatus": "AUTO_SCORED",
  "score": 32, "totalMarks": 40, "percentage": 80, "grade": "A1",
  "startedAt": "...", "submittedAt": "...",
  "resultSlip": { "breakdown": { "correctCount": 32, "wrongCount": 6, "unansweredCount": 2 } },
  "metadata": { "class": "JSS2A" }
}

9. Errors

Errors return { "message": "..." } with a message you can show to users.

400The request needs correcting (for example a question with no correct option).
401Missing or invalid API key, or attempt token.
403Not allowed now: exam not open, closed, registered candidates only, or another workspace.
404Not found, or not in your workspace.
409Conflicts with the current state: code taken, attempt already submitted or locked.
503Temporarily unavailable. Retry with backoff; the body includes retryable: true.