Shuffle a Multiple-Choice Exam into Coded Versions + Keys
Shuffle questions and options into N exam versions with codes (mã đề) and answer keys, reproducible from a seed. JSON or a zip of .docx exams.
Result
Press “Run” to see the result.
Send the questions returned by /v1/vn-quiz-parse (or the Word / text exam itself) and get versions exam versions, each with its code (mã đề: random 3-digit codes, code_start=101 for 101, 102… or your own codes), the questions and options in a new order, the mapping back to the original numbering and option letters, and the answer key. answer_table lists the answer of every question for every code, ready to print or to load into a grading app.
The rules teachers expect: questions move only inside their part (PHẦN I, II, III stay in order, numbering restarts in each part when the original does), questions of a reading passage stay together, options such as "Tất cả đều đúng" or "Không có đáp án nào" keep their place, and a question whose options refer to other letters ("Cả A và B") keeps its option order. True-false statements are not shuffled unless shuffle_statements=true. The same seed always gives the same versions, so a mix can be rebuilt later.
format=docx returns a zip with one .docx per code (header with school, title, subject, time and the code; images kept), dap_an.docx (answer table) and dap_an.csv.
Use this in your code
curl -X POST "https://apibox.io.vn/v1/vn-exam-mix" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"Câu 1. Thủ đô của Việt Nam là\nA. TP. Hồ Chí Minh\t*B. Hà Nội\nC. Đà Nẵng\tD. Huế\nCâu 2. 2 + 2 = ?\nA. 3\nB. 4\nC. 5\nD. 6\nĐáp án: B\nLời giải: 2 + 2 = 4.","versions":2,"seed":"demo-2026","code_start":101}'const res = await fetch('https://apibox.io.vn/v1/vn-exam-mix', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"text": "Câu 1. Thủ đô của Việt Nam là\nA. TP. Hồ Chí Minh\t*B. Hà Nội\nC. Đà Nẵng\tD. Huế\nCâu 2. 2 + 2 = ?\nA. 3\nB. 4\nC. 5\nD. 6\nĐáp án: B\nLời giải: 2 + 2 = 4.",
"versions": 2,
"seed": "demo-2026",
"code_start": 101
}),
});
const data = await res.json();
console.log(data);import requests
res = requests.post(
"https://apibox.io.vn/v1/vn-exam-mix",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"text": "Câu 1. Thủ đô của Việt Nam là\nA. TP. Hồ Chí Minh\t*B. Hà Nội\nC. Đà Nẵng\tD. Huế\nCâu 2. 2 + 2 = ?\nA. 3\nB. 4\nC. 5\nD. 6\nĐáp án: B\nLời giải: 2 + 2 = 4.", "versions": 2, "seed": "demo-2026", "code_start": 101},
timeout=30,
)
print(res.json())<?php
$ch = curl_init('https://apibox.io.vn/v1/vn-exam-mix');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_KEY', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => '{"text":"Câu 1. Thủ đô của Việt Nam là\\nA. TP. Hồ Chí Minh\\t*B. Hà Nội\\nC. Đà Nẵng\\tD. Huế\\nCâu 2. 2 + 2 = ?\\nA. 3\\nB. 4\\nC. 5\\nD. 6\\nĐáp án: B\\nLời giải: 2 + 2 = 4.","versions":2,"seed":"demo-2026","code_start":101}',
]);
$response = curl_exec($ch);
print_r(json_decode($response, true));API documentation → Get a free API key
FAQ
Can I rebuild the same versions later?
Yes. Keep the seed returned with the result: the same seed, questions and codes always give the same versions.
Which options are never moved?
Options like "Tất cả đều đúng", "Cả A và B", "Không có phương án nào" stay at their position; when an option names other letters, the whole question keeps its order.
Does the .docx keep formulas?
Text, images and the question structure are kept; Word equations become plain text. Edit the generated files if you need special formatting.