Contents
On this page

Plugixa Exam REST API - Plugixa Exam

The integration surface for Plugixa Exam: subjects, tags and questions you can create and edit, exams you can read, publish and delete, attempts you can read, and per-exam reports. Enough to sync a question bank from another system, feed a gradebook or a BI tool, or automate publishing.

Authentication. A script calls the API with a Plugixa Exam API token PRO, created under Plugixa Exam -> API tokens. A token is shown once and stored only as a hash. It acts as the WordPress user who created it, and is limited two ways at once: by the scopes it was given, and by that user’s Plugixa Exam role. A scope the token lacks is refused, whatever the role allows.

It is off when the API Tokens app is off. Plugixa Exam -> App Manager -> API tokens is the kill switch: with it off, no token is recognised and every token request answers 401. An app that is switched off takes its endpoints with it: they answer 404.

Everything the admin app does, it also does over this API, under the namespace plugixa-exam/v1. Every permission the interface enforces is enforced at the endpoint rather than in the page.

Base URL

https://your-site.example/wp-json/plugixa-exam/v1

On a site with plain permalinks, pass the route as a parameter instead:

https://your-site.example/?rest_route=/plugixa-exam/v1/exams

Authentication

Send the token in the Authorization header:

curl -s "https://your-site.example/wp-json/plugixa-exam/v1/exams" \
  -H "Authorization: Bearer $PLUGIXA_EXAM_TOKEN"

Some hosts strip the Authorization header before PHP sees it. On those, send the raw token in X-Plugixa-Exam-Token instead (no Bearer).

A token only works on /plugixa-exam/v1 routes. On every other WordPress route, core and other plugins included, it is ignored.

Caller How it signs in
A script or another system An API token PRO, for the routes a token can reach
A script that needs any other route A WordPress Application Password: see Signed-in users
The admin app The logged-in cookie plus a nonce, the normal WordPress way
The exam runner The same, including for a guest, whose signed cookie identifies them

A token can only narrow access. What a request may do is the token user’s role permissions and the token’s scopes. When a browser that is already signed in also sends a token, the cookie identity is kept and the token’s scopes still cap it.

Scopes

Scopes default to deny: a token can do only what its scopes list.

Scope Allows
subjects:read List and read subjects
subjects:write Create, update and reorder subjects
subjects:delete Delete subjects
questions:read List and read questions and tags
questions:write Create, update and duplicate questions, and manage tags
questions:delete Delete questions and tags
exams:read List and read exams
exams:write Create and update exams as drafts
exams:delete Delete exams
exams:publish Publish and unpublish exams, on top of exams:write. The same rule applies to people: a role without the Publish permission can save an exam, but cannot change whether it is published
attempts:read List and read attempts, grade scales and transcripts
reports:read Read the analytics reports
lookups:read Only three lookup lists: question types, the subject tree and tags

What a token can reach

Since 1.4.1 a token works on the content routes and nothing else. Every other route answers 403 plugixa_exam_token_route to a token, whichever scopes it holds and whoever it acts as. Within this list, the scopes above still decide what the token may do.

Area Routes a token can use
Subjects list, read, create, update, delete, reorder, the subject tree
Questions list, read, create, update, delete, duplicate, the type list
Tags list, create, update, delete
Exams list, read, create, update, delete
Attempts list, read, summary (read only)
Reports the analytics exam list, and an exam’s overview, items, students and preview; the gradebook scales and transcripts (read only)

Out of reach for every token: passages, question version history, exam prerequisites and access rules, cohorts, report schedules, settings, roles, the App Manager, webhooks, LTI, import and export, AI generation, media and audio uploads, the shop (WooCommerce), enrolments, certificates, live monitoring, and taking an exam.

Signed-in users

The routes outside a token’s reach still work for a signed-in WordPress user, with that user’s Plugixa Exam permissions. From a script, sign in with a WordPress Application Password (Users -> Profile -> Application Passwords) sent as HTTP Basic auth:

curl -s "https://your-site.example/wp-json/plugixa-exam/v1/passages"   -u "$WP_USER:$WP_APP_PASSWORD"

The endpoint pages for these routes say so at the top, and their examples use this sign-in.

Responses

Every successful response is wrapped the same way:

{
  "success": true,
  "data": { "id": 12, "title": "Algebra" },
  "meta": { "total": 37, "pages": 1 }
}

meta is only present when it has something in it. Booleans are real booleans, ids and counts are integers, and datetimes are UTC strings in the form 2026-11-12 09:30:00.

Lists and pagination

Paged list endpoints accept the same parameters, and put the totals in meta, not in headers (X-WP-Total is not sent).

