Remove invisible characters API
Delete zero-width spaces, byte order marks and other characters you cannot see but your parser can.
| Endpoint | POST https://astraltext.com/api/v1/remove-invisible-characters |
| Auth | Bearer token, free |
| Sends | input: text |
| Returns | result: text |
| Price | Free. 1,000 calls a day, 60 a minute. |
When to call it
Invisible characters are how a copied string breaks a comparison, a database unique index or a URL slug while looking perfectly normal on screen. Stripping them at the point data enters your system is the only reliable place, because nobody will ever spot one in a code review.
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-invisible-characters \
-H "Authorization: Bearer ast_YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"input": "user​@exampleÂcom"}'response
{
"tool": "remove-invisible-characters",
"result": "user@examplecom",
"chars": 15,
"ms": 1
}In your language
JavaScript
const res = await fetch("https://astraltext.com/api/v1/remove-invisible-characters", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ASTRAL_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"input": "user​@exampleÂcom"}),
});
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-invisible-characters",
headers={"Authorization": f"Bearer {os.environ['ASTRAL_TOKEN']}"},
json={"input": "user​@exampleÂcom"},
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
- Which characters are removed?
- Zero-width space, joiner and non-joiner, the left-to-right and right-to-left marks, the bidirectional overrides, word joiner, invisible operators, the soft hyphen, the Mongolian vowel separator and the byte-order mark.
- Are ordinary spaces affected?
- No. The ordinary space, tab and newline are untouched. Only characters that render as nothing are removed.
- Why would text contain these at all?
- They arrive from PDF copy-paste, word processors, chat apps that pad emoji, and model output. Most are added for layout and survive the copy even though the layout does not.
Other endpoints
- AI text cleaner API
- Remove em dashes 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