Skip to main content

Email text sanitizer API

Strip fonts and styles that break in Outlook or Gmail. Make your cold emails safe.

EndpointPOST https://astraltext.com/api/v1/email-sanitizer
AuthBearer token, free
Sendsinput: text
Returnsresult: text
PriceFree. 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

FieldTypeNotes
inputstringRequired. Up to 200,000 characters per call.

Errors

Errors are RFC 7807 problem documents with a stable type you can branch on.

missing-token401No Authorization header.
bad-request400input missing or the wrong type.
tool-failed422The input could not be processed. detail says why.
quota-exceeded429Past 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

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