Slug
Standard · 1 creditConvert a string into a URL-safe slug with configurable separator, length limit, and unicode transliteration.
POST /api/slug
Section titled “POST /api/slug”Parameters
Section titled “Parameters”| Field | Type | Required | Default | Description |
|---|---|---|---|---|
input | string | Yes | — | Text to slugify |
separator | string | No | - | Separator character |
max_length | integer | No | 0 | Maximum slug length. 0 = no limit |
transliterate | boolean | No | false | Strip accents and transliterate unicode |
Response
Section titled “Response”| Field | Type | Description |
|---|---|---|
slug | string | Generated slug |
original | string | Original input |
separator | string | Separator used |
Examples
Section titled “Examples”Basic slug
Section titled “Basic slug”curl -X POST https://morso.dev/api/slug \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"input": "Hello World! This is a Test."}'{ "slug": "hello-world-this-is-a-test", "original": "Hello World! This is a Test.", "separator": "-"}Custom separator with length limit
Section titled “Custom separator with length limit”curl -X POST https://morso.dev/api/slug \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"input": "A Very Long Blog Post Title That Should Be Truncated", "separator": "_", "max_length": 30}'{ "slug": "a_very_long_blog_post_title", "original": "A Very Long Blog Post Title That Should Be Truncated", "separator": "_"}Unicode transliteration
Section titled “Unicode transliteration”curl -X POST https://morso.dev/api/slug \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"input": "Crème brûlée résumé", "transliterate": true}'{ "slug": "creme-brulee-resume", "original": "Crème brûlée résumé", "separator": "-"}