Skip to main content

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 token

Overview

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 URLhttps://astraltext.com/api/v1
AuthBearer token, free
FormatJSON in, JSON out
CORSOpen, callable from a browser
Errorsapplication/problem+json

Quickstart

  1. Create an account on the developer console.
  2. Mint a token. It is shown once, so copy it.
  3. Call any tool.
curl
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."}'
response
{
  "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

LimitValue
Requests per minute, per token60
Calls per day, per token1,000
Input size200,000 characters
Quota reset00: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.

401
{
  "type": "https://astraltext.com/errors/missing-token",
  "title": "Missing token",
  "status": 401,
  "detail": "Send your token as \"Authorization: Bearer ast_...\"."
}
typeStatusWhen
missing-token401No Authorization header.
invalid-token401The token is not a valid Astral token.
expired-token401The token is more than a year old.
revoked-token401The token was revoked from the console.
rate-limited429More than 60 requests in a minute.
quota-exceeded429More than 1000 calls in a day.
unknown-tool404No tool with that slug.
bad-request400The body is not JSON, or input is not a string.
bad-option400option is not one the tool accepts.
input-too-large413input is over the character limit.
tool-failed422The tool could not process that input.
not-configured503The 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/tools

POST /api/v1/{tool}

Runs one tool. Body fields:

FieldTypeNotes
inputstringFor single-document tools. Up to 200,000 characters.
inputsstring[]For tools whose input type ends in []. Between 2 and 20 items, counted together against the same character limit.
optionstringOnly 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/tokenMint a token. Returned once.
GET /api/v1/tokensYour 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.

SlugWhat it doesInputoption
ai-text-cleanerStrip the em dashes, curly quotes and hidden characters that make text read as AI-generated.text-
remove-em-dashesSwap every em dash and en dash for a plain hyphen, the fastest way to stop text reading as AI-written.text-
remove-invisible-charactersDelete zero-width spaces, byte order marks and other characters you cannot see but your parser can.text-
remove-emojiStrip emoji, flags and skin tone modifiers, including the multi-character sequences that break naive filters.text-
remove-line-breaksUnwrap text that was hard-wrapped into short lines, keeping the blank lines that separate paragraphs.text-
strip-markdownRemove Markdown formatting from any text and keep the words: headings, bold, links, code ticks and list markers stripped in one paste.text-
remove-citationsStrip [1] style citation markers, superscript numbers and trailing Sources lines from text, leaving the sentences and punctuation intact.text-
extract-code-blocksIgnore the chat text. Extract only the code snippets from an AI response.text-
fix-spacingRemove double spaces, fix triple line breaks, and humanize robotic formatting.text-
smart-case-converterConvert text to UPPERCASE, lowercase, Title Case, or Sentence case.textsentence | title | uppercase | lowercase
email-sanitizerStrip fonts and styles that break in Outlook or Gmail. Make your cold emails safe.text-
text-to-htmlConvert your plain text paragraphs into simple HTML <p> tags.text-
word-counterInstantly count words, characters, sentences, paragraphs, and get a reading-time estimate.text-
remove-html-tagsStrip every HTML tag and decode entities, leaving readable plain text with line breaks preserved.text-
extract-emailsPull every email address out of any text, deduplicated, one per line, ready to paste.text-
extract-urlsPull every link out of a text, without the trailing punctuation, deduplicated, one per line.text-
remove-punctuationDelete punctuation and symbols from text while keeping letters, digits, accents and line structure.text-
ai-response-to-textPaste a ChatGPT, Claude or Gemini answer and get clean plain text: headings, bold, tables and emoji gone.text-
slugifyTurn any headline or phrase into a clean, URL-safe slug for blog posts and permalinks.text-
remove-duplicate-linesStrip duplicate lines from any list, log, or CSV while preserving the original order.text-
sort-linesSort any list alphabetically: imports, todo lists, CSV headers, and more.textasc | desc

Code samples

JavaScript
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();
Python
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.