List Pass Plans
GET /v1/nextexams/passes/plans
List pass plans
Every plan with what it opens and how long a pass lasts. Scope passes:read.
Request
GET https://your-site.example/api/index.php/v1/nextexams/passes/plans?limit=<integer>&offset=<integer>&search=<string>&published=<integer>
Parameters
| Name | Type | In | Required | Description |
|---|---|---|---|---|
limit |
integer |
query |
No | Page size. (min 1) Defaults to 20. |
offset |
integer |
query |
No | Rows to skip. (min 0) Defaults to 0. |
search |
string |
query |
No | Matches the title (and, for questions, the stem). |
published |
integer |
query |
No | 1 for published only, 0 for unpublished only. One of 0, 1. |
Responses
200 — A page of plans.
{
"data": [
{
"id": 1,
"title": "string",
"description": "string",
"duration_seconds": 1,
"published": true,
"active_count": 1,
"items": [
{
"item_type": "exam",
"item_id": 1,
"title": "string"
}
]
}
],
"meta": {
"total": 1
}
}
| Field | Type | Meaning |
|---|---|---|
data[].id |
integer |
|
data[].title |
string |
|
data[].description |
string|null |
|
data[].duration_seconds |
integer|null |
How long a pass lasts, in seconds from its start (3 days = 259200, wherever the learner is). Null = no expiry. |
data[].published |
boolean |
False: no new pass can be granted; passes already granted keep working. |
data[].active_count |
integer |
Passes of this plan that admit their holder now. |
data[].items[] |
object[] |
What a pass opens. An exam item opens that exam when its access type is "Access pass"; a cohort item counts as membership of that cohort while the pass lasts. Passes follow the plan's current list. |
data[].items[].item_type |
string |
One of exam, cohort. |
data[].items[].item_id |
integer |
|
data[].items[].title |
string |
|
meta.total |
integer |
Matching records in all pages. |
Errors
| Status | Code | When |
|---|---|---|
401 |
INVALID_TOKEN |
No token (MISSING_TOKEN), or one that is wrong, expired, revoked, or whose owner can no longer sign in (INVALID_TOKEN). |
403 |
MISSING_SCOPE |
The token is valid but this request is not allowed, and code says why: MISSING_SCOPE (the token lacks the scope), FORBIDDEN (the owner's role does not allow it), ACCESS_DENIED (the owner cannot manage Next Exams), API_DISABLED (the API Tokens app is off), APP_DISABLED (the feature's app is off — meta.app names it), ACCOUNT_UNUSABLE (the owner is blocked or must reset their password), DEMO_LOCKED (a demo site). |
Examples
curl
curl -s "https://your-site.example/api/index.php/v1/nextexams/passes/plans" \
-H "Authorization: Bearer $API_TOKEN"
PHP
<?php
$ch = curl_init('https://your-site.example/api/index.php/v1/nextexams/passes/plans?limit=<integer>&offset=<integer>&search=<string>&published=<integer>');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer ' . getenv('API_TOKEN'),
],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
JavaScript
const API_TOKEN = process.env.API_TOKEN;
const response = await fetch("https://your-site.example/api/index.php/v1/nextexams/passes/plans?limit=<integer>&offset=<integer>&search=<string>&published=<integer>", {
headers: {
"Authorization": `Bearer ${API_TOKEN}`,
},
});
const data = await response.json();