Install our app for a better experience!

Testing Center API — Reference

Testing Center API — Reference

Let your student information system (SIS) give students a PrepareBuddy test by your own student ID, with no registration, and get the results back by webhook or by polling.

Not a developer? Start with the setup guide — it walks through the same flow with Postman and no code. Every request below is also in our Postman collection (Postman → Import → Link).

The flow

An assessment is a Testing Center sitting that has an assessment ID, a name you choose. Create it once (in PrepareBuddy, or with POST /assessments/ below), then send students to it as often as you like.

SIS                                              PrepareBuddy
 │  GET  /api/v1/ping/                            │  1. is the key valid? (404 = wrong base URL)
 │  GET  /api/v1/testing-center/tests/            │  2. which tests may I use? → test_id
 │  POST /api/v1/testing-center/assessments/      │  3. create the assessment (once)
 │  {"assessment_id":"A1","test_id":412}          │
 │ ─────────────────────────────────────────────▶ │
 │                                                │
 │  POST /api/v1/testing-center/attempts/         │  4. per student
 │  {"student_id":"00001","assessment_id":"A1"}   │
 │  {"student_id":"00001","assessment_id":"A1"}   │
 │ ─────────────────────────────────────────────▶ │  creates (or returns) the attempt
 │ ◀───────────────────────────────────────────── │  {"attempt": {"attempt_id", "assessment_url", …}}
 │                                                │
 │  send assessment_url to the student            │
 │  (email / SMS / your portal)                   │
 │                                   student ───▶ │  opens link → presses Start → takes the test
 │                                                │
 │ ◀───────────────────────────────────────────── │  webhook attempt.completed  (Option A: push)
 │  GET /api/v1/testing-center/attempts/{id}/     │
 │ ─────────────────────────────────────────────▶ │  (Option B: pull, any time)

Each attempt is an ordinary Testing Center candidate, so everything an organiser configures on the sitting applies: the test (or pool), the window, exam conditions, Safe Exam Browser, release policy (instant or examiner review), examiner adjustments, certificates and billing.

Basics

Base URL https://www.preparebuddy.com/api/v1/testing-center/ — or your organization's own PrepareBuddy address. Always include www.; requests must not be redirected.
Authentication Your organization's API key in X-API-Key: <key> (or Authorization: Bearer <key>). Creating, cancelling and re-linking need a Full access key; a Read only key can use every GET. Keys are created under Organization dashboard → API Keys & Integrations.
Format JSON in, JSON out. Send Content-Type: application/json on POST.
Times ISO 8601 with offset, in UTC (e.g. 2026-10-16T14:30:00+00:00).
Scope A key only ever sees its own organization's sittings, students and attempts.

Checking your setup: GET /api/v1/ping/

Not under /testing-center/. Call it first.

{ "status": "ok", "organization": "Your School", "organization_slug": "your-school",
  "access": "full", "assessments": 1 }

access is full or read_only; assessments is how many sittings have an assessment ID; testing_center_enabled is false when the Testing Center is not switched on for your organization, in which case you cannot create assessments. A 404 on this call means your base URL is wrong (most often /api/v1/ appears twice). A 401 means the key is wrong.

IDs

student_id and assessment_id are your identifiers: 1–64 characters, letters, digits and . _ - / : @ # +, starting with a letter or digit, no spaces. They are case-sensitive. A number such as 12345 is accepted and returned as the string "12345".

