Vietnamese Text Tools API
Remove Vietnamese accents, convert TCVN3 (ABC) and VNI-Windows text to Unicode, Telex / VNI typing to letters, fix tone marks, split and sort names.
The Vietnamese text API gathers the conversions that Vietnamese software keeps needing. remove_accents turns “Tiếng Việt” into “Tieng Viet” (with slug=true for URLs). to_unicode converts text typed with the legacy TCVN3 / ABC fonts (.VnTime: “ViÖt Nam”) or VNI-Windows fonts (“Vieät Nam”) into Unicode; with from=auto it detects the encoding, which fixes old Word and Excel files and data exported from legacy systems.
telex and vni_typing turn keystrokes into letters (“Tieengs Vieetj” → “Tiếng Việt”, “Tie6ng1” → “Tiếng”), useful for search boxes and keyboards without an input method. normalize recomposes NFD text (common in files from macOS) and places tone marks consistently in the old style (hòa, thúy) or the new style (hoà, thuý) with tone_style=new, so that the same word always compares equal.
split_name splits full names into family, middle and given names (recognising compound family names such as Tôn Thất) and fixes their capitalisation; send one name per line for a batch. sort_names sorts a list the Vietnamese way: by given name, then middle name, then family name, with Vietnamese alphabetical order (a ă â … đ …).
Parameters
| Name | In | Type | Required | Default | |
|---|---|---|---|---|---|
action | body|query | string | no | remove_accents | remove_accents, to_unicode, telex, vni_typing, normalize, split_name or sort_names. |
text | body|query | string | yes | The text (max 200,000 characters). For names: one per line. | |
from | body|query | string | no | auto | For to_unicode: auto, tcvn3 or vni. |
tone_style | body|query | string | no | old | old (hòa) or new (hoà). |
names | body | array | no | For sort_names: an array of names (or one per line in text). | |
slug | body|query | boolean | no | With remove_accents: return a URL slug. |
Example
curl -X POST "https://apibox.io.vn/v1/vn-text" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"action":"to_unicode","text":"Vieät Nam"}'const res = await fetch('https://apibox.io.vn/v1/vn-text', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"action": "to_unicode",
"text": "Vieät Nam"
}),
});
const data = await res.json();
console.log(data);import requests
res = requests.post(
"https://apibox.io.vn/v1/vn-text",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"action": "to_unicode", "text": "Vieät Nam"},
timeout=30,
)
print(res.json())<?php
$ch = curl_init('https://apibox.io.vn/v1/vn-text');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_KEY', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => '{"action":"to_unicode","text":"Vieät Nam"}',
]);
$response = curl_exec($ch);
print_r(json_decode($response, true));Response
{
"action": "to_unicode",
"from": "vni",
"detected": true,
"length": 8,
"result": "Việt Nam"
}
Use cases
- Convert old TCVN3 / VNI documents and database exports to Unicode
- Accent-insensitive search and URL slugs
- Sort class lists and staff lists by given name
- Normalise names and addresses before de-duplicating
FAQ
Can capital letters in TCVN3 be converted?
TCVN3 capitals with tone marks were drawn by a separate font (.VnTimeH) using the lowercase codes, so they come out as lowercase letters; only Ă Â Đ Ê Ô Ơ Ư have their own codes.
Old or new tone placement?
Both are correct; the old style (hòa, thúy) is the most common in practice and is the default. tone_style=new places the mark on the second vowel of oa, oe, uy.
How are names sorted?
By given name first, then middle and family name, using Vietnamese collation, as in school and company lists.
Related APIs
Text Diff
Compare two texts by lines, words, characters, sentences or JSON and get the changes, a similarity score and a unified diff patch.
a-bSlugify
Turn titles into clean URL slugs: accents removed (Vietnamese đ included), custom separator, optional case keeping and maximum length.
123Text Statistics
Count words, characters, sentences, paragraphs and lines, estimate reading and speaking time, and list the most frequent words of a text.