API reference
astraltext.com API
Every tool on this site, callable over HTTP. Free, 1,000 calls a day, no card. You need a token, and a token takes about thirty seconds to get.
Get a free tokenOverview
The API exposes the same 21 tools the site runs in your browser. Same code, same tests, same results. Use it when the work belongs in a script, a build step or a server rather than in a tab.
| Base URL | https://astraltext.com/api/v1 |
| Auth | Bearer token, free |
| Format | JSON in, JSON out |
| CORS | Open, callable from a browser |
| Errors | application/problem+json |
Quickstart
- Create an account on the developer console.
- Mint a token. It is shown once, so copy it.
- Call any tool.
curl -X POST https://astraltext.com/api/v1/ai-text-cleaner \
-H "Authorization: Bearer ast_YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"input": "Hello world — from an AI."}'{
"tool": "ai-text-cleaner",
"result": "Hello world - from an AI.",
"chars": 24,
"ms": 1
}Authentication
Send the token in the Authorization header. One token works across all four Astral APIs: astraltext.com, astralpdf.com, astraljson.com and astralbatch.com.
Authorization: Bearer ast_...Tokens last a year. You can hold five at once and revoke any of them from the console, which takes effect within a minute. A token is a secret: keep it out of client-side code and out of git.
Rate limits and quota
| Limit | Value |
|---|---|
| Requests per minute, per token | 60 |
| Calls per day, per token | 1,000 |
| Input size | 200,000 characters |
| Quota reset | 00:00 UTC |
Every successful response carries X-RateLimit-Limit, X-RateLimit-Remaining and X-RateLimit-Reset. The per-minute counter is held in memory per server, so a short burst can occasionally exceed it by a few requests. The daily quota is the one that is enforced strictly.
Errors
Errors are RFC 7807 problem documents. The type is a stable URI you can branch on.
{
"type": "https://astraltext.com/errors/missing-token",
"title": "Missing token",
"status": 401,
"detail": "Send your token as \"Authorization: Bearer ast_...\"."
}| type | Status | When |
|---|---|---|
| missing-token | 401 | No Authorization header. |
| invalid-token | 401 | The token is not a valid Astral token. |
| expired-token | 401 | The token is more than a year old. |
| revoked-token | 401 | The token was revoked from the console. |
| rate-limited | 429 | More than 60 requests in a minute. |
| quota-exceeded | 429 | More than 1000 calls in a day. |
| unknown-tool | 404 | No tool with that slug. |
| bad-request | 400 | The body is not JSON, or input is not a string. |
| bad-option | 400 | option is not one the tool accepts. |
| input-too-large | 413 | input is over the character limit. |
| tool-failed | 422 | The tool could not process that input. |
| not-configured | 503 | The API is not accepting requests. |
Privacy
The tools on this site run in your browser and your text never leaves it. That is still true, and the API does not change it.
The API is a different surface, and it has to be said plainly: when you call it, the text in input is sent to our server, processed in memory and returned. It is not written to disk, not logged and not used to train anything. What we do record is the shape of the call: which token, which tool, how many calls, how many failed. If you would rather nothing leave your machine at all, use the tools on the site instead.
GET /api/v1/tools
The catalogue: every tool, its endpoint, its options and the current limits. No token needed, so you can read it before signing up.
curl https://astraltext.com/api/v1/toolsPOST /api/v1/{tool}
Runs one tool. Body fields:
| Field | Type | Notes |
|---|---|---|
| input | string | For single-document tools. Up to 200,000 characters. |
| inputs | string[] | For tools whose input type ends in []. Between 2 and 20 items, counted together against the same character limit. |
| option | string | Only for tools that list options. |
Managing tokens
The console does this for you. The endpoints are listed for completeness; they authenticate with a Firebase ID token, not with an API token.
| POST /api/v1/token | Mint a token. Returned once. |
| GET /api/v1/tokens | Your tokens and 14 days of usage. |
| DELETE /api/v1/tokens/{id} | Revoke one. |
All 21 tools
Each endpoint has its own page: the call, a worked example, its parameters and the errors it can return.
| Slug | What it does | Input | option |
|---|---|---|---|
| ai-text-cleaner | Strip the em dashes, curly quotes and hidden characters that make text read as AI-generated. | text | - |
| remove-em-dashes | Swap every em dash and en dash for a plain hyphen, the fastest way to stop text reading as AI-written. | text | - |
| remove-invisible-characters | Delete zero-width spaces, byte order marks and other characters you cannot see but your parser can. | text | - |
| remove-emoji | Strip emoji, flags and skin tone modifiers, including the multi-character sequences that break naive filters. | text | - |
| remove-line-breaks | Unwrap text that was hard-wrapped into short lines, keeping the blank lines that separate paragraphs. | text | - |
| strip-markdown | Remove Markdown formatting from any text and keep the words: headings, bold, links, code ticks and list markers stripped in one paste. | text | - |
| remove-citations | Strip [1] style citation markers, superscript numbers and trailing Sources lines from text, leaving the sentences and punctuation intact. | text | - |
| extract-code-blocks | Ignore the chat text. Extract only the code snippets from an AI response. | text | - |
| fix-spacing | Remove double spaces, fix triple line breaks, and humanize robotic formatting. | text | - |
| smart-case-converter | Convert text to UPPERCASE, lowercase, Title Case, or Sentence case. | text | sentence | title | uppercase | lowercase |
| email-sanitizer | Strip fonts and styles that break in Outlook or Gmail. Make your cold emails safe. | text | - |
| text-to-html | Convert your plain text paragraphs into simple HTML <p> tags. | text | - |
| word-counter | Instantly count words, characters, sentences, paragraphs, and get a reading-time estimate. | text | - |
| remove-html-tags | Strip every HTML tag and decode entities, leaving readable plain text with line breaks preserved. | text | - |
| extract-emails | Pull every email address out of any text, deduplicated, one per line, ready to paste. | text | - |
| extract-urls | Pull every link out of a text, without the trailing punctuation, deduplicated, one per line. | text | - |
| remove-punctuation | Delete punctuation and symbols from text while keeping letters, digits, accents and line structure. | text | - |
| ai-response-to-text | Paste a ChatGPT, Claude or Gemini answer and get clean plain text: headings, bold, tables and emoji gone. | text | - |
| slugify | Turn any headline or phrase into a clean, URL-safe slug for blog posts and permalinks. | text | - |
| remove-duplicate-lines | Strip duplicate lines from any list, log, or CSV while preserving the original order. | text | - |
| sort-lines | Sort any list alphabetically: imports, todo lists, CSV headers, and more. | text | asc | desc |
Code samples
const res = await fetch("https://astraltext.com/api/v1/ai-text-cleaner", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ASTRAL_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({ input: text }),
});
if (!res.ok) throw new Error((await res.json()).detail);
const { result } = await res.json();import os, requests
res = requests.post(
"https://astraltext.com/api/v1/ai-text-cleaner",
headers={"Authorization": f"Bearer {os.environ['ASTRAL_TOKEN']}"},
json={"input": text},
timeout=30,
)
res.raise_for_status()
result = res.json()["result"]Something missing or wrong here? Write to taoufik.leon.jabbari@gmail.com.