An assessment ID is a name you choose. Create the sitting with POST /assessments/, or an organiser sets it in PrepareBuddy (in the Conduct a test wizard, or on the sitting's page under Connect your student system). One ID points to one sitting at a time. Until one exists, GET /assessments/ is empty and POST /attempts/ answers unknown_assessment.

attempt_id is ours: a UUID that never changes. Store it next to your student record.

Errors

Every error has the same shape:

{ "status": "error", "code": "assessment_closed", "error": "The sitting for \"A1\" closed on 2026-10-31 18:00 and no longer accepts new students. An organiser can extend it on the sitting's page." }

Branch on code; show error to a person. Every error says what to do next.

Empty answers explain themselves. A list that comes back empty is not an error, but it carries a hint saying why and what to do: no assessments yet, no attempts yet, no test matching your filters, or no tests available to your organization.

HTTP code Meaning
400 invalid_json, invalid_body The body is not a JSON object.
400 invalid_student_id, invalid_assessment_id Missing, or breaks the ID rules above.
400 invalid_student_name, invalid_group, invalid_new_attempt An optional field has the wrong type.
400 invalid_status, invalid_limit, invalid_cursor A list filter is wrong.
400 invalid_test_id, invalid_results, invalid_opens_at, invalid_closes_at, invalid_window, invalid_name, nothing_to_change A field of POST / PATCH /assessments/ is wrong or missing.
401 missing_api_key No key was sent. Add the X-API-Key header.
401 invalid_api_key The key is not valid: copied incompletely, extra spaces or quotes, or from a different PrepareBuddy address.
401 revoked_api_key The key was revoked. Create a new one.
403 read_only_key A read-only key tried to create or change something. Use a Full access key.
403 testing_center_not_enabled The Testing Center is not switched on for your organization (POST /assessments/). Ask PrepareBuddy support.
404 unknown_endpoint The address does not exist. Most often /api/v1/ appears twice because the base URL was set to more than https://www.preparebuddy.com. Returned as JSON, with a hint in error.
404 unknown_assessment No sitting in your organization has that assessment ID.
404 unknown_test test_id is not a test your organization can use (see GET /tests/).
404 unknown_attempt No attempt with that attempt_id in your organization.
404 unknown_student No attempts were ever created for that student_id.
409 assessment_id_taken Another sitting in your organization already has that assessment ID.
409 assessment_closed The sitting's window has closed; it takes no new students.
409 attempt_open new_attempt was requested while the previous attempt is unfinished. The body includes that attempt.
409 cannot_cancel Only a not_started attempt can be cancelled. Body includes the attempt.
409 cannot_reissue A finished attempt cannot get a new link. Body includes the attempt.
409 student_account_locked An administrator changed this student's PrepareBuddy account (gave it a password or email, or deactivated it), so no link can be issued. Contact support.
409 reference_in_use, cannot_issue The sitting's roster already holds this student ID twice by hand. Rare; an organiser can tidy the roster.
5xx — Temporary. Retry with backoff — POST /attempts/ is safe to retry (see Idempotency).

The attempt object

Every endpoint returns attempts in this shape — the POST response, GETs and the attempt.* webhooks:

{
  "attempt_id": "7c1e9f3a-2b4d-4e8f-9a1b-3c5d7e9f1a2b",
  "student_id": "00001",
  "assessment_id": "A1",
  "attempt_number": 1,
  "status": "completed",
  "assessment_url": "https://www.preparebuddy.com/language-tests/start/?code=7KQ2M9XPRA",
  "access_code": "7KQ2M9XPRA",
  "opens_at": "2026-10-16T08:00:00+00:00",
  "closes_at": "2026-10-31T18:00:00+00:00",
  "assessment": {
    "name": "A1 Midterm — October 2026",
    "test_title": "CEFR English Placement — Form 2",
    "test_type": "adaptive_language",
    "test_type_label": "Adaptive Language Proficiency"
  },
  "created_at": "2026-10-15T09:12:44+00:00",
  "started_at": "2026-10-16T14:02:10+00:00",
  "completed_at": "2026-10-16T14:30:00+00:00",
  "released_at": "2026-10-16T14:30:00+00:00",
  "score": 85,
  "max_score": 100,
  "percentage": 85.0,
  "score_label": "Adaptive Language Proficiency 85 / 100",
  "level": "B2",
  "level_description": "B2",
  "result_note": null,
  "cefr": {"mode": "placement", "level": "B2", "target_level": null, "percent": null, "standing": null},
  "sections": {"reading": 88, "listening": 82, "writing": 84, "speaking": 86},
  "is_adjusted": false,
  "provisional": false,
  "result_url": "https://www.preparebuddy.com/language-tests/session/3f8b2c1e-…/result/"
}
Field Meaning
attempt_id Stable UUID. Upsert by it.
student_id, assessment_id What you sent. assessment_id is kept as it was when the attempt was made, even if the ID is later moved to another sitting.
attempt_number 1 for the first attempt of this student at this assessment, 2 for a retake, …
status See Statuses below.
assessment_url The student's personal link. null once cancelled.
access_code The code inside the link, for students who prefer to type it at /language-tests/start/. null once cancelled.
opens_at, closes_at The student can start between these (either may be null = no limit). A student already in the test always finishes.
assessment The sitting's name and the paper this student got (with a pool, students can get different papers).
started_at, completed_at When the student started and submitted. completed_at is set from submitted onwards.
released_at When the result became final.
score, max_score, percentage Only when status is completed, otherwise null. The score of record (an examiner's adjustment where there is one), on the test's own scale.
score_label Human-readable score.
level The CEFR level awarded (A1–C2, or an examiner's level). Always a level or null — null when the test does not award one, or when the student answered too little to be placed.
level_description The level text shown on the result page, e.g. "B2", a level-targeted form's "B2 · 71% (developing)", or "Incomplete". null until completed.
cefr The CEFR result as fields, or null when the test gives none. mode is placement (the test places the student: level) or targeted (a level test, e.g. an A2 test: target_level, percent against that level and standing — secure 80%+, developing 60%+, partial 40%+, emerging below). A level test never claims the student is that level, so its level stays null unless an examiner sets one.
result_note Why a result has no level or may change, e.g. "0 of 54 questions answered" or "Provisional result: some answers are awaiting evaluation." null when there is nothing to say.
sections Section scores on the test's own section scale. {} until completed.
is_adjusted true when an examiner adjusted the score.
provisional true while some answers are still being evaluated; the score will change and you will get attempt.completed again.
result_url The result page in PrepareBuddy (requires sign-in as the student or staff).

Statuses

status Meaning Score fields
not_started Link issued; the student has not started. null
in_progress The student is taking the test. null
submitted Finished; the sitting holds results for examiner review. null
completed Final result available. filled
expired The window closed before the student started. Extending the window returns it to not_started. null
cancelled Cancelled (by you, an organiser, or because the sitting was deleted). null
not_started ─▶ in_progress ─▶ submitted ─▶ completed
     │                         (review       ▲
     │                          sittings) ───┘  instant sittings go straight to completed
     ├─▶ expired   (window closed first)
     └─▶ cancelled

Endpoints

GET /tests/ — which tests can I build an assessment on

The tests your organization can run, the same list as the Conduct a test picker. Works with a Read only key. The list can be long, so narrow it with ?type=toefl (the type of a test, as shown in each row) and/or ?search=practice (part of the title, any case).

{ "status": "ok", "count": 2,
  "tests": [ {"test_id": 412, "title": "TOEFL iBT Practice Test 1", "type": "toefl", "type_label": "TOEFL iBT"},
             {"test_id": 77, "title": "CEFR Placement Form 2", "type": "adaptive_language", "type_label": "Adaptive Language Proficiency"} ] }

POST /assessments/ — create an assessment (a sitting)

Needs a Full access key. Creates the same sitting as Conduct a test with the candidates left empty.

curl -X POST -H "X-API-Key: $PB_KEY" -H "Content-Type: application/json" \
  -d '{"assessment_id": "A1-midterm", "test_id": 412, "results": "instant", "closes_at": "2026-12-31T23:59:00+00:00"}' \
  https://www.preparebuddy.com/api/v1/testing-center/assessments/
Field
assessment_id required Your name for it. See IDs.
test_id required From GET /tests/.
results optional instant, or after_review (a teacher checks first). Default after_review.
name optional Shown to teachers. Default: the test title and today's date.
opens_at, closes_at optional ISO 8601. A time without an offset is read as UTC. Leave out for no limit.
instructions optional Text shown to the student.

Answer: 201 and {"status": "ok", "created": true, "assessment": {…}} (same object as GET /assessments/). Errors: 400 invalid_assessment_id | invalid_test_id | invalid_results | invalid_opens_at | invalid_closes_at | invalid_window, 404 unknown_test, 409 assessment_id_taken. Exam conditions and Safe Exam Browser are set in PrepareBuddy, on the sitting's page.

GET /assessments/{assessment_id}/ and PATCH /assessments/{assessment_id}/

GET returns one assessment. PATCH (Full access key) renames it or moves its window; send any of name, opens_at, closes_at. Candidates who are already inside the test are unaffected; invitations that had expired reopen when the window is extended. Nothing to change: 400 nothing_to_change.

GET /assessments/ — what you can send students to

Sittings in your organization that have an assessment ID.

curl -H "X-API-Key: $PB_KEY" https://www.preparebuddy.com/api/v1/testing-center/assessments/
{
  "status": "ok",
  "count": 1,
  "assessments": [
    {
      "assessment_id": "A1",
      "name": "A1 Midterm — October 2026",
      "test": {"title": "CEFR English Placement — Form 2", "type": "adaptive_language",
               "type_label": "Adaptive Language Proficiency"},
      "opens_at": "2026-10-16T08:00:00+00:00",
      "closes_at": "2026-10-31T18:00:00+00:00",
      "window": "open",
      "results": "after_review",
      "attempts": 42
    }
  ]
}

If there are none yet the answer says what to do: {"status": "ok", "count": 0, "assessments": [], "hint": "No assessments yet. Create one with POST …"}.

window is not_open, open or closed. results is instant or after_review (examiner review first). attempts counts links issued through this API.

POST /attempts/ — a student and an assessment → a link

curl -X POST https://www.preparebuddy.com/api/v1/testing-center/attempts/ \
  -H "X-API-Key: $PB_KEY" -H "Content-Type: application/json" \
  -d '{"student_id": "00001", "assessment_id": "A1"}'
Field Required Meaning
student_id yes Your student ID.
assessment_id yes The sitting's assessment ID.
student_name no Shown to examiners instead of the ID (e.g. on the review screen and certificate). Omit it to share nothing but the ID. The first name sent is remembered for the student's later attempts.
group no A class or section label (max 100 characters). Organisers can filter and export by it.
new_attempt no true to request a retake once the previous attempt has finished.

Responses:

  • 201 Created with "created": true — a new attempt.
  • 200 OK with "created": false — this student already has an attempt at this assessment (the same link). Nothing new is created.
{ "status": "ok", "created": true, "attempt": { …the attempt object, status "not_started"… } }

Idempotency and retakes

  • The same student_id + assessment_id returns the same attempt while the assessment ID points to the same sitting — so retrying after a timeout never makes a second link.
  • If that attempt was cancelled, the next POST makes a fresh attempt (attempt_number + 1) with a new link.
  • If an organiser has moved the assessment ID to a new sitting (a new term), the next POST makes a new attempt on the new sitting.
  • "new_attempt": true makes a retake only when the latest attempt is submitted, completed, expired or cancelled; otherwise 409 attempt_open.
  • The sitting must still be open to take new students (409 assessment_closed after its "take by" time); existing attempts are always returned.

One student, one identity

The first attempt for a student_id creates a PrepareBuddy account for it with no email and no password — its only way in is the access code of one sitting at a time. Later attempts for the same student_id in your organization reuse that account, so a student's midterm and final appear as one person to your teachers. The same student_id in another organization is a different person.

GET /attempts/{attempt_id}/ — one attempt

curl -H "X-API-Key: $PB_KEY" \
  https://www.preparebuddy.com/api/v1/testing-center/attempts/7c1e9f3a-2b4d-4e8f-9a1b-3c5d7e9f1a2b/
{ "status": "ok", "attempt": { …the attempt object… } }

GET /attempts/ — many attempts

Oldest first, paged with a cursor.

Parameter Meaning
student_id One student.
assessment_id One assessment.
status One status, e.g. completed.
limit 1–500, default 100.
cursor The next_cursor from the previous page.
curl -H "X-API-Key: $PB_KEY" \
  "https://www.preparebuddy.com/api/v1/testing-center/attempts/?assessment_id=A1&status=completed&limit=100"
{ "status": "ok", "count": 100, "attempts": [ … ], "next_cursor": "5231", "has_more": true }

Keep calling with cursor=<next_cursor> while has_more is true.

GET /students/{student_id}/results/ — every attempt of one student

The same as GET /attempts/?student_id=… (and accepts the same assessment_id, status, limit, cursor). 404 unknown_student if no attempt was ever made for that ID.

curl -H "X-API-Key: $PB_KEY" \
  https://www.preparebuddy.com/api/v1/testing-center/students/00001/results/

POST /attempts/{attempt_id}/new-link/ — replace a lost or leaked link

Issues a new access code, so a new assessment_url. The old link stops working immediately. Allowed while the attempt is not_started, in_progress (the student continues where they were) or expired.

curl -X POST -H "X-API-Key: $PB_KEY" \
  https://www.preparebuddy.com/api/v1/testing-center/attempts/7c1e9f3a-2b4d-4e8f-9a1b-3c5d7e9f1a2b/new-link/

Returns {"status": "ok", "attempt": {…with the new assessment_url…}}.

POST /attempts/{attempt_id}/cancel/ — withdraw a link nobody used

Only while not_started. The link stops working; status becomes cancelled. Cancelling twice is harmless.

curl -X POST -H "X-API-Key: $PB_KEY" \
  https://www.preparebuddy.com/api/v1/testing-center/attempts/7c1e9f3a-2b4d-4e8f-9a1b-3c5d7e9f1a2b/cancel/

What the student sees

  1. The link opens a PrepareBuddy page saying "Your test is ready" with their code already filled in.
  2. They press Start test. Opening the link alone signs nobody in — so an email security scanner that follows the link cannot use it up.
  3. They take the test. The link opens only this test (and later its result) — nothing else in PrepareBuddy.
  4. Closing the browser is fine: opening the link again continues the test.
  5. After submitting, the same link shows their result once it is released.

Before opens_at the page says when the test opens; after closes_at (if never started) it says the window has closed.

Webhooks (Option A: push)

An organization administrator adds your URL under Organization dashboard → API Keys & Integrations → Manage webhooks and ticks the events. Events are signed, retried for about 6 hours and logged — all as described in Webhooks, including how to verify the signature.

Event Sent when data
attempt.started The student started. attempt object
attempt.submitted The student finished and the sitting holds results for review. attempt object (no score yet)
attempt.completed The result is final — and again whenever it changes (a re-mark, an examiner adjustment, a provisional score becoming final). attempt object with score and level
attempt.expired The window closed before the student started. attempt object
attempt.cancelled The attempt was cancelled (by you or an organiser). attempt object

Status changes are detected within about 5 minutes. A step can be skipped if two changes happen inside that time (for example in_progress → completed without attempt.started), so always act on data.status, not on the event name alone. Events cover attempts created in the last 180 days.

Example delivery:

POST https://sis.example.edu/preparebuddy/webhook
Content-Type: application/json
X-PrepareBuddy-Event: attempt.completed
X-PrepareBuddy-Delivery: evt_4f0c9b2e7a1d3c5e8f60a1b2
X-PrepareBuddy-Signature: t=1792160400,v1=5c3f…e91a
{
  "id": "evt_4f0c9b2e7a1d3c5e8f60a1b2",
  "type": "attempt.completed",
  "created": "2026-10-16T14:31:12+00:00",
  "organization": {"id": 12, "slug": "your-school", "name": "Your School"},
  "data": {
    "attempt_id": "7c1e9f3a-2b4d-4e8f-9a1b-3c5d7e9f1a2b",
    "student_id": "00001",
    "assessment_id": "A1",
    "attempt_number": 1,
    "status": "completed",
    "score": 85,
    "max_score": 100,
    "percentage": 85.0,
    "level": "B2",
    "completed_at": "2026-10-16T14:30:00+00:00",
    "released_at": "2026-10-16T14:30:00+00:00",
    "…": "the rest of the attempt object"
  }
}

A complete receiver (Python / Flask)

import hashlib, hmac, json, os, time
from flask import Flask, request

app = Flask(__name__)
SECRET = os.environ["PREPAREBUDDY_WEBHOOK_SECRET"]          # the signing secret from the Webhooks page

def verified(raw: bytes, header: str) -> bool:
    parts = dict(p.split("=", 1) for p in header.split(",") if "=" in p)
    if "t" not in parts or "v1" not in parts or abs(time.time() - int(parts["t"])) > 300:
        return False
    expected = hmac.new(SECRET.encode(), f"{parts['t']}.".encode() + raw, hashlib.sha256).hexdigest()
    return hmac.compare_digest(expected, parts["v1"])

@app.post("/preparebuddy/webhook")
def webhook():
    raw = request.get_data()                                 # the raw body, exactly as received
    if not verified(raw, request.headers.get("X-PrepareBuddy-Signature", "")):
        return "bad signature", 401
    event = json.loads(raw)
    if event["type"].startswith("attempt."):
        a = event["data"]
        save_attempt(                                        # your code: UPSERT by attempt_id
            attempt_id=a["attempt_id"], student_id=a["student_id"], assessment_id=a["assessment_id"],
            status=a["status"], score=a["score"], max_score=a["max_score"], level=a["level"],
            completed_at=a["completed_at"])
    return "", 200                                           # answer within 10 seconds

PHP and Node.js versions of verified() are on the Webhooks page.

Also available: result.final

result.final (sent within seconds of a result becoming final, for every kind of result in your organization) now carries, for Testing Center API attempts, an external block — {"student_id", "assessment_id", "attempt_id", "attempt_number"} — and cefr_level. Use it if you already consume result.final; otherwise the attempt.* events are simpler.

Polling (Option B: pull)

  • One student: GET /students/{student_id}/results/.
  • One attempt: GET /attempts/{attempt_id}/.
  • Everything finished: GET /attempts/?status=completed&cursor=….

Recommended: use webhooks for speed and run a nightly GET /attempts/?status=completed (or per assessment) to catch anything your receiver missed during its own downtime. Upsert by attempt_id either way — a re-marked result has the same attempt_id and a new score.

Mapping from a typical SIS design

A typical SIS design says Use
POST /api/students {student_id, assessment_id} → assessment_url POST /api/v1/testing-center/attempts/ → attempt.assessment_url
Webhook POST {student_id, assessment_id, status, score, level, completed_at} Your URL receives attempt.completed; those fields are in data
GET /api/assessments/{student_id}/results GET /api/v1/testing-center/students/{student_id}/results/
"status": "completed" status = completed (see Statuses for the others)

Sandbox

Ask PrepareBuddy for a sandbox organization: the same API on the same address, with its own API key, sittings and webhook settings, kept apart from your live organization. To exercise the whole flow quickly:

  1. Create a sitting with Release results immediately and an assessment ID such as SANDBOX-A1.
  2. POST /attempts/ with a pretend student (TEST-001).
  3. Open the assessment_url in a private browser window, press Start test, then Exit — whatever was answered is scored straight away. With nothing answered you get status: "completed", score: 0, level: null, level_description: "Incomplete" and a result_note such as "0 of 54 questions answered".
  4. Within about 5 minutes your webhook receives attempt.completed; or GET the attempt.
  5. Try the edge cases: retry the same POST (same link back), new_attempt while open (409), cancel, new-link, an unknown assessment (404).

Never use real students' data in a sandbox.

Security notes

  • Keep the API key and webhook secret on your server only — never in a web page or a mobile app.
  • Anyone holding a link can sit that one test as that student, just like a password. Send links only to the student; call new-link if one leaks.
  • A link never opens anything but its own test and result; staff accounts can never be opened by a code.
  • Wrong codes are rate-limited per code and per network.