Remove em dashes API
Swap every em dash and en dash for a plain hyphen, the fastest way to stop text reading as AI-written.
| Endpoint | POST https://astraltext.com/api/v1/remove-em-dashes |
| Auth | Bearer token, free |
| Sends | input: text |
| Returns | result: text |
| Price | Free. 1,000 calls a day, 60 a minute. |
When to call it
House styles that ban the em dash, plain-text emails, CSV columns and terminal output all want a hyphen. Doing the swap in code means it happens to every string a service emits, including the ones pasted in by somebody who did not know the rule.
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/remove-em-dashes \
-H "Authorization: Bearer ast_YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"input": "Two rules β one style guide β zero exceptions."}'response
{
"tool": "remove-em-dashes",
"result": "Two rules - one style guide - zero exceptions.",
"chars": 46,
"ms": 1
}In your language
JavaScript
const res = await fetch("https://astraltext.com/api/v1/remove-em-dashes", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ASTRAL_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"input": "Two rules β one style guide β zero exceptions."}),
});
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/remove-em-dashes",
headers={"Authorization": f"Bearer {os.environ['ASTRAL_TOKEN']}"},
json={"input": "Two rules β one style guide β zero exceptions."},
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
- Does it touch the ordinary hyphen?
- No. A hyphen-minus is already what this produces, so text that never had a dash comes back byte for byte identical.
- What about spacing around the dash?
- Spacing is preserved exactly as it was. The character is replaced and nothing else moves, so a spaced dash stays spaced.
- Which characters count as a dash here?
- The em dash and the en dash. Minus signs, figure dashes and horizontal bars are left alone because replacing those would change meaning in maths and in tables.
Other endpoints
- AI text cleaner API
- Remove invisible characters API
- Remove emoji API
- Remove line breaks API
- Strip Markdown API
- Remove citations 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