Slugify API
Turn titles into clean URL slugs: accents removed (Vietnamese đ included), custom separator, optional case keeping and maximum length.
Send a text (query string, JSON or form field, or raw text body) and get a URL-safe slug. Accents and diacritics are removed (Việt Nam becomes viet-nam, đ becomes d), special letters such as ß, æ, ø and ł are transliterated, apostrophes and quotes are dropped and every other run of non-alphanumeric characters becomes a single separator.
Options: separator can be - (default), _, . or an empty string; lowercase=false keeps the original case; max_length (1-1000) cuts the slug and removes a trailing separator.
The input text is limited to 10,000 characters.
Parameters
| Name | In | Type | Required | Default | |
|---|---|---|---|---|---|
text | body|query | string | yes | Text to slugify (max 10,000 characters). Can also be sent as a raw text body. | |
separator | body|query | string | no | - | Separator: -, _, . or empty. Other values fall back to -. |
lowercase | body|query | boolean | no | true | Convert to lower case; false keeps the original case. |
max_length | body|query | number | no | Maximum slug length (1-1000). No limit when omitted. |
Example
curl "https://apibox.io.vn/v1/slugify?text=Xin%20ch%C3%A0o%20Vi%E1%BB%87t%20Nam!%20%C4%90%C3%A2y%20l%C3%A0%20APIBox" \
-H "Authorization: Bearer YOUR_API_KEY"const res = await fetch('https://apibox.io.vn/v1/slugify?text=Xin%20ch%C3%A0o%20Vi%E1%BB%87t%20Nam!%20%C4%90%C3%A2y%20l%C3%A0%20APIBox', {
method: 'GET',
headers: {
Authorization: 'Bearer YOUR_API_KEY',
},
});
const data = await res.json();
console.log(data);import requests
res = requests.get(
"https://apibox.io.vn/v1/slugify?text=Xin%20ch%C3%A0o%20Vi%E1%BB%87t%20Nam!%20%C4%90%C3%A2y%20l%C3%A0%20APIBox",
headers={"Authorization": "Bearer YOUR_API_KEY"},
timeout=30,
)
print(res.json())<?php
$ch = curl_init('https://apibox.io.vn/v1/slugify?text=Xin%20ch%C3%A0o%20Vi%E1%BB%87t%20Nam!%20%C4%90%C3%A2y%20l%C3%A0%20APIBox');
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: Bearer YOUR_API_KEY'],
]);
$response = curl_exec($ch);
print_r(json_decode($response, true));Response
{
"slug": "xin-chao-viet-nam-day-la-apibox"
}
Use cases
- Generate permalinks for blog posts and product pages
- Create file names or IDs from user-entered titles
- Build SEO-friendly URLs for Vietnamese content
- Normalize tags and category names
FAQ
Does it handle Vietnamese characters?
Yes. All tone marks are removed and đ/Đ become d/D, so "Xin chào Việt Nam" becomes xin-chao-viet-nam.
Can I use underscores instead of hyphens?
Yes, set separator=_. Allowed values are -, _, . and an empty string.
How do I limit the slug length?
Use max_length, for example max_length=60. A separator left at the end after cutting is removed.
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.
123Text Statistics
Count words, characters, sentences, paragraphs and lines, estimate reading and speaking time, and list the most frequent words of a text.
AaCase Converter
Convert text to lower, UPPER, Title, Sentence, camelCase, PascalCase, snake_case, kebab-case, CONSTANT_CASE or dot.case in one call.