Text case converter API
Convert text to UPPERCASE, lowercase, Title Case, or Sentence case.
| Endpoint | POST https://astraltext.com/api/v1/smart-case-converter |
| Auth | Bearer token, free |
| Sends | input: text |
| Returns | result: text |
| option | sentence | title | uppercase | lowercase |
| Price | Free. 1,000 calls a day, 60 a minute. |
When to call it
Headings, product names and imported records arrive in whatever case somebody typed. Normalising in code is what makes a catalogue look deliberate, and it is the only way to apply the same rule to ten thousand rows.
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/smart-case-converter \
-H "Authorization: Bearer ast_YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{"input": "état du marché. voilà tout.", "option": "title"}'response
{
"tool": "smart-case-converter",
"result": "État Du Marché. Voilà Tout.",
"chars": 27,
"ms": 2
}In your language
JavaScript
const res = await fetch("https://astraltext.com/api/v1/smart-case-converter", {
method: "POST",
headers: {
Authorization: `Bearer ${process.env.ASTRAL_TOKEN}`,
"Content-Type": "application/json",
},
body: JSON.stringify({"input": "état du marché. voilà tout.", "option": "title"}),
});
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/smart-case-converter",
headers={"Authorization": f"Bearer {os.environ['ASTRAL_TOKEN']}"},
json={"input": "état du marché. voilà tout.", "option": "title"},
timeout=30,
)
res.raise_for_status()
result = res.json()["result"]Parameters
| Field | Type | Notes |
|---|---|---|
| input | string | Required. Up to 200,000 characters per call. |
| option | string | One of: sentence, title, uppercase, lowercase. |
Errors
Errors are RFC 7807 problem documents with a stable type you can branch on.
| missing-token | 401 | No Authorization header. |
| bad-request | 400 | input missing or the wrong type. |
| bad-option | 400 | option is not one of the listed values. |
| tool-failed | 422 | The input could not be processed. detail says why. |
| quota-exceeded | 429 | Past 1,000 calls today. |
Questions
- Which cases can I ask for?
- Send "option" as sentence (the default), title, uppercase or lowercase. Anything else is refused with a bad-option error.
- Are accented letters handled?
- Yes. The letter classes are Unicode-aware, so a word starting with an accented character is capitalised correctly rather than being left alone or mangled.
- How is sentence case decided?
- The text is lowercased, then the first letter of the string and the first letter after a full stop, question mark or exclamation mark is capitalised.
Other endpoints
- AI text cleaner API
- Remove em dashes API
- Remove invisible characters API
- Remove emoji API
- Remove line breaks API
- Strip Markdown API
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