Vietnamese Profanity Filter API
Detect and mask Vietnamese (and common English) profanity, insults and slurs, including unaccented spellings, teencode, l33t and separators like đ.ị.t.
The profanity filter finds offensive words in Vietnamese comments, chats and reviews and returns a masked version. Its lexicon covers sexual and vulgar words, insults and teencode abbreviations (đm, vcl, dmm, clgt…) plus common English swear words and slurs, each with a category (sexual, vulgar, insult, slur) and a severity (mild, moderate, severe).
It is built for the usual tricks: missing accents where the result is still unambiguous (dit me), repeated letters (đụuuu), l33t digits and symbols (sh1t, f@ck), and separators inside words (đ.ị.t, l-ồ-n). Words that are only offensive with their accents (lồn, cặc, buồi) are matched with accents only, so “lon bia”, “các bạn” and “buổi sáng” are never flagged; ambiguous words (cc, đù, cave) are only checked with strict=true.
The response gives the overall severity, a score, each match with its position and the censored text (mask character, keep_first=true to keep the first letter). Add your own words with extra_words and whitelist with allow.
Parameters
| Name | In | Type | Required | Default | |
|---|---|---|---|---|---|
text | body|query | string | yes | Text to check (max 100,000 characters). | |
mask | body|query | string | no | * | Masking character. |
keep_first | body|query | boolean | no | false | Keep the first letter of masked words. |
strict | body|query | boolean | no | false | Also flag ambiguous words (cc, đù, cave…). |
extra_words | body|query | string | no | Comma-separated words to add. | |
allow | body|query | string | no | Comma-separated words to ignore. |
Example
curl -X POST "https://apibox.io.vn/v1/profanity-vi" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"text":"Đm, cái này vcl thật","keep_first":true}'const res = await fetch('https://apibox.io.vn/v1/profanity-vi', {
method: 'POST',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
"text": "Đm, cái này vcl thật",
"keep_first": true
}),
});
const data = await res.json();
console.log(data);import requests
res = requests.post(
"https://apibox.io.vn/v1/profanity-vi",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={"text": "Đm, cái này vcl thật", "keep_first": True},
timeout=30,
)
print(res.json())<?php
$ch = curl_init('https://apibox.io.vn/v1/profanity-vi');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_KEY', 'Content-Type: application/json'],
CURLOPT_POSTFIELDS => '{"text":"Đm, cái này vcl thật","keep_first":true}',
]);
$response = curl_exec($ch);
print_r(json_decode($response, true));Response
{
"profane": true,
"severity": "moderate",
"score": 60,
"count": 2,
"categories": [
"vulgar"
],
"matches": [
{
"text": "Đm",
"start": 0,
"end": 2,
"word": "dm",
"category": "vulgar",
"severity": "moderate"
},
{
"text": "vcl",
"start": 12,
"end": 15,
"word": "vcl",
"category": "vulgar",
"severity": "moderate"
}
],
"censored": "Đ*, cái này v** thật",
"strict": false
}
Use cases
- Moderate comments, reviews and chat messages
- Filter usernames and display names at sign-up
- Flag messages for human review in support tools
- Keep bot and game chats family-friendly
FAQ
Will it flag normal words without accents?
No. Words like lồn / cặc / buồi only count with their accents, because lon, cac, buoi are ordinary words without them.
Can I tune the list?
Yes: extra_words adds comma-separated words or phrases, allow removes entries, strict=true enables ambiguous ones.
Is the text stored?
No, it is processed in memory only.
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.