Contents
Get Exam Access Rules - Plugixa Exam
GET /plugixa-exam/v1/exams/{id}/access
List the access rules of an exam: which cohorts, roles, users or capabilities may sit it, and when.
Not reachable with an API token: since 1.4.1 a token request to this route answers 403 plugixa_exam_token_route. Call it as a signed-in WordPress user (from a script, with an Application Password) who holds the exams:edit permission. Needs Plugixa Exam Pro with the Cohorts app on in Plugixa Exam -> App Manager; with it off, this route answers 404.
Note. Reading the rules needs the
exams:editpermission, not justexams:view: the route checks the edit permission even for a read. When it refuses, it answers with WordPress’s ownrest_forbiddencode rather thanplugixa_exam_forbidden.
The rules only decide who may sit the exam when its access_type is restricted (see Create Exam).
Request
GET https://your-site.example/wp-json/plugixa-exam/v1/exams/7/access
Path parameters
| Name | Type | Description |
|---|---|---|
id |
integer |
The exam’s id. Not checked: an unknown id answers 200 with an empty list |
Responses
200 OK. data is the list of rules.
{
"success": true,
"data": [
{
"id": 31,
"exam_id": 7,
"subject_type": "cohort",
"subject_id": 4,
"subject_slug": "",
"available_from": "2026-11-16 08:00:00",
"available_until": "2026-11-18 18:00:00",
"due_at": "2026-11-18 18:00:00",
"created_at": "2026-11-12 10:30:00",
"modified_at": "2026-11-12 10:30:00",
"created_by": 1,
"modified_by": 1
},
{
"id": 32,
"exam_id": 7,
"subject_type": "role",
"subject_id": 0,
"subject_slug": "subscriber",
"available_from": null,
"available_until": null,
"due_at": null,
"created_at": "2026-11-12 10:30:00",
"modified_at": "2026-11-12 10:30:00",
"created_by": 1,
"modified_by": 1
}
],
"meta": {
"subjects": ["cohort", "role", "user", "level"]
}
}
| Field | Type | Meaning |
|---|---|---|
data[].subject_type |
string |
Who the rule names: cohort, role, user or level (a capability) |
data[].subject_id |
integer |
The cohort or user id, for cohort and user. 0 otherwise |
data[].subject_slug |
string |
The role or capability, for role and level. "" otherwise |
data[].available_from |
string|null |
UTC datetime the rule starts letting people in, null for no start |
data[].available_until |
string|null |
UTC datetime the rule stops letting people in, null for no end |
data[].due_at |
string|null |
UTC deadline, null for none |
meta.subjects |
string[] |
The rule types this site accepts |
This list is not paged: meta carries the accepted rule types, not totals.
Errors
| Status | Code | When |
|---|---|---|
401 / 403 |
rest_forbidden |
Not signed in (401), or the user may not edit exams (403). |
Plus the errors every endpoint can return.
Examples
curl -s "https://your-site.example/wp-json/plugixa-exam/v1/exams/7/access" \
-u "$WP_USER:$WP_APP_PASSWORD"
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-exam/v1/exams/7/access');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Basic ' . base64_encode(getenv('WP_USER') . ':' . getenv('WP_APP_PASSWORD')),
],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-exam/v1/exams/7/access', {
headers: {
'Authorization': 'Basic ' + btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`),
},
});
const { data, meta } = await response.json();
Quick Links
Share