Parameter Type Default Description
page integer 1 Page to return, from 1
per_page integer 50 Rows per page, 1 to 200
search string Substring search over the columns each endpoint lists
orderby string id One of the sortable columns each endpoint lists. Anything else falls back to id
order string desc asc or desc
view string live live, or trash for soft-deleted rows only

Subjects, tags, questions, exams and passages are soft-deleted: a deleted row moves to the trash and stops appearing in single reads and in lists, unless you ask for view=trash.

Endpoints

Passages, the question version history (Versions, History, Get version, Compare, Restore), prerequisites, access rules, the cohort helpers and report Schedules are for signed-in users only: a token gets 403 on them.

Resource Endpoints
Subjects List, Create, Tree, Reorder, Get, Update, Delete
Tags List, Create, Update, Delete
Questions List, Create, Types, Get, Update, Delete, Duplicate, Versions, History PRO, Get version PRO, Compare PRO, Restore PRO
Passages PRO List, Create, Get, Update, Delete, Question passage, Link question, Upload audio, Remove audio
Exams List, Create, Get, Update, Delete, Prerequisites PRO, Replace prerequisites PRO, Access rules PRO, Replace access rules PRO, Cohort picker PRO, Access subjects PRO, User search PRO
Attempts List, Summary, Get, Grade scales PRO, Transcript PRO
Reports PRO Exams, Overview, Item analysis, Students, Preview, Schedules

Webhook events

Rather than polling, you can have events pushed to you PRO. Endpoints are managed in the admin, not through the API: see Webhooks.

Event Fires when
attempt.submitted An attempt is closed, whether the learner handed it in or it was closed for them
attempt.graded An attempt becomes graded
attempt.regraded A marker changes an already finished result, and the score or outcome actually changed
certificate.issued A certificate is issued
enrolment.granted An enrolment becomes active
enrolment.revoked An active enrolment stops being active

Each delivery is a POST with a JSON body (event, sent_at, site, data) and is signed: X-PlugixaExam-Signature carries sha256= followed by the HMAC-SHA256 of the raw body, keyed with the endpoint’s secret.

Errors

Errors use the standard WordPress shape:

{
  "code": "plugixa_exam_forbidden",
  "message": "You are not allowed to do that.",
  "data": { "status": 403 }
}

These can come back from any endpoint. Each endpoint page lists its own errors on top of them.

Status Code When
401 plugixa_exam_forbidden No usable token: missing, malformed, unknown, revoked or expired, its user deleted, or the API Tokens app off. A bad token is not reported separately: the request simply arrives signed out.
403 plugixa_exam_forbidden The token is valid but the request is not allowed: the token lacks the scope, the user’s role does not grant it, or the user cannot manage Plugixa Exam at all. These cases look the same by design.
403 plugixa_exam_token_route A token called a route outside what a token can reach. Sign in as a user instead.
401 / 403 rest_forbidden Not signed in, or not allowed, on the access-rule and cohort endpoints, which answer with WordPress’s own code.
404 rest_no_route No such route or method, or the app that registers it is switched off in the App Manager.
400 rest_invalid_param A parameter failed validation, for example per_page above 200 or order other than asc/desc.
400 rest_missing_callback_param A required parameter is missing.

There is no rate limit.

Filtering what comes back

Several filters let you change payloads in PHP without touching the routes:

Filter Changes
plugixa_exam_exam_output An exam as returned
plugixa_exam_question_output A single question
plugixa_exam_question_list_output A list of questions
plugixa_exam_filter_output The filter options offered

plugixa_exam_register_rest_routes fires when routes are being registered, which is where to add your own alongside them. See Hooks for the full set.

Do not ask WordPress for its own REST URL during plugin load. That answer depends on rewrite rules WordPress has not built yet at that point. On a premium site running WooCommerce it produced a blank front end on every page, fixed in 1.0.0. Resolve REST URLs when you need them, not at boot.

Troubleshooting

Symptom Usual cause
401 from a script The token is missing, revoked or expired, or the host strips Authorization: send X-Plugixa-Exam-Token instead.
401 or 403 from the browser The nonce is missing or stale. Reload the admin.
404 on a route that should exist Its app is off in the App Manager, or the module is not installed.
403 plugixa_exam_token_route from a script The route is outside what a token can reach since 1.4.1. Use an Application Password for it.
Publishing or unpublishing answers 403 Since 1.4.1 that needs exams:publish on top of exams:write.
A token works for reads and not writes Scopes default to deny. Grant the write scope explicitly.
Everything works signed in, nothing from a script You are relying on the cookie. Use a token.

See also

  • Create a token in API tokens PRO.
  • Change behaviour in PHP instead: Hooks.
  • Have events pushed to you: Webhooks PRO.

Quick Links

Share