Skip to main content

Remove citations API

Strip [1] style citation markers, superscript numbers and trailing Sources lines from text, leaving the sentences and punctuation intact.

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

When to call it

Text lifted from an encyclopaedia, a research summary or a model that cites its sources arrives peppered with bracketed numbers. They point at a bibliography that did not come with the text, so in any new context they are just debris that breaks the reading and the word count.

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/remove-citations \
  -H "Authorization: Bearer ast_YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"input": "The standard was published in 2005[1] and revised twice[2][3] since."}'
response
{
  "tool": "remove-citations",
  "result": "The standard was published in 2005 and revised twice since.",
  "chars": 59,
  "ms": 1
}

In your language

JavaScript
const res = await fetch("https://astraltext.com/api/v1/remove-citations", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.ASTRAL_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({"input": "The standard was published in 2005[1] and revised twice[2][3] since."}),
});
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/remove-citations",
    headers={"Authorization": f"Bearer {os.environ['ASTRAL_TOKEN']}"},
    json={"input": "The standard was published in 2005[1] and revised twice[2][3] since."},
    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

Which markers does it catch?
Bracketed numbers such as [1] and [12], runs of them, and the bracketed source markers models emit. The text between the markers is untouched.
Will it damage code or arrays?
Only bracketed content that looks like a citation is removed, so an array index in prose can be affected. Do not run it over source code; run it over prose.
Does it fix the spacing left behind?
Space left by a removed marker is collapsed, so you do not get a double space before a full stop.

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