Skip to main content

Extract email addresses API

Pull every email address out of any text, deduplicated, one per line, ready to paste.

EndpointPOST https://astraltext.com/api/v1/extract-emails
AuthBearer token, free
Sendsinput: text
Returnsresult: text
PriceFree. 1,000 calls a day, 60 a minute.

When to call it

Addresses arrive buried in things that were never structured: a pasted list, a signature block, a form field somebody used wrongly, an exported thread. Pulling them out in code is how the import runs the same way every time.

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/extract-emails \
  -H "Authorization: Bearer ast_YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"input": "Write to ada@example.com or, failing that, grace@example.org. Ada again: ada@example.com."}'
response
{
  "tool": "extract-emails",
  "result": "ada@example.com\ngrace@example.org",
  "chars": 33,
  "ms": 1
}

In your language

JavaScript
const res = await fetch("https://astraltext.com/api/v1/extract-emails", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.ASTRAL_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"input": "Write to ada@example.com or, failing that, grace@example.org. Ada again: ada@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/extract-emails",
    headers={"Authorization": f"Bearer {os.environ['ASTRAL_TOKEN']}"},
    json={"input": "Write to ada@example.com or, failing that, grace@example.org. Ada again: ada@example.com."},
    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

Are duplicates removed?
Yes. Each address appears once, in the order it was first seen.
What separates the results?
One address per line, so the result drops straight into a file or a form that takes a list.
Does it validate that the address exists?
No. It finds text shaped like an address. Whether a mailbox is real is a question only a mail server can answer.

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