# Primary Maths Worksheet Generator (Vietnam) API

> Generate grade 1-5 maths worksheets on the topics of Vietnam's 2018 curriculum, reproducible with a seed, with answer key, as JSON, PDF or DOCX.

- Endpoint: `GET | POST https://apibox.io.vn/v1/vn-math-worksheet`
- Category: Files
- HTML docs: https://apibox.io.vn/docs/vn-math-worksheet/ (Vietnamese: https://apibox.io.vn/vi/docs/vn-math-worksheet/)
- Online tool: https://apibox.io.vn/tools/vn-math-worksheet/
- Authentication: `Authorization: Bearer <API key>` or `X-API-Key: <API key>` (free key: https://apibox.io.vn/dashboard/#signup)

Pick a `grade` (1-5) and up to six `topics` from the 2018 general education programme (Thông tư 32/2018/TT-BGDĐT): addition and subtraction within 10 / 20 / 100 / 1,000 / 100,000 with or without regrouping, missing numbers, comparisons (>, <, =), multiplication and division tables, multi-digit multiplication and division (with remainder), order of operations, find x, Roman numerals, rounding, fractions (simplify, compare, four operations), mixed numbers, decimals, percentages, unit conversions per grade and word problems. `action=topics` lists the 42 topic ids; leave `topic` empty for a mixed sheet of the grade.

Problems are generated from templates, never copied: the same `seed` always gives the same sheet, so a teacher can print versions A / B or re-create the answer key later. `difficulty` (1-3) changes number ranges, `count` sets the number of exercises (up to 120, 20 for word problems).

`format=pdf` returns an A4 sheet (Be Vietnam Pro font, name / class / date line, exercises laid out in columns, answer lines under word problems) followed by an answer key page; `format=docx` gives the same in Word for editing; JSON gives every item with its answer for apps and quiz tools. Optional `title`, `school` and `answer_key=0`.

## Parameters

| Name | In | Type | Required | Default | Description |
|---|---|---|---|---|---|
| `grade` | query|body | number | yes |  | Grade 1 to 5. |
| `topics` | query|body | string | no |  | Topic ids, comma-separated (see `action=topics`); empty = mixed sheet. |
| `count` | query|body | number | no | `24` | Number of exercises (max 120; 20 for word problems). |
| `difficulty` | query|body | number | no | `2` | 1 easy, 2 normal, 3 hard. |
| `seed` | query|body | string | no |  | Same seed = same sheet (random when empty). |
| `format` | query|body | string | no | `json` | `json`, `pdf` or `docx`. |
| `lang` | query|body | string | no | `vi` | `vi` or `en` (labels and word problems). |
| `title` | query|body | string | no |  | Custom title. |
| `school` | query|body | string | no |  | School name printed above the title. |
| `answer_key` | query|body | boolean | no | `true` | Add the answer key page. |

## Example request

```bash
curl "https://apibox.io.vn/v1/vn-math-worksheet?grade=3&topics=mul_table,word_3&count=4&seed=demo" \
  -H "Authorization: Bearer YOUR_API_KEY"
```

## Example response

```json
{
  "title": "Phiếu bài tập Toán lớp 3: Bảng nhân 2 đến 9; Bài toán có lời văn lớp 3",
  "grade": 3,
  "topics": [
    {
      "id": "mul_table",
      "vi": "Bảng nhân 2 đến 9",
      "en": "Multiplication tables 2 to 9"
    },
    {
      "id": "word_3",
      "vi": "Bài toán có lời văn lớp 3",
      "en": "Word problems, grade 3"
    }
  ],
  "seed": "demo",
  "sections": [
    {
      "topic": "mul_table",
      "instruction": "Tính",
      "items": [
        {
          "q": "2 × 9 = ____",
          "a": "18",
          "kind": "calc",
          "n": 1
        },
        {
          "q": "4 × 10 = ____",
          "a": "40",
          "kind": "calc",
          "n": 2
        }
      ]
    },
    {
      "topic": "word_3",
      "instruction": "Giải bài toán",
      "items": [
        {
          "q": "Một hình chữ nhật có chiều dài 21 cm, chiều rộng 18 cm. Tính chu vi hình chữ nhật đó.",
          "a": "78 cm",
          "kind": "word",
          "n": 3
        },
        {
          "q": "Mỗi xe chở được 35 học sinh. Có 183 học sinh đi tham quan thì cần ít nhất bao nhiêu xe?",
          "a": "6 xe",
          "kind": "word",
          "n": 4
        }
      ]
    }
  ],
  "count": 4,
  "difficulty": 2,
  "lang": "vi",
  "programme": "Chương trình GDPT 2018 môn Toán (Thông tư 32/2018/TT-BGDĐT)"
}
```

## Use cases

- Print weekend worksheets (phiếu bài tập cuối tuần) with an answer key
- Feed a maths practice app with endless, reproducible exercises
- Create several versions of a class test from different seeds
- Export to Word to adapt the sheet before printing

## FAQ

### Does it follow the Vietnamese curriculum?

Topics and number ranges follow the maths programme of the 2018 general education curriculum, grade by grade. The wording of word problems is APIBox's own.

### How do I get the same sheet again?

Send the same seed, grade, topics, count and difficulty. The seed is printed in the footer of the PDF.

### Are the answers checked?

Answers are computed by the generator; our tests re-evaluate thousands of generated exercises for every topic.
