Slugify API
Turn any headline or phrase into a clean, URL-safe slug for blog posts and permalinks.
| Endpoint | POST https://astraltext.com/api/v1/slugify |
| Auth | Bearer token, free |
| Sends | input: text |
| Returns | result: text |
| Price | Free. 1,000 calls a day, 60 a minute. |
When to call it
Slugs are generated at the moment content is created, which is usually inside a CMS, an import script or a static site build. Using one endpoint everywhere is what stops the same title producing three different URLs in three parts of the stack.
For a one-off, the browser version needs no token and never sends your data anywhere: it runs on your own machine.
Example
curl
curl -X POST https://astraltext.com/api/v1/slugify \
-H "Authorization: Bearer ast_YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"input": "L'Été 2026: 10 idées (enfin) utiles!"}'response
{
"tool": "slugify",
"result": "lete-2026-10-idees-enfin-utiles",
"chars": 31,
"ms": 1
}In your language
JavaScript
const res = await fetch("https://astraltext.com/api/v1/slugify", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ASTRAL_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"input": "L'Été 2026: 10 idées (enfin) utiles!"}),
});
if (!res.ok) throw new Error((await res.json()).detail);
const { result } = await res.json();Python
import os, requests
res = requests.post(
"https://astraltext.com/api/v1/slugify",
headers={"Authorization": f"Bearer {os.environ['ASTRAL_TOKEN']}"},
json={"input": "L'Été 2026: 10 idées (enfin) utiles!"},
timeout=30,
)
res.raise_for_status()
result = res.json()["result"]Parameters
| Field | Type | Notes |
|---|---|---|
| input | string | Required. Up to 200,000 characters per call. |
Errors
Errors are RFC 7807 problem documents with a stable type you can branch on.
| missing-token | 401 | No Authorization header. |
| bad-request | 400 | input missing or the wrong type. |
| tool-failed | 422 | The input could not be processed. detail says why. |
| quota-exceeded | 429 | Past 1,000 calls today. |
Questions
- How are accents handled?
- They are folded to their base letter, so an accented title produces an ASCII slug rather than a percent-encoded one.
- What happens to punctuation and spaces?
- Punctuation is dropped and runs of spaces become a single hyphen. Leading and trailing hyphens are trimmed.
- Is it stable?
- Yes. The same title always produces the same slug, which matters because a slug that changes is a URL that breaks.
Other endpoints
- AI text cleaner API
- Remove em dashes API
- Remove invisible characters API
- Remove emoji API
- Remove line breaks API
- Strip Markdown API
A token takes thirty seconds
Free, no card, 1,000 calls a day, and the same token works on astraltext.com, astralpdf.com, astraljson.com and astralbatch.com.
Get a free token