Contents
Create Passage - Plugixa Exam
POST /plugixa-exam/v1/passages
Create a passage: a text, a recording or both, that several questions can share.
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 questions:create permission.
Needs Plugixa Exam Pro, with the Passages app on in Plugixa Exam -> App Manager.
Request
POST https://your-site.example/wp-json/plugixa-exam/v1/passages
Request body
Content type: application/json
| Field | Type | Required | Description |
|---|---|---|---|
title |
string |
Yes | Must not be blank. |
body |
string |
No | The text candidates read. HTML; tags outside the question-text allow-list are stripped. Defaults to empty. |
transcript |
string |
No | The recording’s transcript. HTML, filtered the same way. Defaults to empty. |
audio_max_plays |
integer |
No | How many times a candidate may play the recording, up to 99. 0, the default, means no limit. |
audio_seek |
boolean |
No | Whether a candidate may skip around in the recording. Defaults to true. |
audio_pause |
boolean |
No | Whether a candidate may pause a limited play. Defaults to true. With no play limit, pausing is always allowed. |
published |
boolean |
No | Defaults to true: unlike subjects and questions, a passage is published unless you send false. |
The recording itself is not part of this body: create the passage, then send the file with Upload Passage Audio. To attach questions, use Link Question to Passage.
{
"title": "The lighthouse keeper",
"body": "<p>For forty years the light on Gull Rock never failed.</p>",
"audio_max_plays": 2,
"audio_seek": false
}
Responses
201 Created. data is the new passage.
{
"success": true,
"data": {
"id": 7,
"title": "The lighthouse keeper",
"body": "<p>For forty years the light on Gull Rock never failed.</p>",
"transcript": "",
"audio_name": "",
"audio_mime": "",
"audio_bytes": 0,
"audio_seconds": 0,
"audio_max_plays": 2,
"audio_seek": false,
"audio_pause": true,
"published": true,
"created_at": "2026-11-12 09:30:00",
"modified_at": "2026-11-12 09:30:00",
"created_by": 1,
"modified_by": 1,
"deleted_at": null,
"question_count": 0,
"has_audio": false,
"audio_limit_mb": 64
}
}
| Field | Type | Meaning |
|---|---|---|
data.id |
integer |
The new passage’s id |
data.audio_max_plays |
integer |
Play limit, 0 for no limit |
data.published |
boolean |
Whether the passage is published |
data.question_count |
integer |
Questions linked: 0 for a new passage |
data.has_audio |
boolean |
false until a recording is uploaded |
data.audio_limit_mb |
integer |
Largest recording the site accepts, in MB |
Errors
| Status | Code | When |
|---|---|---|
400 |
plugixa_exam_title_required |
title is missing or blank. |
Plus the errors every endpoint can return.
Examples
curl -s -X POST "https://your-site.example/wp-json/plugixa-exam/v1/passages" \
-u "$WP_USER:$WP_APP_PASSWORD" \
-H "Content-Type: application/json" \
-d '{"title":"The lighthouse keeper","body":"<p>For forty years the light on Gull Rock never failed.</p>","audio_max_plays":2,"audio_seek":false}'
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-exam/v1/passages');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Basic ' . base64_encode(getenv('WP_USER') . ':' . getenv('WP_APP_PASSWORD')),
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'title' => 'The lighthouse keeper',
'body' => '<p>For forty years the light on Gull Rock never failed.</p>',
'audio_max_plays' => 2,
'audio_seek' => false,
]),
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-exam/v1/passages', {
method: 'POST',
headers: {
'Authorization': 'Basic ' + btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`),
'Content-Type': 'application/json',
},
body: JSON.stringify({
title: 'The lighthouse keeper',
body: '<p>For forty years the light on Gull Rock never failed.</p>',
audio_max_plays: 2,
audio_seek: false,
}),
});
const { data } = await response.json();
Quick Links
Share