# E-prescription Check & PDF API

> Check an outpatient prescription against Circular 26/2025/TT-BYT (fields, INN names, day limits, N / H types, code format) and print it as PDF.

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

Send the prescription as JSON: `facility` (name, address, phone, 5-character `code`), `prescriber`, `patient` (name, personal ID, birth date, sex, address, weight and caregiver for children under 72 months), `diagnosis` (text + ICD-10, checked against the Ministry of Health list) and `drugs` (`inn`, optional `brand`, `strength`, `unit`, `dose` per use, `times_per_day`, `days`, `route`, `timing`, optional `quantity` and `class`).

The validator applies Circular 26/2025/TT-BYT (in force 1/7/2025): required fields (birth date and sex may be omitted with a 12-digit personal ID), single-ingredient drugs written by INN (optionally "INN (brand)"), quantity = dose × times × days with a leading 0 under 10 and in words for narcotics, at most 30 days per drug (90 for chronic diseases of Annex VII with `chronic=true`), narcotic "N" prescriptions 7 days for acute disease or 3 periods of up to 10 days for cancer pain, psychotropic / precursor "H" prescriptions 10 or 30 days, poisons first, the 5-day collection window, and the e-prescription code format `xxxxxyyyyyyy-z` (5-character facility code, 7 random characters, type N / H / C) — a code is generated from `facility.code` when none is sent.

Errors and warnings cite the article. `format=pdf` renders an A5 prescription in the form of Annex I / II / III with a QR code of the prescription code (Be Vietnam Pro font). Nothing is stored and nothing is sent to the national prescription system; the drug class hint covers only common active ingredients, so send `class` from Circular 20/2017.

## Parameters

| Name | In | Type | Required | Default | Description |
|---|---|---|---|---|---|
| `facility` | body | object | yes |  | Facility: name, address, phone, code (5 characters). |
| `prescriber` | body | object | yes |  | Prescriber: name, title (bác sỹ / y sỹ). |
| `patient` | body | object | yes |  | Patient: name, id_number, birth, sex, address, insurance_number, phone, weight_kg and caregiver (under 72 months). |
| `diagnosis` | body | array | yes |  | Diagnoses: text or `{text, icd10}`. |
| `drugs` | body | array | yes |  | Drugs: inn, brand, strength, unit, dose, times_per_day, days, route, timing, quantity, class (N / H), poison, multi_ingredient. |
| `date` | body | string | no |  | Prescription date (default today). |
| `code` | body | string | no |  | Existing e-prescription code to validate. |
| `chronic` | body | boolean | no |  | Disease of Annex VII (up to 90 days). |
| `cancer_pain` | body | boolean | no |  | Narcotics for cancer pain (with 3 `periods`). |
| `long_term` | body | boolean | no |  | Psychotropics for long-term treatment (30 days). |
| `advice` | body | string | no |  | Advice printed on the PDF. |
| `format` | body | string | no |  | `pdf` to render (rejects prescriptions with errors unless `force=true`). |

## Example request

```bash
curl -X POST "https://apibox.io.vn/v1/vn-eprescription" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"facility":{"name":"Phòng khám Đa khoa An Bình","address":"12 Lê Lợi, Phường Sài Gòn, TP. Hồ Chí Minh","phone":"028 3822 0000","code":"79123"},"prescriber":{"name":"BS. Nguyễn Văn An","title":"Bác sỹ"},"patient":{"name":"Trần Thị Bình","id_number":"079190000001","address":"Phường Bến Thành, TP. Hồ Chí Minh"},"diagnosis":[{"text":"Viêm họng cấp","icd10":"J02.9"}],"date":"2026-11-11","drugs":[{"inn":"paracetamol","strength":"500mg","unit":"viên","dose":1,"times_per_day":3,"days":5,"route":"uống","timing":"sau ăn"},{"inn":"amoxicillin","brand":"Augmentin","strength":"500mg","unit":"viên","dose":1,"times_per_day":2,"days":7,"route":"uống","timing":"sau ăn sáng, tối"}]}'
```

## Example response

```json
{
  "valid": true,
  "errors": [],
  "warnings": [],
  "prescription_type": "C",
  "prescription_type_vi": "Đơn thuốc thường",
  "form": "Phụ lục I",
  "code": "79123k4m2x9p-C",
  "code_generated": true,
  "date": "2026-11-11",
  "collect_by": "2026-11-16",
  "collect_note": "The patient collects / buys the drugs within 5 days of the prescription date (Điều 12 khoản 9 điểm b).",
  "drugs": [
    {
      "n": 1,
      "name": "paracetamol",
      "strength": "500mg",
      "form": null,
      "class": "C",
      "quantity": 15,
      "unit": "viên",
      "quantity_text": "15",
      "usage_vi": "uống mỗi lần 01 viên, ngày 03 lần, sau ăn — 05 ngày"
    },
    {
      "n": 2,
      "name": "amoxicillin (Augmentin)",
      "strength": "500mg",
      "form": null,
      "class": "C",
      "quantity": 14,
      "unit": "viên",
      "quantity_text": "14",
      "usage_vi": "uống mỗi lần 01 viên, ngày 02 lần, sau ăn sáng, tối — 07 ngày"
    }
  ],
  "icd10": [
    {
      "code": "J02.9",
      "valid": true,
      "name_vi": "Viêm họng cấp tính, không xác định"
    }
  ],
  "legal": [
    {
      "ref": "Thông tư 26/2025/TT-BYT quy định về đơn thuốc và việc kê đơn thuốc hóa dược, sinh phẩm trong điều trị ngoại trú (Điều 2, 6–10, 12; Phụ lục I–III)",
      "effective_from": "2025-07-01"
    }
  ],
  "disclaimer": "Reference only, not medical advice; the health worker decides. Check the official text.",
  "disclaimer_vi": "Thông tin tham khảo, không phải tư vấn y khoa; quyết định thuộc về nhân viên y tế. Hãy đối chiếu văn bản chính thức.",
  "reviewed": "2026-11-11"
}
```

## Use cases

- Validate prescriptions in a small clinic or dental software before sending them
- Print a compliant prescription with its QR code from a telemedicine app
- Let a pharmacy check the day limits of an N or H prescription
- Train prescribers on the 2025 prescription rules

## FAQ

### Does it submit the prescription to the national system?

No. It checks and renders only; submission needs the facility's own account and connection.

### How is a narcotic or psychotropic drug detected?

Send class N or H per drug (Circular 20/2017 lists). A short built-in hint list of common ingredients raises a warning when the class is missing.

### Can I prescribe 90 days?

Only for diseases in Annex VII of the circular, at the prescriber's judgement: send chronic=true; otherwise the limit is 30 days per drug.
