Contents
On this page

Duplicate Question - Plugixa Exam

POST /plugixa-exam/v1/questions/{id}/duplicate

Make a copy of a question, as a new unpublished question.

Scope questions:write; the token’s user needs the questions:create permission.

The copy is titled <title> (copy), gets a new slug, and starts at version 1. Its options are copied as new options with new ids, and its tags and custom field values are copied too. It is always unpublished, whatever the source’s status.

Request

POST https://your-site.example/wp-json/plugixa-exam/v1/questions/12/duplicate

No request body.

Path parameters

Name Type Description
id integer The id of the question to copy

Responses

201 Created. data is the new copy.

{
  "success": true,
  "data": {
    "id": 27,
    "subject_id": 4,
    "question_type": "mcq_single",
    "title": "Capital of France (copy)",
    "slug": "capital-of-france-copy",
    "stem": "<p>What is the capital of France?</p>",
    "difficulty": 2,
    "default_points": 1,
    "answer_key": { "negative_marking": false, "min_score": 0 },
    "explanation": "<p>Paris is the capital of France.</p>",
    "shuffle_options": true,
    "published": false,
    "version": 1,
    "approval_status": "approved",
    "rubric": null,
    "custom_fields": null,
    "render_hint": null,
    "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,
    "options": [
      { "id": 88, "question_id": 27, "ordering": 1, "option_text": "Paris", "is_correct": true, "match_key": null, "feedback": null },
      { "id": 89, "question_id": 27, "ordering": 2, "option_text": "Lyon", "is_correct": false, "match_key": null, "feedback": null },
      { "id": 90, "question_id": 27, "ordering": 3, "option_text": "Marseille", "is_correct": false, "match_key": null, "feedback": null }
    ],
    "tag_ids": [5, 8]
  }
}
Field Type Meaning
data.id integer The copy’s id
data.title string The source title followed by (copy)
data.slug string A new slug
data.published boolean Always false
data.version integer 1
data.options object[] Copies of the source’s options, with new ids

The other fields are as in Get Question.

Errors

Status Code When
404 plugixa_exam_not_found No question with that id.
400 The Create Question codes The source question no longer passes the checks a new question must pass.

Plus the errors every endpoint can return.

Examples

curl -s -X POST "https://your-site.example/wp-json/plugixa-exam/v1/questions/12/duplicate" \
  -H "Authorization: Bearer $PLUGIXA_EXAM_TOKEN"
<?php
$ch = curl_init('https://your-site.example/wp-json/plugixa-exam/v1/questions/12/duplicate');
curl_setopt_array($ch, [
    CURLOPT_CUSTOMREQUEST  => 'POST',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => [
        'Authorization: Bearer ' . getenv('PLUGIXA_EXAM_TOKEN'),
    ],
]);
$response = json_decode(curl_exec($ch), true);
curl_close($ch);
const response = await fetch('https://your-site.example/wp-json/plugixa-exam/v1/questions/12/duplicate', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${process.env.PLUGIXA_EXAM_TOKEN}`,
  },
});
const { data } = await response.json();

Quick Links

Share