Email text sanitizer API
Strip fonts and styles that break in Outlook or Gmail. Make your cold emails safe.
| Endpoint | POST https://astraltext.com/api/v1/email-sanitizer |
| Auth | Bearer token, free |
| Sends | input: text |
| Returns | result: text |
| Price | Free. 1,000 calls a day, 60 a minute. |
When to call it
A forwarded thread arrives with a wall of angle brackets and whatever styling the last client injected. Anything that stores, searches or summarises email needs the message rather than the chain of quoting around it.
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/email-sanitizer \
-H "Authorization: Bearer ast_YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"input": "> > Original question\n> Reply above\n\nMy actual answer."}'response
{
"tool": "email-sanitizer",
"result": "Original question\nReply above\n\nMy actual answer.",
"chars": 48,
"ms": 2
}In your language
JavaScript
const res = await fetch("https://astraltext.com/api/v1/email-sanitizer", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ASTRAL_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"input": "> > Original question\n> Reply above\n\nMy actual answer."}),
});
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/email-sanitizer",
headers={"Authorization": f"Bearer {os.environ['ASTRAL_TOKEN']}"},
json={"input": "> > Original question\n> Reply above\n\nMy actual answer."},
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 remove the quoted message?
- It removes the quote markers so the text reads normally. Deciding which part of a thread is the new message is a separate judgement and is left to you.
- What styling is stripped?
- Inline style artefacts that clients inject and that break rendering when the text is moved elsewhere, notably in Outlook and Gmail.
- Is it safe on plain text?
- Yes. Text with no quote markers and no styling comes back unchanged.
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