1. Overview
- Create an exam (
POST /exams) and its questions (POST /questions/bulk). - Attach the questions (
POST /exams/:id/questions) and publish (PATCH /exams/:idwithisPublished: true). - Enrol candidates (
POST /candidates/bulk). Each gets a PIN and alaunchUrlinto our hosted exam room, or run attempts in your own interface (section 6). - 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 asx-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
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
}POST /exams. Send startsAt: null to remove a schedule. Question lists and totals can't be set here.Request body
{ "isPublished": true }Request body
{ "questionIds": ["q_...", "q_..."] }409: unpublish it instead.Response
{ "id": "...", "accessCode": "MTH-JSS2", "title": "...", "durationMins": 60,
"totalQuestions": 40, "totalMarks": 40, "isPublished": true,
"startsAt": null, "endsAt": null, "accessType": "ACCESS_CODE", "instructions": "..." }4. Questions
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_...", ... } ] }Request body
{ "marks": 2 }5. Candidates
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&..." } ]examId).6. Taking an exam
Send candidates to the launchUrl, or run the attempt in your own interface with these endpoints.
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": {} }Request body
{ "questionId": "q_...", "selectedVal": "b" }
// MULTI_SELECT: ["a","c"] essays: the text also accepted: { "selected": "b" }eventId counts once. At maxTabViolations the attempt locks.Request body
{ "eventType": "tab_switch", "eventId": "unique-per-event" }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 } } }Response
{ "status": "in_progress", "deadline": "...", "violations": 0, "serverNow": "..." }7. Results & invigilation
exam.attempt.graded webhook is sent.Request body
{ "answers": [ { "questionId": "q_3", "marksAwarded": 4, "feedback": "Good use of key terms." } ],
"comment": "Well done overall." }Request body
{ "minutes": 5 }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.
| 400 | The request needs correcting (for example a question with no correct option). |
| 401 | Missing or invalid API key, or attempt token. |
| 403 | Not allowed now: exam not open, closed, registered candidates only, or another workspace. |
| 404 | Not found, or not in your workspace. |
| 409 | Conflicts with the current state: code taken, attempt already submitted or locked. |
| 503 | Temporarily unavailable. Retry with backoff; the body includes retryable: true. |